Im creating an 8086 assembly program to ask a user to input a decimal value, add 5 to it and then print. but it performs computations using hexadecimal values.
So when i input 5 for example: it would be 0x35 + 0x35 = 0x6A then Ox6a would printout as 'j' according to the ASCII tables
Im currently using this interrupt for user input.
mov AH,01H
INT 21H
this is my code so far
.MODEL SMALL
.STACK 300
.DATA
MSG DB "Enter a number: $"
msg2 DB 10,13, "Adding 5 to the number...$"
msg3 DB 10,13, "the number is: $"
.CODE
;init data segment
MOV AX,@DATA
MOV DS, AX
MOV ES, AX
;PRINT MSG
LEA DX,MSG
MOV AH,09H
INT 21H
;GET CHAR
mov AH,01H
INT 21H
MOV CL,AL
;PRINT MSG
LEA DX,MSG2
MOV AH,09H
INT 21H
;newl
MOV dl, 10
MOV ah, 02h
INT 21h
MOV dl, 13
MOV ah, 02h
INT 21h
;computations
ADD CL, 0x35
;PRINT MSG
LEA DX,MSG3
MOV AH,09H
INT 21H
;print char
MOV DL,CL
MOV AH,02H
INT 21H
EXIT:
MOV AH,4CH
INT 21H
END
How do i do decimal computations from user input on 8086?