08-10-2011, 11:25 AM
I was trying to keep a list of memory addresses (pointing to tile data) in an array to use as a cheap lookup table. I tried to do something like this:
... which doesn't work, because @Data isn't a constant so I get an "Initializer expression is not constant" compiler error.
I could write and call a method which loads the array with the correct information on startup, but I just wanted to check that I wasn't missing an obvious trick which would allow me to avoid that? Thanks for any tips!
Code:
'data
Data:
asm
defb 0, 0, 191, 191, 191, 191, 191, 191, 0, 0, 253, 253, 253, 253, 253, 253
end asm
'array of addresses
dim tsAddress(TSMAXTILES) as uinteger => {@Data}
... which doesn't work, because @Data isn't a constant so I get an "Initializer expression is not constant" compiler error.
I could write and call a method which loads the array with the correct information on startup, but I just wanted to check that I wasn't missing an obvious trick which would allow me to avoid that? Thanks for any tips!