When I add 3+3 its answer is correct but when I add 7+7 it's not working. And I want to add two numbers like 75+75 its answer should be 150 or 900+100 its answer should be 1000.
What is its procedure please tell me. What is the wrong with my code,I'm sorry cause I'm just new assembly language..
.model small
.stack 0100h
.data
num1 db ?
num2 db ?
msg1 db 13,10, "Enter 1st Number : $"
msg2 db 13,10, "Enter 2nd Number : $"
msg3 db 13,10, "The answer is : $"
.code
mov ax, @data
mov ds, ax
lea dx,msg1
mov ah,09h
int 21h
start:
mov ah,01h
int 21h
cmp al,0dh
je second
sub al,30h
push ax
mov num1,al
jmp start
second:
lea dx,msg2
mov ah,09h
int 21h
number2:
mov ah,01h
int 21h
cmp al,0dh
je ans
sub al,30h
push ax
mov num2,al
jmp number2
ans:
mov al,num1
add al,num2
MOV AH,9
LEA DX,MSG3
INT 21H
ADD AL,30H
MOV AH,2h
MOV DL,AL
INT 21H
jmp start
end