As discussed in the Forth form, Tali Forth needs to switch to a different assembler because we've moved beyond what Ophis (which has served us very well) was built to do. Now what would really be cool is an assembler that is at least aware of the zero page, or, even better, helps populate it. Another problem is that Tali is being installed together with other software which already uses the ZP, so it's getting complicated to figure out what can be used.
Ideally, you could tell the assembler not to use certain parts of the ZP, maybe with something like
Code:
.reserve $00
or
Code:
.reserve $00 to $10
In your own code, you request zero page bytes when you need them -
Code:
.savezero counter 2
for example. The assembler manages the zero page space by allocating storage, here maybe by automatically putting counter at $0A and $0B. It produces a warning if too much is requested. The programmer doesn't have to remember if the counter was in $0A or $OC, it's all just variables in the code.
(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:
.save &counter 2
sta &counter
inc &counter
and whatnot.)
I'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?