MUL
Usage: MUL src Modifies flags: CF OF (AF,PF,SF,ZF undefined)
Unsigned multiply of the accumulator by the source.
Unsigned Integer Multiply
MUL r/m8 ; F6 /4 [8086]
MUL r/m16 ; o16 F7 /4 [8086]
MUL r/m32 ; o32 F7 /4 [386]
MUL performs unsigned integer multiplication. The other operand to the multiplication, and the destination operand, are implicit, in the following way:
For MUL r/m8, AL a byte value is multiplied by the given operand; the product is stored in AX.
For MUL r/m16, AX a word value is multiplied by the given operand; the product is stored in DX:AX.
For MUL r/m32, EAX a double word value is multiplied by the given operand; the product is stored in EDX:EAX.
The 386+ uses an early out algorithm which makes multiplying any size value in EAX as fast as in the 8 or16 bit registers.
Signed integer multiplication is performed by the IMUL.
EXAMPLE:
;Create buffer
mov eax d$bmWidthBytes | mul D$bHeight ; eax = biWidthBytes * bHeight
call 'KERNEL32.VirtualAlloc' &NULL eax &MEM_RESERVE+&MEM_COMMIT &PAGE_READWRITE