[Assembly 8086] IMUL

Recommended Posts

hey :) i have a little problem with assembly 8086.
i need to make a signed multiplication between 150 and 200 without using a program. now expected it to be 30,000 yet i get 5936,which is completely different.
MOV AX, 150MOV BX, 200IMUL BL

i don't get it. how do i calculate the result of IMUL? can anyone instruct me?

Share on other sites
Antheus    2409
Random reference.

IMUL BL implies r/m8, or it multiplies 8-bit value in AL with 8-bit value in BL.

Registers use two's completent representation.
Now, AL is signed, so 150 (10010110b) = - 106
BL is signed as well, so 200 (11001000b) = -56

Multiplying these two means -106 * -56 = 5936, stored in AX.

The solution is obviously:
IMUL BX

This will put result into DX:AX. Since result will be small enough to fit into 16 bits, it will be entirely in AX.

Share on other sites
oh i see now! thanks a lot :D