rol

Sizes

byte, word, long

Default Size

word

Affected Flags

X
N
Z
V
C
-
✱
✱
0
✱

Operands

Op 1
Dn/Im
Op 2
Dn

Rotates the bits of the destination operand to the "Left". 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