开发者

More Assembly Language Multiplication

开发者 https://www.devze.com 2023-04-12 07:49 出处:网络
I am confused about how to handle assembly multiplication. I am working on a few problems described like so:

I am confused about how to handle assembly multiplication. I am working on a few problems described like so:

Given these hex values for the 8086 registers
AX = E204    BX = 30C2    CX = 5C08    DX = 38F1
What are the hex values in DX and AX after executing this instruction:
mul  cl

For mul operations, are we only multiplying using al and the multiplier? For example, would this multiplication simply be 4 * 8 = 32 (decimal) with the result stored in ax?

When imul is 开发者_如何学Goused, then we would multiply the entire value in ax and the multiplier and then store the results in dx:ax, correct?

For this problem, if I am indeed approaching it the right way, al * cl = 4 * 8 = 32. Then:

al = 20

Do I keep ah the same (E2) or do I zero it out for the answer?


Please download complete Intel x86 CPU documentation from here.

For details on just this one instruction you can read here.


Why didn't you try? Never mind, I did it for you:

Microsoft Windows XP [Versione 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\db>debug
-a
15AB:0100 mov ax, e204
15AB:0103 mov bx, 30c2
15AB:0106 mov cx, 5c08
15AB:0109 mov dx, 38f1
15AB:010C mul cl
15AB:010E
-g=0100,010e

AX=0020  BX=30C2  CX=5C08  DX=38F1  SP=FFEE  BP=0000  SI=0000  DI=0000
DS=15AB  ES=15AB  SS=15AB  CS=15AB  IP=010E   NV UP EI PL NZ NA PO NC
15AB:010E 0000          ADD     [BX+SI],AL                         DS:30C2=00
-q

C:\DOCUME~1\db>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号