engmunir
Member level 1
Dear all experts
i am using MASM 611 assembly language software. i want to add two numbers input from users. my below mention code is adding the result which is less than 10. but when addition result is greater than 10 then there is error. please tell me how i can add numbers which result is greater than 10.
Please help me out ur urgent response is required.
i am using MASM 611 assembly language software. i want to add two numbers input from users. my below mention code is adding the result which is less than 10. but when addition result is greater than 10 then there is error. please tell me how i can add numbers which result is greater than 10.
Code:
.stack 100h
.data
value db 1
value1 db 1
sum db 1
prompt1 db"Enter first positive integer: ",'$'
prompt2 db 0dh,0ah,"Enter second positive integer: ",'$'
answer db 0dh,0ah,"The answer is: ",'$'
.code
mov ax,@data
mov ds,ax
mov dx,offset prompt1
mov ah,09h
int 21h
mov ah,01h
int 21h
mov bx,offset value
mov [bx],al
mov cl,al
sub cl,30h
mov dx,offset prompt2
mov ah,09h
int 21h
mov ah,01h
int 21h
mov bx,offset value1
mov [bx],al
mov bl,al
sub bl,30h
add bl,cl
add bl,30h
mov cl,bl
mov bx,offset sum
mov [bx],cl
mov dx,offset answer
mov ah,09h
int 21h
mov dl,cl
mov ah,02h
int 21h
mov ah,4ch
int 21h
end