EOR

From C64-Wiki
Jump to: navigation, search

EOR (short for "Exclusive OR") is the mnemonic for a machine language instruction which performs a bit-wise boolean "Exclusive-or" between each of the eight bits in the accumulator and their corresponding bits in the memory address specified. The eight resulting bits form a byte, which is stored in the accumulator.

Addressing modes[edit]

Opcode Addressing
mode
Assembler
format
Length
in bytes
Number of
cycles
Dec Hex
73 49 Immediate EOR #nn 2 2
77 4D Absolute EOR nnnn 3 4
93 5D Absolute,X EOR nnnn,X 3 4*
89 59 Absolute,Y EOR nnnn,Y 3 4*
69 45 Zeropage EOR nn 2 3
85 55 Zeropage,X EOR nn,X 2 4
65 41 Indexed-indirect EOR (nn,X) 2 6
81 51 Indirect-indexed EOR (nn),Y 2 5*

EOR supports eight different addressing modes, as shown in the table at right. In the assembler formats listed, nn represents a single-byte (8-bit) figure, and nnnn is a two-byte (16-bit) address.
With some addressing forms (marked with an asterisk, *, in the "Number of cycles" column) the execution time for EOR depends on the circumstances: In cases where the indexing requires the CPU to "reach across" a page boundary from the base address, the execution time is 1 cycle longer than listed here.

CPU flags[edit]

EOR affects 2 of the CPU's status flags:

  • The negative status flag is set if the result is negative, i.e. has it's most significant bit set.
  • The zero flag is set if the result is zero, or cleared if it is non-zero.