Int 21H [1.0] Function 08H Character input without echo

[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 = 08H

Returns:

AL = 8-bit input data

Notes:

If the standard input is not redirected, and the character read is a Ctrl-C, an Int 23H is executed. If the standard input is redirected, a Ctrl-C is detected at the console, and BREAK is ON, an Int 23H is executed. To avoid possible interruption by a Ctrl-C, use Int 21H Function 07H 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 07H, 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, allowing possible detection of Ctrl-C, and store the character in the variable char.

char db 0

.

.

.

mov ah,8 ; function number

int 21h ; transfer to MS-DOS

mov char,al ; save character

.

.

.