koitsu wrote:
This is one area where the 65816 often spoiled me (direct page (effectively relocatable ZP -- but then if it's in page 1 it's not ZERO is it!) is really great).
I learned 6502 assembly language on an Apple IIe (6502), enhanced Apple IIe (65C02), and Apple IIGS (65816), owned by a middle school and a public library. The
Apple IIGS Hardware Reference had the full WDC 65C816 data sheet, which stated which instructions came from the 6502, which from the 65C02, and which were new. It used 'd' for an 8-bit address within direct page or the stack frame, 'a' for a 16-bit address within a bank, and 'al' for a 24-bit address. For example, the instructions doing indirect indexed with Y were called "LDA (d),Y". To this day, when I describe 6502 instructions, I use 'd' for an 8-bit address and 'a' for a 16-bit address, despite that "zero page" doesn't start with 'd'.
Programs used zero page far less on the Apple II and similar systems, in part because the BIOS ("Monitor ROM"), operating system (Apple DOS 3.3 or ProDOS), and especially Applesoft BASIC hogged most of it. This especially made the (d,x) addressing mode near useless, compared to how useful it is on NES for e.g. accessing music data through pointers.
Quote:
You can, of course, use $0100-01FF as scratchpad if you need to. There are lots of games which use $0100-01A0 or so, as the running code ensures it never pushes more than 0x60 bytes worth of data on the stack. I don't recommend doing this unless you're extra-super-duper careful.
Or unless you can play-test your game under a debugger that can watch writes to $01A0-$01AF, or you can stick a canary value in $01AF and change e.g. the score display's color if that ever changes.