Hi, I need this program to print ascii code that I entered to al.
The problem is that it is always print the char of the value ; i.e If I type a, al=61.
How I print just the '61' and not the 'a' ?
Here is my code :
.model small
.stack 100h
.data
logo db ' ___ ',10,13
db '| _ )_ _ ',10,13
db '| _ \ || | ',10,13
db '|___/\_, | ',10,13
db ' | |__/ ',10,13
db ' |________ ______ ',10,13
db '___ __ \ ___ __ \ ',10,13
db '__ / / /________ /_/ / ',10,13
db '_ /_/ /_/_____/ ____/ ',10,13
db '/_____/ /_/ $',10,13
msg1 db 'Press any key to get his ASCII Code. Press Esc to quit.',10,13
db '$'
msg2 db ' .ASCII Code : . Press another key, to get his ASCII Code. Press Esc to quit.',10,13
db '$'
.code
mov ax,@data
mov ds,ax
call clear
mov dx, offset logo ;print my logo.
mov ah, 9
int 21h
call delay ;call delay function for taking time.
call clear ;give me a clean MS-Dos screen.
mov dx, offset msg1 ;print first msg.
mov ah, 9
int 21h
coun: mov ah, 1h ; keyboard input subprogram.
int 21h ; read character into al and print it.
cmp al, 27 ; if key is 'esc' then exit.
je stop
inc bx ; increase bx on every key press.
mov dx, offset msg2 ;print second msg.
mov ah, 9
int 21h
jmp coun
stop: mov dx, offset logo
mov ah, 9
int 21h
mov ah, 0
int 16h
;---------------------------------------------------------
mov ah,7
int 21h
mov ah,4ch
int 21h
;---------------------------------------------------------
clear:
mov ax,3
int 10h
ret
delay:
mov bx,7fffh
x:mov cx,0ffffh
x1:loop x1
dec bx
jnz x
ret
;---------------------------------------------------------
end