[1] Reads a character from the keyboard without echoing it to the display. If no character is ready, waits until one is available.
[2.0+] Reads a character from the standard input device without echoing it to the standard output device. If no character is ready, waits until one is available. Input may be redirected. (If input has been redirected, there is no way to detect EOF.)
Call with:
AH = 07H
Returns:
AL = 8-bit input data
Notes:
No special action is taken upon entry of a Ctrl-C when this function is used. If Ctrl-C checking is required, use Int 21H Function 08H instead.
To read extended ASCII codes (such as the special function keys F1 to F10) on the IBM PC and compatibles, you must call this function twice. The first call returns the value 00H to signal the presence of an extended code.
See also Int 21H Functions 01H, 06H, and 08H, which provide character input with various combinations of echo and/or Ctrl-C sensing.
[2.0+] You can also read the keyboard by issuing a read (Int 21H Function 3FH) using the predefined handle for the standard input (0000H), if input has not been redirected, or a handle obtained by opening the logical device CON.
Example:
Read a character from the standard input without echoing it to the display, and store it in the variable char.
char db 0 ; input character
.
.
.
mov ah,7 ; function number
int 21h ; transfer to MS-DOS
mov char,al ; save character
.
.
.