12-23-2014, 02:28 AM
My next ZX BASIC game requires a lookup table for variable sized data.
The simplest solution would be something like this:
But compiling this program using latest version of ZX BASIC (incorrectly) produces the following error messages:
Another alternative would be declaring the lookup table directly in ASM, but ZX BASIC doesn't support mapping arrays to memory addresses either:
For now, I'm implementing everything "manually" instead of using ZX BASIC arrays. But it would be nice if this problem could be fixed in future releases!
The simplest solution would be something like this:
Code:
data1:
asm
defb 0,1,2,3,4,5
end asm
data2:
asm
defb 6,7,8
end asm
data3:
asm
defb 9,10,11,12
end asm
DIM array(1 TO 3) AS UINTEGER = { @data1, @data2, @data3 }
But compiling this program using latest version of ZX BASIC (incorrectly) produces the following error messages:
Code:
prog.bas:14: Initializer expression is not constant.
prog.bas:14: Initializer expression is not constant.
prog.bas:14: Initializer expression is not constant.
Another alternative would be declaring the lookup table directly in ASM, but ZX BASIC doesn't support mapping arrays to memory addresses either:
Code:
DIM array(1 TO 3) AS UINTEGER AT @data
For now, I'm implementing everything "manually" instead of using ZX BASIC arrays. But it would be nice if this problem could be fixed in future releases!