Slide 15.1: Multiplication and division instructions
Slide 15.3: IMUL instruction
Home

MUL Instruction

For example, when AX is multiplied by a 16-bit operand, the product is stored in DX:AX. The Carry flag is set if DX is not equal to zero.
Multiplicand Multiplier Product
AL r/m8 AX
AX r/m16 DX:AX
EAX r/m32 EDX:EAX

 8-Bit Multiplication   8-Bit Multiplication   16-Bit Multiplication 
 .data
 x  BYTE  02h
 y  BYTE  20h
 .code
 movsx  eax, x
 mul    y
 call   DumpRegs
 .code
 mov    eax, 20h
 mov    bl, 20h
 mul    bl
 call   DumpRegs
 .code
 mov   eax, 30h
 mov   bx, 150h
 mul   bx
 call  DumpRegs
 Output   Output   Output 
  AX=
  CF=   OF=

 

  AX=
  CF=   OF=

 

  DX:AX=
  CF=   OF=

 

 16-Bit Multiplication   32-Bit Multiplication   32-Bit Multiplication 
 .data
 x  WORD  0300h
 .code
 movzx  eax, x
 mov    bx, 150h
 mul    bx
 call   DumpRegs
 .data
 x  DWORD  00000200h
 y  DWORD  00008000h
 .code
 mov   eax, x
 mul   y
 call  DumpRegs
 .data
 x  DWORD  00020000h
 y  DWORD  00090000h
 .code
 mov   eax, x
 mov   ebx, y
 mul   ebx
 call  DumpRegs
 Output   Output   Output 
  DX:AX=
  CF=   OF=

 

  EDX:EAX=
  CF=   OF=

 

  EDX:EAX=
  CF=   OF=