Chapter
1
I
System
Calls
C
onInputFlush
Flush
Buffer,
Read
Keyboard
Function
Call
OCH
Empties the keyboard type-ahead buffer. Further processing
depends on the value in AL when the function is called:
OlH, 06H, 07H, 08H,
or
OAH
-
The corresponding input system
Any other value
-
Entry Conditions:
AH
=
0CH
AL
=
function
code
OlH, 06H, 07H, 08H,
or
OAH
=
call corresponding function
Any other value
=
perform no further processing
Exit
C
onditionsr
If AL
=
00H, type-ahead buffer was flushed; no other
processing was performed.
Macro Definition:
call is executed.
No further processing is done.
flujh-and-read- kbd macro
witch
mov
a1,~witch
m0v
ah,ECH
int 21
H
endm
Example:
The following program both displays and prints characters
as they are typed. If
(ENTER]
is
pressed, the program
sends a
Carriage-ReturniLine-Feed
to
both the display and
the printer. (The example assumes that
a
CONTROL-C
processing routine has been set up before the loop is
entered.)
func-ECH: flush-and-read-kbd
1
;THIS FUNCTION
pr in t-c har
a
I
;see
Function
E5H
CmP
a1
,EDH
;i5
it
a
CR?
]ne func- 0CH
;no, print
it
print- char
lE
;5ee
Function
E5H
display- char
18
;5ee
FunLtion E2H
Imp
func- ECH
;get another character
46