Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Should I be able to declare an array of @ addresses?
#1
Not sure if this is a bug or not, so I thought I'd pose the question first. Smile

I read this post from last year, which suggests that @ addresses should now be treated as constants:
<!-- l --><a class="postlink-local" href="http://www.boriel.com/forum/post4283.html?hilit=%20not%20constant%20#p4283">post4283.html?hilit=%20not%20constant%20#p4283</a><!-- l -->

So I figured I should probably be able to make some labels and then do something like this:
Code:
dim addressMap(4) as uinteger => {@label1,@label2,@label3,@label4}

... except I can't - the compiler won't accept the @ addresses as being constants if they're being used to initialise an array.

So I though I might cheat and try to do this instead:
Code:
const c1 as uinteger = @label1
const c2 as uinteger = @label2
const c3 as uinteger = @label3
const c4 as uinteger = @label4

dim addressMap(4) as uinteger => {c1,c2,c3,c4}

... but that doesn't work either - it doesn't think the constants are constant either. Smile

Should either of those things work? Or am I going about doing this the wrong way? I'm importing some data in asm defb format and thought I might use the @ addresses of some ZX Basic labels to refer to various points within the data. Using 1.4.0-s1885, by the way. Thanks for any input!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)