Hi m using dosbox and masm compilor how can i print multiplication table my code is as follows but it prints special characters. KIndly correct me here m doing wrong. Correct the code if any one can help me through this
.MODEL SMALL
.STACK 100H
.DATA
MSG DB 'ENTER A DIGIT:$'
NL DB 0DH,0AH,'$'
.CODE
MAIN PROC
MOV AX,@DATA
MOV DS,AX
LEA DX,MSG
MOV AH,09
INT 21H
MOV AH,01
INT 21H
XOR BX,BX
MOV BL,1
MOV CL,10
TOP:
MUL BL
ADD AL,30h
MOV AH,02
MOV DX,AX
INT 21H
LEA DX,NL
MOV AH,09
INT 21H
INC BL
LOOP TOP
JCXZ SKIP
SKIP:
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
Your multiplication results are numbers with more than one digit, so you will need a procedure to convert the number to string, for example, convert 21 to '21', because if you display 21 the screen will show the ASCII char 21 ('§').
I will add the procedure "number2string" to your code, this procedure takes two parameters :
AX
is the number to convert (in your case, the result of the multiplication), andSI
with the address of a string variable :