ORA

From NES Hacker Wiki
Revision as of 17:38, 4 June 2013 by TheAlmightyGuru (talk | contribs) (Created page with "{{Infobox Opcode | Title = Or Memory With Accumulator | Opcode = ORA | Operation = A | M → A | StatusN = Change | StatusZ = Change | StatusC = Ignore | Sta...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Or Memory With Accumulator
Opcode: ORA
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

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

Operation

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

Operand |= ACCUMULATOR        // OR 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 ORA #Operand 09 2 2
Zero Page ORA Operand 05 2 3
Zero Page, X ORA Operand, X 15 2 4
Absolute ORA Operand 0D 3 4
Absolute, X ORA Operand, X 1D 3 4*
Absolute, Y ORA Operand, Y 19 3 4*
(Indirect, X) ORA (Operand, X) 01 2 6
(Indirect), Y ORA (Operand), Y 11 2 5*
* Add 1 if page boundary is crossed.

Examples