# ROXR Instruction

The instruction ROXR (ROtate Left with eXtend) 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 with an extra bit (i.e. a 9, 17 or 33 bit rotation). The least significant bit is rotated to the carry flag and to the extra flag. The bit at the extra flag will be rotated to the most significant bit in the operand.

-- -- > | OPERAND | -- -- > | C
| < -- -- | X | < -- --

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 - The last bit that was rotated from the operand. Unaffected if rotation step was zero.
N - S
Z - S
C - Same as X
V - 0

SYNTAX: | ROXL #<steps>,Dy
ROXL Dx,Dy
ROXL <ea>

EXAMPLE CODE:

ROXR.B #1,D0 if D0.B contained 00001111, X = 1 it would now be 10000111 If X = 0 then 00000111