I have a program here that divides two user input numbers and shows the quotient. The program already runs fine and produces the correct result but when I added the data segment, instead of showing the quotient, it displays the capital "T". I have tried single stepping it and noticed that the value of the AX register changes before printing MSG3. I want to be able to add the string Input First Number and such, but something in the process seems to be messing with the code. How can I solve this?
Here is the code:
.MODEL SMALL
READ MACRO MSG
MOV AH,0AH
LEA DX,MSG
INT 21H
ENDM
PRINT MACRO MSG
MOV AH,09H
LEA DX,MSG
INT 21H
ENDM
.DATA
CR EQU 0DH
LF EQU 0AH
MSG1 DB "Enter First Digit: $"
MSG2 DB CR,LF,"Enter Second Digit: $"
MSG3 DB CR,LF,"The Quotient is: $"
BUFF DB 2
DB 3 DUP ('$')
DATA ENDS
.CODE
ASSUME CS:CODE,DS:DATA
MAIN PROC
MOV AX,DATA
MOV DS,AX
PRINT MSG1
MOV AH,1
INT 21H ;Dividend
MOV BH,AL
SUB BH,48 ;Convert to decimal no
PRINT MSG2
MOV AH,1
INT 21H ;Divisor
MOV BL,AL
SUB BL,48
MOV CL,BH ;Move dividend to cl reg
MOV CH,00 ;Empty register?
MOV AX,CX ;Move 16bit to 16bit reg
DIV BL ;AX/BL
AAD ;Stop dividing. ASCII adjust AX before division. Clears AH reg
PRINT MSG3
ADD AL,48
MOV AH,2
MOV DL,AL ;Print
INT 21H
EXIT:
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN