وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

وو

وحید آنلاین . آرشیو وبلاگ وحیدمی دات آی آر . شرکت بیان. vahidmy.blog.ir

IMUL

IMUL

Usage:  IMUL    src                                  Modifies flags: CF OF (AF,PF,SF,ZF undefined)

           IMUL    src,immed           (286+)

           IMUL    dest,src,immed8   (286+)

           IMUL    dest,src              (386+)      

Signed multiplication of accumulator by 'src' with result placed in the accumulator.  If the 'src' operand is a byte value, its multiplied by AL and the result stored in AX.  If the 'src' operand is a word value it is multiplied by AX and the result is stored in DX:AX.  If the 'src' operand is a doubleword value it is multiplied by EAX and the result is stored in EDX:EAX.  Other variations of this instruction allow specification of 'src' and 'dest'  registers as well as a third immediate factor.

Signed Integer Multiply


IMUL r/m8                     ; F6 /5                [8086]

IMUL r/m16                    ; o16 F7 /5            [8086]

IMUL r/m32                    ; o32 F7 /5            [386]


IMUL reg16,r/m16              ; o16 0F AF /r         [386]

IMUL reg32,r/m32              ; o32 0F AF /r         [386]


IMUL reg16,imm8               ; o16 6B /r ib         [186]

IMUL reg16,imm16              ; o16 69 /r iw         [186]

IMUL reg32,imm8               ; o32 6B /r ib         [386]

IMUL reg32,imm32              ; o32 69 /r id         [386]


IMUL reg16,r/m16,imm8         ; o16 6B /r ib         [186]

IMUL reg16,r/m16,imm16        ; o16 69 /r iw         [186]

IMUL reg32,r/m32,imm8         ; o32 6B /r ib         [386]

IMUL reg32,r/m32,imm32        ; o32 69 /r id         [386]


IMUL performs signed integer multiplication. For the single-operand form, the other operand and destination are implicit, in the following way:


For IMUL r/m8, AL is multiplied by the given operand; the product is stored in AX.


For IMUL r/m16, AX is multiplied by the given operand; the product is stored in DX:AX.


For IMUL r/m32, EAX is multiplied by the given operand; the product is stored in EDX:EAX.


The two-operand form multiplies its two operands and stores the result in the destination (first) operand. The three-operand form multiplies its last two operands and stores the result in the first operand.


The two-operand form with an immediate second operand is in fact a shorthand for the three-operand form, as can be seen by examining the opcode descriptions: in the two-operand form, the code /r takes both its register and r/m parts from the same operand (the first one).


In the forms with an 8-bit immediate operand and another longer source operand, the immediate operand is considered to be signed, and is sign-extended to the length of the other source operand. In these cases, the BYTE qualifier is necessary to force NASM to generate this form of the instruction.


Unsigned integer multiplication is performed by the MUL  instruction.


Example:

imul eax ecx