Stack Pointer, 16-bit offset instructions behave the same way than Indexed, 16-bit offset instructions, except that the offset is added to the Stack Pointer (SP) in place of the HX Index register.
This addressing mode allow easy access of the data on the stack. If the interrupts are disabled, the Stack pointer can also be used as a second Index register. See the following listing for an example of using the Stack Pointer (16-bit offset) addressing mode.
entry: LDHX #$0100 ; init Stack Pointer to 00FF TXS LDA $0500, SP ; Content of memory location $5FF is loaded in A
In this example, stack pointer, 16-bit offset mode is used to store the value in memory location $5FF in accumulator A.