Jump to content
  • Advertisement
Sign in to follow this  
Doctor Shinobi

[Assembly 8086] IMUL

This topic is 2809 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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, 150
MOV BX, 200
IMUL BL


i don't get it. how do i calculate the result of IMUL? can anyone instruct me?
thanks in advance :)

Share this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!