https://github.com/geon/zpallocator/blo ... xample.asmThe idea is to be able to use the zero page for all variables. You allocate a zp address when you need it, and when you are done with it (ie. at the end of the macro/function scope), you deallocate it.
Code:
// BackgroundColor will contain a free zp address.
.var backgroundColor = allocateZpByte()
// Do stuff with backgroundColor
lda #BROWN
sta backgroundColor
// ...
deallocateZpByte(backgroundColor)
This way, I can write macros and pass arguments by reference without worrying about collisions.
I could use some help to define a couple of ranges of reserved zp addresses. I don't care about basic, so I can use $02-$70 or so without problem, but I might want to use some kernal routines like screen io and the jiffy clock. I'm not sure what other areas of the zp are important.