mulu

Unsigned multiply

The default word form multiplies two unsigned 16-bit values and stores the 32-bit product in a data register.

XNZVC –●●●0
  • ● depends on the result
  • 0 always 0
  • – not changed

Forms

68020 only

These forms require the 68020. Select opt p=68020 before any code or data.

Operands

<ea>
An operand using one of the addressing modes listed for this form. The list determines whether it can be a register, memory or an immediate value. With opt p=68020, an allowed d(An,Xn) or d(PC,Xn) mode also permits the corresponding 68020 indexed and memory indirect forms. See 68020 addressing. More
Dn
A data register, d0 to d7. More
Dh:Dl
Two data registers for a 64-bit product, for example d2:d1. Dl supplies the 32-bit multiplicand. The result’s high long replaces Dh, and its low long replaces Dl. Use different registers for the two halves. More
#imm
An immediate value written after #: a number, character or label, such as #10, #$FF or #'a'. It must fit the operation’s size: byte -128 to 255, word -32768 to 65535, or long -2147483648 to 4294967295; signed and unsigned spellings are accepted. More

The source and the destination’s low word supply the inputs; the destination’s old upper word is ignored. Word multiplication clears V.

On the 68020, mulu.l multiplies two 32-bit values. In both mulu.l d0, d1 and mulu.l d0, d2:d1, the inputs are d0 and d1. The old value of d2 is not used. The single-register form keeps the low 32 bits in d1 and sets V if the product does not fit in an unsigned 32-bit result. The pair form keeps all 64 bits, with the high long in d2 and the low long in d1, and clears V. Use different registers for the high and low halves.

N and Z describe the result kept: 32 bits for word multiplication or a single-register long result, and 64 bits for a register-pair result. C is cleared and X is unchanged.

move.l #2, d0
mulu #4, d0 ; d0 = 8

* --- Word operands, long result ---
move.l #$FFFF, d1
mulu #$FFFF, d1 ; d1 = $FFFE0001