Slide 14.11: Calling C/C++ functions(Cont.)
Slide 15.2: MUL instruction
Home

Multiplication and Division Instructions


The Intel instruction set lets you multiply and divide 8-, 16-, and 32- bit integers, using the instructions on the right.
Command Description
MUL Unsigned multiply
IMUL Signed multiply
DIV Unsigned divide
IDIV Signed divide

MUL Instruction
The MUL (unsigned multiply) instruction comes in three versions:
  1. multiplies an 8-bit operand by AL,
  2. multiplies a 16-bit operand by AX, and
  3. multiplies a 32-bit operand by EAX.
Multiplicand Multiplier Product
AL r/m8 AX
AX r/m16 DX:AX
EAX r/m32 EDX:EAX
The multiplier and multiplicand are the same size, and the product is twice their size. Because the destination operand is twice the size of the multiplicand and multiplier, overflow can not occur.

MUL — Unsigned Multiply
Usage: mul src

Flag O D I S Z A P C
Result *     ? ? ? ? *

Unsigned multiply of the accumulator by the source. If “src” is a byte value, then AL is used as the other multiplicand and the result is placed in AX. If “src” is a word value, then AX is multiplied by “src” and DX:AX receives the result. If “src” is a double word value, then EAX is multiplied by “src” and EDX:EAX receives the result.
Clocks
Operands 286 386 486 Size Bytes
reg8 13 9-14 13-18 2
reg16 21 9-22 13-26 2
reg32   9-38 13-42 2-4
mem8 16 12-17 13-18 2-4
mem16 24 13-26 12-25 2-4
mem32   12-21 13-42 2-4