.MODEL SMALL .DATA MESSAGE DB "You pressed:$" .CODE .STARTUP ;Read the keys with echo until ESC key is pressed ;Print a message each time LABEL1: mov ah, 9 ; Select function 9, print a string mov dx, OFFSET MESSAGE int 21h ; Interrupt 21h (DOS functions) ;Read the key mov ah, 01 ; Select function 1, read a key with echo int 21h ; Interrupt 21h (DOS functions) ;The program wait for a keypress before reaching this point cmp al,1BH ; Compare to ESC code (ASCII) jne LABEL1 ; If not ESC - continue .EXIT END