Simultaneous Global and Local Variable References
pjv
Posts: 1,903
Hi All;
In assembler I wish to have some local variables identified by the :VarName convention, but also access the same variable with a different but Global name. When I try to double define it, the Global of course limits the range of the Local, and defeats the intent
Is there a trick to make·this be possible?
Many thanks,
Cheers,
Peter (pjv)
·
In assembler I wish to have some local variables identified by the :VarName convention, but also access the same variable with a different but Global name. When I try to double define it, the Global of course limits the range of the Local, and defeats the intent
Is there a trick to make·this be possible?
Many thanks,
Cheers,
Peter (pjv)
·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life may be "too short", but it's the longest thing we ever do.
That method is so lost in left field it doesn't know the name of the game, but I use it when I need globals.
You may be able to find unused addresses at 32000, or OFFSCREEN_BUFFER, or near STACK.
In PASM:
It is unfortunately hard to find addresses in DAT space, although they tend to be offset by 16 bytes if you do.
I have a worse hack to do that with, by using a bizarre unusual value like $ABADF00D and searching
the whole hub for it using a variable to count to its address. Very inefficient.
Maybe not what you want. I'd wait for a better answer. Mine is awful.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I should be typing in Spin now.
-Phil
@Brad... probably that I am lazy, and wanted to include a generic piece of code into several assembly cogs without going renaming the variables in each duplicate, yet still trying to access the routines individually.
@VIRAND.... I'm messing with assembler here, so I'm not sure how your comments apply.
@Phil.... I tried that, and as you say, ony a single variable is not enough. I was hoping that I could do some kind of equate in the constants section, but a label with a leading colon seems not permitted there.
Cheers,
Peter (pjv)
Post Edited (pjv) : 2/8/2010 2:10:05 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Life may be "too short", but it's the longest thing we ever do.