lsd

Sizes

byte, word, long

Default Size

word

Affected Flags

X
N
Z
V
C
✱
✱
✱
0
✱

Operands

Op 1
Dn/Im
Op 2
Dn

Shifts the bits of the destination operand to the {direction}. Two forms: (1) ls<d> Dx/Im, Dn shifts Dn by the count in Dx or immediate (1–8), any size. New bits are filled with 0s. Defaults to word. (2) ls<d>.w (An) shifts a memory word by 1; .w is the only size accepted and may be omitted.

* --- LSR: logical shift right (fills with 0) ---
move.w #$FF00, d0
lsr.w #4, d0 ; d0 = $0FF0

* --- LSL: logical shift left (fills with 0) ---
move.w #$000F, d1
lsl.w #4, d1 ; d1 = $00F0

* --- Compare ASR vs LSR on negative value ---
move.w #$FF00, d2
asr.w #4, d2 ; d2 = $FFF0 (sign extended)
move.w #$FF00, d3
lsr.w #4, d3 ; d3 = $0FF0 (zero filled)

* --- Memory form: shifts word at (a0) right by 1 ---
lea $1000, a0
move.w #$0010, (a0)
lsr (a0) ; (a0) = $0008