简体   繁体   中英

Assembly: Adding doubleword to double word

So I've got some homework which is making me rip out my hair.

this is the code:

VALUE1  DW  0153H
    DW  1624H
VALUE2  DW  0328H
    DW  3C44H
RESULT  DW  0
    DW  0
    DW  0
    DW  0

    MOV SI,OFFSET VALUE1
    MOV DI,OFFSET VALUE2
    MOV AX,[SI]
    INC SI
    ADD AX,[SI]
    MOV BX,[DI]
    INC DI
    ADD BX,[DI]

Professor wants us to add the double word beginning at Value1 to the double word beginning at VALUE2 and then store it as one of the results. I've been trying to look online and on the book for help but I've been stuck for over an hour now. Any help? THe code is what I wrote from looking over through the book, I doubt it's right but it's what I have so far

You must first add words and then add its carries with other words.

Try to use this code:

d dd 1111111
d1 dd 2222222
d2 dd ?

lea bx,op1
mov ax,[bx]
mov dx,[bx+2]
lea bx,op2
add ax,[bx]
adc dx,[bx+2]  ;add two word and carry
lea bx,d
mov [bx],ax
mov 2[bx],dx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM