section .data
msg db "Enter first number",10     ; Enter first no
len equ $-msg                      ; length of first number
msg1 db "Enter second number",10   ; Enter second no
len1 equ $-msg1                   ; length of second number
msg2 db "The sum is",10
len2 equ $-msg2
 
section .bss
num1 resb 2 ; allocate memory for first number like int num1
num2 resb 2 ; Allocate memory for second number like int num2
sum resb 2       ; Allocate memory for sum like int sum
 
section .text
global _start
_start:
mov rax,1         ; write operation/display first message
mov rdi,1 ; fd value monitor
mov rsi,msg
mov rdx,len 
syscall
 
mov rax,0	; read/input first number
mov rdi,0 ;fd value of the keyboard
mov rsi,num1
mov rdx,2
syscall
 
mov rax,1        ; display second message
mov rdi,1
mov rsi,msg1
mov rdx,len1
syscall
 
mov rax,0        ; input second number
mov rdi,0
mov rsi,num2
mov rdx,2 ;size of num2
syscall
 
mov rax,[num1]  ; move first number in rax
sub rax,30h  ; convert it in original number
mov rbx,[num2] ; move second number in rbx
sub rbx,30h ; convert it in original number
 
add rax,rbx  ; add two numbers
add rax,30h ;convert it in ascii
mov [sum],rax ; mov result in sum
 
mov rax,1      ;display msg2
mov rdi,1
mov rsi,msg2
mov rdx,len2
syscall
 
mov rax,1   ; display sum
mov rdi,1
mov rsi,sum
mov rdx,2
syscall
 
 
mov rax,60
mov rdi,0
syscall
 