Stack Pointer
The Stack Pointer (SP) points to the next stack location available for pushing to. In stack addressing modes it is used for the effective address. Also called the stack register, the low byte is called SL and the high byte is called SH.
On the SPC700 it is 16-bit, but the upper byte is fixed by the hardware to be 0x01. The low byte is $EF upon entry into the first user code.[5]
On the 65c816 it is also 16-bit, and the only two instructions that modify the stack pointer (S) directly are TCS and TXS.[4] Its value can be examined with TSX or TSC. It is only fixed to be in page one in emulation mode on the '816.
1FFh is a common value to initialize the stack pointer to.
Pushing things onto the stack decrements the stack pointer and pulling things increments it.
See Also
References
- subparagraph 8.1.5 of page 3-8-4 of Book I of the official Super Nintendo development manual
- diversified activities: page 3-8-5 of Book I, lbid.
- Eyes & Lichty, page 31 on The Stack Pointer
- Eyes & Lichty, page 511 on TCS
- anomie: https://github.com/gilligan/snesdev/blob/master/docs/spc700.txt#L73