IMUL performs signed integer multiplication. For the
single-operand form, the other operand and destination are
implicit, in the following way:
-
For
IMUL r/m8,ALis multiplied by the given operand; the product is stored inAX. -
For
IMUL r/m16,AXis multiplied by the given operand; the product is stored inDX:AX. -
For
IMUL r/m32,EAXis multiplied by the given operand; the product is stored inEDX:EAX.
The two-operand form multiplies its two operands and stores the result in the destination (first) operand. The three-operand form multiplies its last two operands and stores the result in the first operand.
The two-operand form with an immediate second operand is in
fact a shorthand for the three-operand form, as can be seen by
examining the opcode descriptions: in the two-operand form, the
code /r takes both its register and r/m parts from the
same operand (the first one).
In the forms with an 8-bit immediate operand and another longer
source operand, the immediate operand is considered to be signed,
and is sign-extended to the length of the other source operand.
In these cases, the BYTE qualifier is necessary to force
NASM to generate this form of the instruction.
Unsigned integer multiplication is performed by the MUL
instruction: see MUL.