Defining variables in different slots of the BS2sx..
deno
Posts: 242
Hello...The question is...do I have to define the exact same "name", size, and location in all program slots that I use?· Can each slot be independent? Each of the slots in use has a different program in that slot, thus requiring different variable names, sizes and locations.·
I do know that any values calculated can be put into scratch ram and called by different slots.
Deno
I do know that any values calculated can be put into scratch ram and called by different slots.
Deno
Comments
If you don't care about that, then no you don't have to name them in the same order. Note that there ARE only 26 bytes of 'register space' RAM, and that each slot re-uses the same 26 bytes. So when a slot is activated with 'run', it's quite likely that its variables already have some 'junk' values in them.
Deno
After those words that are to be shared, you can define other words, bytes, nibs and bits that are local to each slot.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Sid
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Yesterday is history, tomorrow is a mystery, and today is a gift.
That is why they call it the present.
Don't have VGA?
Newzed@aol.com
·
Depends on what you mean by "9th position"
The Stamp allocates space for all Words before it starts on the Bytes, then Nibs, then Bits. So if your program defines (for example), 4 words and then 5 bytes in slot 0, with your color variable as the fifth byte, and then you have the same arrangement in slot 1, yes, the two variables will be the same. In terms of counting bytes from the start of the Stamp RAM, the byte is in position 13, but it is 9th in terms of defined variables. If you add one more Word variable, even if you define it in the very last line of your program, your byte variable will be kicked up two positions (counting by byte) in the physical RAM.
You always have to think about where it ends up in terms of counting in physical RAM, and understand that STAMPW.EXE allocates space by variable size, and within that, by the order the variables are declared in the program. That is why I like to define all my variables to be shared as words, and smaller variables to be shared as alias parts of those words.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com