Hi,
Here's the code to do it:-
MOV AX,0000 ;clear AX
MOV AL, 12 ; Here 12 is the number that is to be displayed.
PUSH AX ; Back up the number
SHR AX, 4 ; Shift AX to right 4 times to get the upper nibble (of AL) to lower position. (Now, AL <= 01)
ADD AL, 30 ; Add 30H to convert it to ASCII (Now, AL <= 31)
MOV CH, AL ; Store this ASCII of upper nibble in CH (CH <= 31)
POP AX ; Restore AX
AND AL, 0F ; Mask the upper 4 bits. (Now, AL <= 02)
ADD AL, 30 ; Convert to ASCII (AL <= 32)
MOV AH, CH ; Copy CH to AH. Now, AH contains ASCII of 1 and AL contains ASCII of 2.
(AH <= 31 and AL <= 32, so AX=3132).
Now, you can store the contents of AX at some memory location and then use the INT 21 with the 09H. (Make sure to store 24 (ASCII of $) at the end of the ASCII of numbers storeed in memory.)
__________________
http://swatrant.blogspot.com/
|