Umm.. see, theres this nice little thing called scratch-pad memory.. and umm, well nobody around here likes talking about it.. but umm.. yeah, it gives ya an extra 63 varibles to work with.
The way scratch-pad memory works: You can load/save a varible into a spot in the scratch pad, but you have to address it by number, and you cant do anything with it when its in the scratch-pad memory.
So, to get around this what we do is we reserve 4 bytes for swap memory and load stuff in and out of the scratch-pad memory.. lots of extra room! Hint hint on this: Use aliases! makes for very much more readable code!!
get 10, tempvar1
That retrieves the value of scratch-pad location #10, and sticks the contents into tempvar1. You can address any location from 0-62? (63 was reserved for something.. i think)
put 10, tempvar1
That takes whatever is in tempvar1, and sticks it in the scratch pad location (#10 in this case).
Our implementation (kinda):
tempvar1 VAR byte
tempvar2 VAR byte
tempvar3 VAR byte
tempvar4 VAR byte
some_var VAR tempvar1
another_weird_var VAR tempvar4
...
get 13, some_var
..
get 14, another_weird_var
..
put 13, some_var
put 14, another_weird_var
Are ya getting the point yet? I hope so.. lol
Other advantage of this is the scratch-pad varibles are constant from program slot to program slot.. so you can use the same varibles in each program slot.. very good stuff!