TSX              TSX Transfer stack pointer to index X                TSX

  Operation:  S -> X                                    N V - B D I Z C
                                                        / . . . . . / .

  +----------------+-----------------------+---------+---------+----------+
  | Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
  +----------------+-----------------------+---------+---------+----------+
  |  Implied       |   TSX                 |   $BA   |    1    |    2     |
  +----------------+-----------------------+---------+---------+----------+

What it does: Transfers the Stack Pointer to the X Register.

Major uses: The Stack Pointer is a byte in the 6502 chip which points to where a new value (number) can be added to the stack. The Stack Pointer would be "raised" by two, for example, when you JSR and the two bytes of the Program Counter are pushed onto the stack. The next available space on the stack thus becomes two higher than it was previously. By contrast, an RTS will pull a two-byte return address off the stack, freeing up some space, and the Stack Pointer would then be "lowered" by two.

The Stack Pointer is always added to $0100 since the stack is located between addresses $0100 and $01FF.