Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UDG definition bug (*solved*)
#2
Try compiling with --spectrum and see if it works. If it does, then it's not a bug, but a memory corruption.

The UDG zone is not reserved anymore, and POKE USR "a" will poke into the address pointed by PEEK Uinteger 23676. You will have to set this address to a safe (unallocated) memory zone. The --spectrum flag does this already for you (among other things).

The new (optima way) is to define an array of bytes, and POKEing 23676 to its address:
Code:
DIM myudg(8 * 10) As Ubyte : REM 10 UDG chars
POKE Uinteger 23676, @myudg(0) : REM Points 23676 to Address of myudg array 1st element
Now you can safely use USR "a".
However, a better way is to directly initialize the array:
Code:
DIM myudg(9, 7) As Ubyte => { {255, 255, 255, 255,  255, 255, 255, 255}, _
        {255, 255, 255, 255,  255, 255, 255, 255}, _
       ... ' 10 times
       } : REM 10 UDG chars
POKE Uinteger 23676, @myudg(0) : REM Points 23676 to Address of myudg array 1st element already with graphics
Since the myudg array already contains the UDG data, you needn't to use POKE, and will save memory.

Note: The --spectrum flag tries to be the most compatible with original Sinclair Basic (at the expenses performance and memory).
If you are converting old original Sinclair BASIC programs, this flag could be useful.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)