Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Best way to put UDG in my program ?
#2
To do this, there are several ways. ZX Basic does not support READ / DATA / RESTORE yet.
The traditional way is to POKE USR "a" + n, byte for UDG "a" and so on. To do this, you should compile with --sinclair parameter (which will make ZX Basic as much compatible as possible with original Sinclair BASIC.

Try this:
Code:
FOR i = 0 TO 7
    POKE USR "a" + i, BIN 01010101
    PRINT "\a": REM you can use "\x" for UDG x
NEXT i

Compile the above with:
Code:
zxb --sinclair -taB udg.bas
This should work as expected.

Another (more advanced) way is to store all the UDG data in an array and then do POKE UInteger 23672 with the address of the array data.
This is done in this example:
<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Snake.Bas">http://www.boriel.com/wiki/en/index.php ... :Snake.Bas</a><!-- m -->

You don't need to use --sinclair in this 2nd case.
Hope this clarifies how to use UDGs in ZX Basic
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)