Simple BASIC 'DATA Statement' Query.

Page 2/3
1 | | 3

By Hit-Biter

Master (166)

Hit-Biter's picture

03-08-2022, 11:25

The URL don't work even if i cut n paste and the WIKI has no info in it even under wiki/graphics/sprites.

By NYYRIKKI

Enlighted (6011)

NYYRIKKI's picture

03-08-2022, 11:34

This is the URL (Same that I posted before)

By Hit-Biter

Master (166)

Hit-Biter's picture

03-08-2022, 17:18

NYYRIKKI wrote:

This is the URL (Same that I posted before)

Quick Question. In a listing or program can ANY double value be represented by a single value of the 'PAIR' ? eg 00 = 0 or FF=F or CC=C ?

Only reason i ask is there is a single value F in the listing when I'm dealing with a 16x16 block of byte data. I think its a typo or corruption of the listing as its even in my spaceman.bas file. Line 1570

By Briqunullus

Hero (616)

Briqunullus's picture

03-08-2022, 17:52

Leading zero's are only for formatting. It looks nice and increases readability in larger blocks of DATA lines.

So if zero's have no function in code, &HF = &H0F.

Try it yourself:
PRINT &HF
PRINT &H0F

By Hit-Biter

Master (166)

Hit-Biter's picture

03-08-2022, 18:30

Can FF be represented as F ?

By wolf_

Ambassador_ (10076)

wolf_'s picture

03-08-2022, 18:32

Nop.

F = 15
FF = 255

By Hit-Biter

Master (166)

Hit-Biter's picture

03-08-2022, 19:06

wolf_ wrote:

Nop.

F = 15
FF = 255

OK read this data line. DATA 0,01,03,03,07,07,8F,FF,FF,FF,3F,3F,0F,07,01,0

Notice the first 0 and the last 0 are single zero's because the computer can understand it represents 00 and so it can simply be abbreviated to 0 ! What i am asking is, when entering data, can ANY double value such as FF be abbreviated to F in the same manner as 00 can be abbreviated to 0 ! ???

By wolf_

Ambassador_ (10076)

wolf_'s picture

03-08-2022, 19:09

Imagine you have this in your data: 0,00,00,0f,f0,ff,0

And let's assume that these f-values are really values you want like that. You can only represent them like that.

If you would reduce them to one digit... like 0,00,00,f,f,f,0 ... how would the MSX know it's meant to be something else?

By wolf_

Ambassador_ (10076)

wolf_'s picture

03-08-2022, 19:11

Or to put it shortly: ffff can only be ffff. 0000 is equal to 000, 00 and 0, because it's zero. Multiple times zero is still zero.

By Hit-Biter

Master (166)

Hit-Biter's picture

03-08-2022, 19:23

wolf_ wrote:

Imagine you have this in your data: 0,00,00,0f,f0,ff,0

And let's assume that these f-values are really values you want like that. You can only represent them like that.

If you would reduce them to one digit... like 0,00,00,f,f,f,0 ... how would the MSX know it's meant to be something else?

OK I'm getting confused. In your example 0,00,00,0F,F0,FF,0 I would reduce that to 0,0,0,0F,F0, and its this part that i'm asking about, FF to F ? and ending in 0. Its only the DOUBLE values containing the SAME character such as AA or BB up to FF. But i get the impression this would represent an error which confirms there IS an error in the listing as line 1570 has a single F in the DATA statement. Anyway ts no big deal ive got a fair grasp of this now so its fine.

Page 2/3
1 | | 3