News for hackers. Stuff that matters.
Re:Rust on the MOS 6502: Beyond Fibonacci by tom_ on Tuesday September 21, 2021 @10:22AM (#28605253)
I think you could use zero page as the data stack. Treat X is your frame pointer, and the zero page "address" is then the offset into the frame. Most instructions have a zp,X addressing mode. (This scheme works well with (zp,X) too.) LDY zp,X and STY zp,X are available, and the useful read instructions have abs,Y forms. So you can do lookups into global tables with an 8-bit local variable index without having to save X.

You'd need a little region for making use of (zp),Y, probably callee-saved, putting previous values on the return stack with PHA.

There are no comments on this comment yet.