TXS transfers the value in the 6502 X register to the stack pointer. During NES startup, load X with $FF, then execute TXS to establish the stack's starting offset. section 5.12
Set the NES stack pointer
After clearing decimal mode, initialize the stack with: cld ldx #$FF txs The stack starts at the location specified by the transferred value. Each pushed item decreases the stack pointer offset by 1. section 5.12
