ORA ORA "OR" memory with accumulator ORA
Operation: A V M -> A N V - B D I Z C
/ . . . . . / .
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| Immediate | ORA #$FF | $09 | 2 | 2 |
| ZeroPage | ORA $FF | $05 | 2 | 3 |
| ZeroPage,X | ORA $FF,X | $15 | 2 | 4 |
| Absolute | ORA $FFFF | $0D | 3 | 4 |
| Absolute,X | ORA $FFFF,X | $1D | 3 | 4* |
| Absolute,Y | ORA $FFFF,Y | $19 | 3 | 4* |
| (Indirect,X) | ORA ($FF,X) | $01 | 2 | 6 |
| (Indirect),Y | ORA ($FF),Y | $11 | 2 | 5* |
+----------------+-----------------------+---------+---------+----------+
* Add 1 on page crossing
For penalty cycles on the 65816, check the desired addressing mode.
65816 Extensions:
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| AbsoluteLong | ORA $FFFFFF | $0F | 4 | 5 |
| AbsoluteLong,X | ORA $FFFFFF,X | $1F | 4 | 5 |
| (Indirect) | ORA ($FF) | $12 | 2 | 5 |
| [Indirect Long]| ORA [$FF] | $07 | 2 | 6 |
| [Ind.Long],Y | ORA [$FF],Y | $17 | 2 | 6 |
| Relative,S | ORA $FF,S | $03 | 2 | 4 |
| (Indirect,S),Y | ORA ($FF,S),Y | $13 | 2 | 7 |
+----------------+-----------------------+---------+---------+----------+
What it does: Logically ORs a byte in memory with the byte in the Accumulator. The result is in the Accumulator. An OR results in a 1 if either the bit in memory or the bit in the Accumulator is 1.
Major uses: Like an AND mask which turns bits off, ORA masks can be used to turn bits on. For example, if you wanted to "shift" an ASCII character by setting the seventh bit, you could LDA CHARACTER:ORA #$80. The number $80 in binary is 10000000, so all the bits in CHARACTER which are ORed with zeros here will be left unchanged. (If a bit in CHARACTER is a 1, it stays a 1. If it is a zero, it stays 0.) But the 1 in the seventh bit of $80 will cause a 0 in the CHARACTER to turn into a 1. (If CHARACTER already has a 1 in its seventh bit, it will remain a 1.)