Posts: 282
Threads: 48
Joined: Feb 2011
Reputation:
0
I tried the program UDG.bas in the examples folder.
When I try to change the BIN values and run the program one of the numbers is removed from each BIN statement,
e.g.
0 DATA BIN 1111,BIN 1011,BIN 1011,BIN 1011,BIN 1011,BIN 1011,BIN 1011,BIN 1111
becomes:
DATA BIN 111,BIN 011,BIN 011,BIN 011,BIN 011,BIN 011,BIN 011,BIN 111
Posts: 1,766
Threads: 55
Joined: Aug 2019
Reputation:
24
There's no "UDG.bas" program in the standard distribution. Maybe you did' download the example from another site?
The program "snake.bas" uses an UDG, by the way.
Unfortunately DATA is not yet supported (READ, DATA, RESTORE are a waste of space :!: but will be supported in the next release). You should use a DIM array as explained in a previous post.
BIN 1111 can be written as 1111b. See <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Syntax#Numbers">http://www.boriel.com/wiki/en/index.php ... ax#Numbers</a><!-- m --> ZX BASIC support binary and hexadecimal values using b and h suffixes.
Anyway BIN is to be implemented in this release (1.2.7) about to be published to allow better compatibility with old BASIC listings. BIN allows up to 16 [0|1] digits constants, so it's a 16 bit value.
Posts: 282
Threads: 48
Joined: Feb 2011
Reputation:
0
ah yes I must have the old version from world of spectrum, thanks for the help
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
I myself still prefer to use the prefix for binary data: %01100011 is the same as 01100011b or BIN 01100011