The instruction ROL rotates a data register or a memory operand to the left. There are three ways to do this:
1. Rotate a data register to the left. Number of steps is a constant.
2. Rotate a data register to the left. Number of steps is stored in another data register. You can rotate 1-8 bits this way.
3. Rotate e a word in the memory one bit to the left.
The rotation is done without an extra bit (i.e. a 8, 16 or 32 bit rotation). The bit that is rotated from the highest position to the lowest will also be sent to the carry flag.
C | < -- -- | OPERAND | < -- -- |
ADDRESS METHODS: (An), (An)+, -(An), x(An), x(An,xr.s), x.w, x.l (only when rotating a word in the memory)
DATA LENGTH: Byte, word, longword
When rotating in the memory, you can only use word.
FLAGS: | X - U |
N - S | |
Z - S | |
C - Equal to the bit that was last moved from the operand. If number of steps is zero, the flag is cleared. | |
V - 0
|
SYNTAX: | ROL #<steps>,Dy |
ROL Dx,Dy | |
ROL <ea> |
EXAMPLE CODE:
ROL.B #1,D0 if D0.B contained 11110000, it would now be 11100001