Read two digits and print their sum, which is at most 9.
The keys DOS shows as they are read do not count as output: print only the sum.
Input
One line with two digits a and b, written together (for example 34), with a + b ≤ 9.
Output
The digit a + b.
Examples
Example 1 · Input
34
Expected output
7
Example 2 · Input
00
Expected output
0
Hints
Hint 1
Read each digit with INT 21h, AH = 1: the key arrives in AL as a character code.
Hint 2
Subtract '0' to turn a character into its number; add '0' to turn the sum back into a character.
Hint 3
Print the sum with AH = 2, which prints DL.
Solution
Show one correct solution (try it yourself first)
; Add two digits
.MODEL SMALL
.STACK 100H
.CODE
MAIN PROC
MOV AH, 1
INT 21H
SUB AL, '0'
MOV BL, AL
MOV AH, 1
INT 21H
SUB AL, '0'
ADD BL, AL
MOV DL, BL
ADD DL, '0'
MOV AH, 2
INT 21H
MOV AH, 4CH
INT 21H
MAIN ENDP
END MAIN