Ideally, you could tell the assembler not to use certain parts of the ZP, maybe with something like
Code: Select all
.reserve $00Code: Select all
.reserve $00 to $10Code: Select all
.savezero counter 2(Actually, because I'm lazy and error prone, I'd prefer to mark zero page variables themselves somehow, maybe with a &. Then I could just say
Code: Select all
.save &counter 2
sta &counter
inc &counterI'm having trouble believing this would be too hard to implement, given that the zero page can be seen as a collection of registers and there is a ton of research on register allocation for compilers. It's a little trickier of course because in some cases we'll need to allocate blocks of zero page (like the data stock for Tali Forth). Though on the other hand, it's going to be rare that something needs to be "evicted".
Sorry if I've missed it as some obvious feature, but does any assembler for the 6502 have this functionality?