I wrote a zero page allocator for Kick Assembler.
Posted: Mon Sep 20, 2021 10:01 pm
https://github.com/geon/zpallocator/blo ... xample.asm
The 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.
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.
The 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: Select all
// BackgroundColor will contain a free zp address.
.var backgroundColor = allocateZpByte()
// Do stuff with backgroundColor
lda #BROWN
sta backgroundColor
// ...
deallocateZpByte(backgroundColor)
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.