MUL Instruction
MUL instruction sets the Carry and Overflow flags if the upper half of the product is not equal to zero.
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.
|
|
| 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 |
| 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 |
|
“I’m not arguing, I’m just explaining why I’m right.” ― Unknown |