ROL ROL Rotate one bit left (memory or accumulator) ROL
+------------------------------+
| |
| +-+-+-+-+-+-+-+-+ +-+ |
Operation: +-< |7|6|5|4|3|2|1|0| <- |C| <-+ N V - B D I Z C
+-+-+-+-+-+-+-+-+ +-+ / . . . . . / /
+----------------+-----------------------+---------+---------+----------+
| Addressing Mode| Assembly Language Form| OP CODE |No. Bytes|No. Cycles|
+----------------+-----------------------+---------+---------+----------+
| Accumulator | ROL A | $2A | 1 | 2 |
| ZeroPage | ROL $FF | $26 | 2 | 5 |
| ZeroPage,X | ROL $FF,X | $36 | 2 | 6 |
| Absolute | ROL $FFFF | $2E | 3 | 6 |
| Absolute,X | ROL $FFFF,X | $3E | 3 | 7 |
+----------------+-----------------------+---------+---------+----------+
For penalty cycles on the 65816, check the desired addressing mode.
What it does: Rotates the bits in the Accumulator or in a byte in memory to the left, by one bit. A rotate left (as opposed to an ASL, Arithmetic Shift Left) moves bit 7 to the carry, moves the carry into bit 0, and every other bit moves one position to its left. (ASL operates quite similarly, except it always puts a 0 into bit 0.)
Major uses: To multiply a byte by 2. ROL can be used with ASL to multiply multiple-byte numbers since ROL pulls any carry into bit 0. If an ASL resulted in a carry, it would be thus taken into account in the next higher byte in a multiplebyte number. Notice how the act of moving columns of binary numbers to the left has the effect of multiplying by 2:
0010 (the number 2 in binary) 0100 (the number 4)This same effect can be observed with decimal numbers, except the columns represent powers of 10:
0010 (the number 10 in decimal) 0100 (the number 100)