Labelling Locations in a DAT Array
pjv
Posts: 1,903
Hi All;
Hopefully I can better describe what I'm looking to accomplish than I did last time I posted a question.... so here goes.
Suppose I have declared a zero valued a array in a DAT block in low hub memory; say from some address through $1FF, such as
DAT
HubArray long 0[$1FF - $]
And then I wish to assign labels to access various specific longs in that array.
Is there some more elegant way to do this than breaking up the array definition with those lables interspersed at the required locations, as in:
DAT
HubArray3 long 0[Array4 -$]
HubArray4 long 0[Array8 -$]
HubArray8 long 0[Array22 -$]
HubArray22 long 0[ArrayEnd -$]
ArrayEnd long 0
In other words, is there some clever way to "overlay" labels onto a piece of declared hub memory ??
Thanks,
Peter (pjv)
Hopefully I can better describe what I'm looking to accomplish than I did last time I posted a question.... so here goes.
Suppose I have declared a zero valued a array in a DAT block in low hub memory; say from some address through $1FF, such as
DAT
HubArray long 0[$1FF - $]
And then I wish to assign labels to access various specific longs in that array.
Is there some more elegant way to do this than breaking up the array definition with those lables interspersed at the required locations, as in:
DAT
HubArray3 long 0[Array4 -$]
HubArray4 long 0[Array8 -$]
HubArray8 long 0[Array22 -$]
HubArray22 long 0[ArrayEnd -$]
ArrayEnd long 0
In other words, is there some clever way to "overlay" labels onto a piece of declared hub memory ??
Thanks,
Peter (pjv)
Comments
You could also use CONstant declarations, e.g. #0, base[5], one, two[2], end to the same effect.
Thanks for your response.
What you suggest works for Cog memory, but what I need is some lableling overlay procedure for Hub memory, and for that it does not work. The "res" directive will not modify the Hub location pointer when the program is being compiled, so the "res" is ignored.
I can continue to break up the Array declarations into it's component pieces, but I was hoping for something more elegant.
Cheers,
Peter (pjv)
@ Kuroneko; The access is for both, Spin and PASM. I am setting up a "low memory" reserved area for "direct" mailbox access from each of 7 assembler cogs.
@ David; Right. That is what I'm doing presently, and is quite workable. I was hoping for a bit cleaner syntax to create the array's access labels.
Thanks all
Cheers,
Peter (pjv)