TXA

From NES Hacker Wiki
Jump to: navigation, search
Transfer X Index to Accumulator
Opcode: TXA
Operation: X → A
Status Register: Status-List.png
Status-Change.pngStatus-Space.pngStatus-Change.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.pngStatus-Space.pngStatus-Ignore.png

TXA (Transfer X Index to Accumulator) transfers the value in the X index to the accumulator. The reverse of this opcode is TAX.

Operation

This pseudo C code shows how the TXA 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.
A = (src);                    // Stores the value of the X index into the accumulator.

Addressing Modes

Addressing Mode Assembly Language Form Opcode # Bytes # Cycles
Implied TXA 8A 1 2

Examples