ROR Instruction



The instruction ROR rotates a data register or a memory operand to the right. There are three ways to do this:

1. Rotate a data register to the right. Number of steps is a constant.
2. Rotate a data register to the right. Number of steps is stored in another data register. You can rotate 1-8 bits this way.
3. Rotate a word in the memory one bit to the right.

The rotation is done without an extra bit (i.e. a 8, 16 or 32 bit rotation). The bit that is rotated from the lowest position to the highest will also be send to the carry flag.

-- -- > OPERAND -- -- > C

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 00001111, it would now be 10000111