BASIC 128 Point Command

C'est la catégorie reine de l'ordinophile, 8 bits et pas un de plus!
Single board ou bus S-100 acceptés.

Modérateurs : Papy.G, fneck, Carl

Répondre
Avatar de l’utilisateur
jonesypeter
Messages : 33
Inscription : 08 mai 2021 15:33
Localisation : West Sussex, Great Britain

BASIC 128 Point Command

Message par jonesypeter »

Greetings,

Please could I ask for some help with the Point command. I have translated the French from the BASIC 128 manual and the translation I get is making sense to me:

the number is positive if the point belongs to the shape, negative if it belongs to the bottom:

Image

In summary, I'm trying to get the Ink or Paper colour at a specific location for simple collision detection in BASIC. I'm assuming there is not a reverse of the COLOR command which tells us the attributes at that character position.

Thanks

Peter


Salutations,

Je voudrais vous demander de l'aide concernant la commande Point. J'ai traduit le français du manuel BASIC 128 et la traduction que j'obtiens me semble logique :

le nombre est positif si le point appartient à la forme, négatif s'il appartient au fond :

En résumé, j'essaie d'obtenir la couleur de l'encre ou du papier à un endroit spécifique pour une simple détection de collision en BASIC. Je suppose qu'il n'existe pas d'inverse de la commande COLOR qui nous indique les attributs à cette position de caractère.

Merci

Peter
Site Web et forum My Sinclair ZX Spectrum

J'utilise DeepL et Google Traduction
OlivierV
Messages : 16
Inscription : 26 oct. 2020 14:09
Localisation : Hérault

Re: BASIC 128 Point Command

Message par OlivierV »

Hi,

not an expert of this programming language. But it would seem like there is a notion of foreground and background.
A location where a color had been specified would return that color value (positive). On the other case, it would return a negative value (the color, but negated?).

Regards,

Olivier
Avatar de l’utilisateur
jonesypeter
Messages : 33
Inscription : 08 mai 2021 15:33
Localisation : West Sussex, Great Britain

Re: BASIC 128 Point Command

Message par jonesypeter »

Thanks Oliver. That make sense as the Color command sets the border, foreground and ink colours.
Site Web et forum My Sinclair ZX Spectrum

J'utilise DeepL et Google Traduction
OlivierV
Messages : 16
Inscription : 26 oct. 2020 14:09
Localisation : Hérault

Re: BASIC 128 Point Command

Message par OlivierV »

This would make it possible to create invisible areas to detect collision. An area drawn with the same color as background.
Daniel
Messages : 17400
Inscription : 01 mai 2007 18:30
Localisation : Vaucluse
Contact :

Re: BASIC 128 Point Command

Message par Daniel »

Les couleurs de forme et de fond ne sont pas définies pour un caractère. Elles peuvent être différentes à l'intérieur d'un bloc de 8x8 pixels.
Elles sont définies pour un segment de 8 pixels, par un octet de la mémoire vidéo couleur (4 bits pour le fond et 4 bits pour la forme).
Pour les obtenir il faut sélectionner la mémoire vidéo couleur et lire l'octet.
La méthode de sélection, l'adresse en mémoire et la structure de l'octet couleur sont différentes entre les TO et les MO.
Daniel
L'obstacle augmente mon ardeur.
Avatar de l’utilisateur
jonesypeter
Messages : 33
Inscription : 08 mai 2021 15:33
Localisation : West Sussex, Great Britain

Re: BASIC 128 Point Command

Message par jonesypeter »

Hi Daniel,

Thanks for the reply. So I have written a very simple piece of code:

Code : Tout sélectionner

5  cls
10 for a=0 to 15
20 color a,15-a
30 print "*";
40 next a
50 for x=0 to 127 step 8
55 print
60 print point(x,0);" ";
70 next x
So if I understand correctly 0 would relate to black Ink, -1 would relate to black paper, which is why the numbers run from -16 to -1.

Image

Thanks

Peter

PS - Daniel - Would you prefer me to type my posts in English, or translated French? Thank you.
Site Web et forum My Sinclair ZX Spectrum

J'utilise DeepL et Google Traduction
Daniel
Messages : 17400
Inscription : 01 mai 2007 18:30
Localisation : Vaucluse
Contact :

Re: BASIC 128 Point Command

Message par Daniel »

English is better :wink:
Daniel
L'obstacle augmente mon ardeur.
Avatar de l’utilisateur
hlide
Messages : 3495
Inscription : 29 nov. 2017 10:23

Re: BASIC 128 Point Command

Message par hlide »

0 -> 0000 -> not 0 -> 1...1_1111 -> -1
...
15 -> 1111 -> not 1111 -> 1...1_0000 -> -16

It sounds more like a one's complement (NOT) than a two's complement (NEG) in practice.
Avatar de l’utilisateur
jonesypeter
Messages : 33
Inscription : 08 mai 2021 15:33
Localisation : West Sussex, Great Britain

Re: BASIC 128 Point Command

Message par jonesypeter »

Thank you for all the help. I'm very impressed with the increased colour range of the TO70/70. The vast majority of other 8-bit computers of the time only offered 4 colours at 320 x 200. If you wanted more colours you often have to deal with a lower resolution (like with the Amstrad CPC). My beloved ZX Spectrum offered 7 colours (+bright versions) + black, but with the limitations of one ink and one paper per 8x8 pixels.

Having used a number of 8-bit computers the BASIC is very easy to pick up. Next stop - User defined characters.

I plan to convert some BASIC ZX Spectrum Type-In Games.

Code : Tout sélectionner

5 screen 6,6,6:cls
10 dim a$(16)
20 let a$(1)=" 0 - Black":let a$(2)=" 1 - Red":let a$(3)=" 2 - Green":let a$(4)=" 3 - Yellow":let a$(5)=" 4 - Blue":let a$(6)=" 5 - Magenta":let a$(7)=" 6 - Cyan":let a$(8)=" 7 - White":let a$(9)=" 8 - Grey":let a$(10)=" 9 - Light Red":let a$(11)=" 10 - Light Green"
25 let a$(12)=" 11 - Pale Yellow":let a$(13)=" 12 - Pale Blue":let a$(14)=" 13 - Pale Magenta":let a$(15)=" 14 - Light Cyan":let a$(16)=" 15 - Orange"

30 for a=0 to 15

50 color a,a:print "     ";:color 0,6:print a$(a+1)
60 next a
Image
Site Web et forum My Sinclair ZX Spectrum

J'utilise DeepL et Google Traduction
__sam__
Messages : 7961
Inscription : 18 sept. 2010 12:08
Localisation : Brest et parfois les Flandres

Re: BASIC 128 Point Command

Message par __sam__ »

And you haven’t seen yet the palette of 16 colors out of 4096 one can get on mo6, to8, to9 and to9+.

@hlide you are right this is a bitwise complement operation. Negative numbers represent background colors and conversely, positive values represent fourground color. Hence 0 is a black foreground whereas -1 is returned by the black background, and of course 0=NOT -1 (bitwise).
Samuel.
A500 Vampire V2+ ^8^, A1200 (030@50mhz/fpu/64mb/cf 8go),
A500 GVP530(MMU/FPU) h.s., R-Pi, TO9, TO8D, TO8.Démos
Répondre