Hey I am using window 7 x86. I want to add two 16 bit numbers.
When I add 3+3 its answer is correct but when I add 7+7 it\'s not working. A
Here is the code to add 2 16-bit numbers on 8086:
.model small
.data
a db "Enter the first number$"
b db "Enter the second number$"
c db "The sum is: $"
d db 00h
.code
start:
mov ax,@data
mov ds,ax
mov dx,offset a
mov ah,09h
int 21h
mov ah,01h
int 21h
mov bh,al
mov ah,01h
int 21h
mov bl,al
mov dx,offset b
mov ah,09h
int 21h
mov ah,01h
int 21h
mov ch,al
mov ah,01h
int 21h
mov cl,al
add al,bl
mov ah,00h
aaa
add bh,ah
add bh,ch
mov d,al
mov al,bh
mov ah,00h
aaa
mov bx,ax
add bx,3030h
mov dx,offset c
mov ah,09h
int 21h
mov dl,bh
mov ah,02h
int 21h
mov dl,bl
mov ah,02h
int 21h
mov dl,d
add dl,30h
mov ah,02h
int 21h
end start
The trick here lies in using 'aaa' command to unpack the digits.