|Transfer Y Index to Accumulator
TYA (Transfer Y Index to Accumulator) transfers the value in the Y index to the accumulator. The reverse of this opcode is TAY.
This pseudo C code shows how the TYA opcode functions when it is executed.
unsigned src = Y; // Load the value of the Y 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 Y index into the accumulator.