Function 0Ch Flush Buffer, Read Keyboard

mov al, FunctionNumber ;input function (01h, 06h, 07h, or 08h)

mov ah, 0Ch ;Flush Buffer, Read Keyboard

int 21h

mov InputChar, al ;character from standard input

Flush Buffer, Read Keyboard (Function 0Ch) empties the standard input buffer. Further processing depends on the value in AL when the function is called.

Parameter

FunctionNumber

Specifies the number of a read-keyboard function that is to be executed after the standard input buffer is flushed. The following functions can be specified:

Value Function name

01h Read Keyboard with Echo
06h Direct Console I/O
07h Direct Console Input
08h Read Keyboard Without Echo

The value 0Ah is reserved and must not be used.

Return Value

If a function number is specified, the AL register contains the return value for that function. If no function number is specified (that is, FunctionNumber is not 01h, 06h, 07h, or 08h), the AL register contains 00h and the standard input buffer is empty.

Comments

This function clears all keyboard input received before a program requests new input, so that the program does not receive a character entered before the request.

If Flush Buffer, Read Keyboard is used to call Direct Console I/O (Function 06h), the DL register must contain 0FFh (Flush Buffer, Read Keyboard cannot be used to call Direct Console I/O and write a character).

See Also

Function 01h Read Keyboard with Echo
Function 06h Direct Console I/O
Function 07h Direct Console Input
Function 08h Read Keyboard Without Echo
Function 3Fh Read File or Device