divu

Sizes

word

Default Size

word

Affected Flags

X
N
Z
V
C
-
✱
✱
✱
0

Operands

Op 1
Dn/(An)/d(An)/d(An,Xn)/Ea/<label>/d(PC)/d(PC,Xn)/Im
Op 2
Dn

Divides (unsigned) the value of the second operand by the value of the first operand (op2 / op1). The quotient is stored in the first 16 bits of the destination register and the remainder is stored in the last 16 bits of the destination register. The first operand is read as a word, the second as a long

* --- Result: quotient in low word, remainder in high word ---
move.l #21, d0
divu #4, d0
move.w d0, d1 ; d1 = quotient (5)
swap d0
move.w d0, d2 ; d2 = remainder (1)

* --- Large unsigned value ---
move.l #$FFFE, d3
divu #$FFFF, d3
move.w d3, d4 ; d4 = quotient (0)
swap d3
move.w d3, d5 ; d5 = remainder ($FFFE)