<<< DEC Decrement Operand | Index | INC Increment Operand >>> |
O D I T S Z A P C OF: Overflow flag TF: Trap flag AF: Aux carry F F F F F F F F F DF: Direction flag SF: Sign flag PF: Parity flag * * IF: Interrupt flag ZF: Zero flag CF: Carry flag
IMUL r8 IMUL m8 IMUL r16 IMUL m16 IMUL r32 386+ IMUL i32 386+ IMUL r16,i8 286+ IMUL r16,i16 286+ IMUL r32,i8 386+ IMUL r32,i16 386+ IMUL r16,r16 386+ IMUL r16,m16 386+ IMUL r32,r32 386+ IMUL r32,m32 386+ IMUL r16,r16,i8 286+ IMUL r16,m16,i8 286+ IMUL r16,r16,i16 286+ IMUL r16,m16,i16 286+ IMUL r32,r32,i8 386+ IMUL r32,m32,i8 386+ IMUL r32,r32,i32 386+ IMUL r32,m32,i32 386+
IMUL CH ; AL * CH --> AX IMUL BX ; AX * BX --> DX:AX IMUL ECX ; EAX * ECX --> EDX:EAX IMUL WORD [BX+DI] ; AX * DS:[BX+DI] --> DX:AX IMUL EAX,ECX ; EAX * ECX --> EAX IMUL ECX,EAX,15 ; EAX * 15 --> ECX
In its oldest, single-operand form (usable on all processors), IMUL multiplies its operand by AL, AX, or EAX, and the result is placed in AX, in DX:AX, or in EDX:EAX. If IMUL is given an 8-bit operand (either an 8-bit register or an 8-bit memory operand), the results will be placed in AX. This means that AH will be affected, even if the results will fit entirely in AL.
Similarly, if IMUL is given a 16-bit operand, the results will be placed in DX:AX, even if the entire result will fit in AX! It's easy to forget that IMUL affects DX on 16-bit multiples, and EDX in 32-bit multiples. Keep that in mind!
In both the two- and three-operand forms, the product replaces the contents of the first operand. In the two-operand form, the two operands are multiplied together, and the product replaces the first operand. In this it is like most other arithmetic and logical instructions. In the three-operand form, the second and third operand are multiplied, and the product replaces the first operand.
Note that with the two- and three-operand forms, there is the possibility that the product will not entirely fit in the destination register. When using those forms, the CF and OF flags will both be 0 (cleared) only if the product fits entirely in the destination. It's best to use the original forms in cases where you aren't sure of the range the product might take.
r8 = AL AH BL BH CL CH DL DH r16 = AX BX CX DX BP SP SI DI sr = CS DS SS ES FS GS r32 = EAX EBX ECX EDX EBP ESP ESI EDI m8 = 8-bit memory data m16 = 16-bit memory data m32 = 32-bit memory data i8 = 8-bit immediate data i16 = 16-bit immediate data i32 = 32-bit immediate data d8 = 8-bit signed displacement d16 = 16-bit signed displacement d32 = 32-bit unsigned displacement
<<< DEC Decrement Operand | Index | INC Increment Operand >>> |