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
 INCLUDE Irvine32.inc
 .data
  x  BYTE  02h
  y  BYTE  20h
 .code
 main PROC
  movsx  eax, x
  mul    y
  call   DumpRegs
  exit
 main ENDP
 END main
 INCLUDE Irvine32.inc
 .data
  dummy  WORD  ?	
 .code
 main PROC
  mov    eax, 20h
  mov    bl, 20h
  mul    bl
  call   DumpRegs
  exit
 main ENDP
 END main
 INCLUDE Irvine32.inc
 .data
  dummy  WORD  ?
 .code
 main PROC 
   mov   eax, 30h
   mov   bx, 150h
   mul   bx
   call  DumpRegs
   exit
 main ENDP
 END main
Output Output Output

AX=

CF=   OF=  

 


AX=

CF=   OF=  

 


DX:AX=

CF=   OF=    

 


16-Bit Multiplication 32-Bit Multiplication 132-Bit Multiplication
 INCLUDE Irvine32.inc
 .data
  x  WORD  0300h
 .code
 main PROC  
  movzx  eax, x
  mov    bx, 150h
  mul    bx
  call   DumpRegs
  exit
 main ENDP
 END main
 INCLUDE Irvine32.inc
 .data
  x  DWORD  00000200h
  y  DWORD  00008000h
 .code
 main PROC
  mov   eax, x
  mul   y
  call  DumpRegs
  exit
 main ENDP
 END main
 INCLUDE Irvine32.inc
 .data
  x  DWORD  00020000h
  y  DWORD  00090000h
 .code
 main PROC 
  mov   eax, x
  mov   ebx, y
  mul   ebx
  call  DumpRegs
  exit
 main ENDP
 END main
Output Output Output

DX:AX=

CF=   OF=  

 


EDX:EAX=

CF=   OF=    

 


EDX:EAX=

CF=   OF=  

 



      “I’m not arguing, I’m just explaining why I’m right.”    
      ― Unknown