I am trying to print the 2 digits I inputted but I am having trouble in printing it. Here's my progress:
DATA SEGMENT
MSG1 DB "ENTER NUMBER : $"
DIGIT1 DB ?
DIGIT2 DB ?
BCD DB ?
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA DX,MSG1
MOV AH,9
INT 21H
MOV AH,1
INT 21H
SUB AL,30H
MOV DIGIT1,AL
MOV AH,1
INT 21H
SUB AL,30H
MOV DIGIT2,AL
MOV AH,DIGIT1
MOV AL,DIGIT2
MOV CL,4
ROL AH,CL
ADD AL,AH
MOV BCD,AL
MOV AH,1
INT 21H
CODE ENDS
END START
My code can accept 2 digit inputs but it cannot print the inputted 2 added digits and it prints Enter Number:
Your program successfully creates a packed BCD from the 2 inputs.
To print the result back to the screen you first take apart what you have put together and then convert the digits into characters that DOS can output.
The code that you've posted
MOV AH,1
INT 21H
can not have produced this output! Maybe you wrotemov ah,9
in the code that produced the screenshot?Also the screenshot is missing a space character between the "R" and the ":".