From NES Hacker Wiki
Revision as of 13:07, 11 April 2014 by TheAlmightyGuru (talk | contribs) (Created page with "{{Infobox Opcode | Title = Transfer X Index to Stack Pointer | Opcode = TXS | Operation = X → S | StatusN = Change | StatusZ = Change | StatusC = Ignore | Statu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Transfer X Index to Stack Pointer
Opcode: TXS
Operation: X → S
Status Register: Status-List.png

TXS (Transfer X Index to Stack Pointer) transfers the value in the X index to the stack pointer.


This pseudo C code shows how the TXS opcode functions when it is executed.

unsigned src = X;             // Load the value of the X index as an unsigned byte.
SET_NEGATIVE(src);            // Sets the Negative Flag equal to the 7th bit.
SET_ZERO(src);                // Sets the Zero Flag if the Operand is $#00, otherwise clears it.
S = (src);                    // Stores the value of the X index into the stack pointer.

Addressing Modes

Addressing Mode Assembly Language Form Opcode # Bytes # Cycles
Implied TXS 9A 1 2