To add cx
to the doubleword in dx:ax
:
add ax,cx ; ax += cx
adc dx,0 ; dx += the carry from the previous addition (0 or 1)
Pergunta
I have a little problem with finding a way to add the multiplication result to the sum. Assuming that we can only use registers (no memory variables), I am not sure about how I can be able to accomplish this. For example, if I want to compute this expression:
; 2013 * 365 + 765
mov ax, 365
mov bx, 2013
mul bx ; 2013 * 365
; The result would be DX:AX where EAX = 00003619 EDX = 0000000B
mov cx, 765
; Now I am stuck here. I am not sure how can I add the result of multiplication
; to cx since it's DX:AX. Also, just to remind you, I am not allowed to use
; any variables.
; Any help would be appreciated!
Solução
To add cx
to the doubleword in dx:ax
:
add ax,cx ; ax += cx
adc dx,0 ; dx += the carry from the previous addition (0 or 1)