In: Computer Science
Using visual studio in MASM x86,
Write a program to add the following word size numbers: 15F2, 9E89, 8342, 99FF, 7130 using adc instruction and a loop. The result must be in DX, AX. Show the result in debug window.
Code:
.model small
.data
num1 dw 15F2H
dw 9E89H
num2 dw 8342H
dw 99FFH
dw 7130H
result dw 0,0,0,0
.code
mov ax,@data
mov ds,ax
mov ax,num1
mul num2
mov result,ax
mov result+2,dx
mov ax,num1+2
mul num2
add result+2,ax
adc result+4,dx
adc result+6,0
mov ax,num1
mul num2+2
add result+2,ax
adc result+4,dx
adc result+6,0
mov ax,num1+2
mul num2+2
add result+4,ax
adc result+6,dx
mov ax,4C00h
int 21h
end