ROR ROR Rotate one bit right (memory or accumulator) ROR
+------------------------------+
| |
| +-+ +-+-+-+-+-+-+-+-+ |
Operation: +-> |C| -> |7|6|5|4|3|2|1|0| >-+ N V - B D I Z C
+-+ +-+-+-+-+-+-+-+-+ / . . . . . / /
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| Accumulator | ROR A | $6A | 1 | 2 |
| ZeroPage | ROR $FF | $66 | 2 | 5 |
| ZeroPage,X | ROR $FF,X | $76 | 2 | 6 |
| Absolute | ROR $FFFF | $6E | 3 | 6 |
| Absolute,X | ROR $FFFF,X | $7E | 3 | 7 |
+----------------+-----------------------+---------+---------+----------+
For penalty cycles on the 65816, check the desired addressing mode.
Note: ROR instruction is available on MCS650X microprocessors after
June, 1976.
Major uses: To divide a byte by 2. ROR can be used with LSR to divide multiple-byte numbers since ROR puts any carry into bit 7. If an LSR resulted in a carry, it would be thus taken into account in the next lower byte in a multiple-byte number.
Notice how the act of moving columns of binary numbers to the right has the effect of dividing by 2:
1000 (the number 8 in binary) 0100 (the number 4)This same effect can be observed with decimal numbers, except the columns represent powers of 10:
1000 (the number 1000 in decimal) 0100 (the number 100)