This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

ORA - OR Accumulator with memory

OR Accumulator with Memory

Table of Contents

ORA performs a bitwise logical OR of the value in the accumulator with that of the memory location with the result stored in the accumulator.

The result will be each bit in the accumulator will be set if either the same bit in the original accumulator value and the memory are set.

OR truth table
Second Operand
First Operand01
001
111

For 8-bit processors n has the value of bit 7 and v the value of bit 6 of the memory location.

For 16-bit processors, when m=0, n has the value of bit 15 and v the value of bit 14 of the memory location.

Second it performs a logical AND of the memory and the accumulator. If the result is zero the z flag is set.

In both operations, the contents of the accumulator and memory are not modified.

Flags Affected
Flags
n-----z-
nSet if most significant bit of result is set
zSet if result is zero, otherwise clear
Instructions
SyntaxOpcode Available on: # of # of Addressing Mode
(hex) 6502 65C02 65816 bytes cycles
ORA #const09 x x x 21 22 Immediate
ORA addr0D x x x 3 42 Absolute
ORA long0F x 4 52 Absolute Long
ORA dp05 x x x 2 32, 3 Direct Page
ORA (dp)12 x x 2 52, 3 Direct Page Indirect
ORA [dp]07 x 2 62, 3 Direct Page Indirect Long
ORA addr,X1D x x x 3 42, 4 Absolute Indexed X
ORA long,X1F x 4 52 Absolute Long Indexed X
ORA addr,Y19 x x x 3 42, 4 Absolute Indexed Y
ORA dp,X15 x x x 2 42, 3 Direct Page Indexed X
ORA (dp,X)01 x x x 2 62, 3 Direct Page Indexed Indirect X
ORA (dp),Y11 x x x 2 52, 3, 4 Direct Page Indirect Indexed Y
ORA [dp],Y17 x 2 62, 3 Direct Page Indirect Long Indexed Y
ORA sr,S03 x 2 42 Stack Relative
ORA (sr,S),Y13 x 2 72 Stack Relative Indirect Indexed Y

Notes:

  1. 65816: Add 1 byte if m=0 (16-bit memory/accumulator)
  2. 65816: Add 1 cycle if m=0 (16-bit memory/accumulator)
  3. 65816: Add 1 cycle if low byte of Direct Page register is not 0
  4. Add 1 cycle if adding index crosses a page boundary