EOR
From NES Hacker Wiki
Exclusive OR Memory With Accumulator | ||||||
|
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. |