EOR

From NES Hacker Wiki
Jump to: navigation, search
Exclusive OR Memory With Accumulator
Opcode: EOR
Operation: A ^ M → 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

EOR (Exclusive OR Memory With Accumulator) performs a logical XOR on the operand and the accumulator and stores the result in the accumulator. This opcode is similar in function to AND and ORA.

Operation

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

Operand ^= ACCUMULATOR        // XOR the two values together.
SET_NEGATIVE(Operand);        // Clears the Negative Flag if the Operand is $#00-7F, otherwise sets it.
SET_ZERO(Operand);            // Sets the Zero Flag if the Operand is $#00, otherwise clears it.
ACCUMULATOR = Operand;        // Stores the Operand in the Accumulator Register.

Addressing Modes

Addressing Mode Assembly Language Form Opcode # Bytes # Cycles
Immediate EOR #Operand 49 2 2
Zero Page EOR Operand 45 2 3
Zero Page, X EOR Operand, X 55 2 4
Absolute EOR Operand 4D 3 4
Absolute, X EOR Operand, X 5D 3 4*
Absolute, Y EOR Operand, Y 59 3 4*
(Indirect, X) EOR (Operand, X) 41 2 6
(Indirect), Y EOR (Operand), Y 51 2 5*
* Add 1 if page boundary is crossed.


Examples