ror
Rotate right
Rotates the bits of the destination operand to the right.
XNZVC –●●0●
- ● set from the result
- 0 always 0
- – not changed
Forms
Operands
Two forms: (1) ro<d> Dx/Im, Dn rotates Dn by the count in Dx or immediate (1–8), any size. Defaults to word. (2) ro<d>.w (An) rotates a memory word by 1; .w is the only size accepted and may be omitted.
* --- ROL: rotate left (bits wrap around) ---
move.w #$1234, d0
rol.w #8, d0 ; d0 = $3412
* --- ROR: rotate right ---
move.w #$1234, d1
ror.w #8, d1 ; d1 = $3412
* --- Single bit rotate ---
move.w #%10000000_00000001, d2
rol.w #1, d2 ; d2 = %00000000_00000011
* --- Memory form: rotates word at (a0) left by 1 ---
lea $1000, a0
move.w #%10000000_00000001, (a0)
rol (a0) ; (a0) = %00000000_00000011