What is the basic difference between MUL and IMUL instruction in 8086 microprocessor?

Reference link: http://www.answers.com/Q/What_is_the_basic_difference_between_MUL_and_IMUL_instruction_in_8086_microprocessor

MUL is used for unsigned multiplication, while IMUL is used for signed multiplication.

In the 8086 instruction set, both instructions multiply the accumulator by the given operand, but they interpret the operand values differently:

  • MUL treats the values as unsigned integers.
  • IMUL treats the values as signed integers, using two’s complement representation.

The basic result placement is the same:

  • When the operand is a byte:

“`asm
AX = AL * operand
“`

  • When the operand is a word:

“`asm
DX:AX = AX * operand
“`

For example, if the operand is a byte, the 8-bit value in AL is multiplied by the 8-bit operand, and the 16-bit result is stored in AX. If the operand is a word, the 16-bit value in AX is multiplied by the 16-bit operand, and the 32-bit result is stored across DX:AX, with the high word in DX and the low word in AX.

So the main difference is not where the result is stored, but how the CPU interprets the numbers before multiplication: unsigned for MUL, signed for IMUL.

Leave a Reply