3 ms·
> 6502 does not allow any stack-pointer-relative operations Almost not true. All you have to do is add the TSX instruction, which moves stack pointer into X re
by chromoblob 3y ago
> 6502 does not allow any stack-pointer-relative operations
Almost not true. All you have to do is add the TSX instruction, which moves stack pointer into X register, then use absolute indexed addressing mode in which address of the memory operand is computed by adding together the absolute address specified in the instruction and the X register value. For example the instructions `TSX; LDA $0105, X` will load into A the byte in the stack which is 5 bytes up from the stack pointer. Cost for this is being unable to use the X register for something else. Addition also doesn't wrap around the stack page.