KBUF by Mark Adler Pasadena, CA 1988.
KBUF extends the size of the keyboard queue from 15 to 142 keystrokes.
It is compatible with keyboard stacking programs (such as STACKEY) and
mouse cursor movement simulators (such as PC Systems MOUSESYS).
KBUF works by intercepting three interrupts: the keyboard scan code
interrupt (9), the keyboard service interrupt (16h), and the timer tick
interrupt (8). On a keyboard service interrupt, KBUF gets keystrokes
from its own queue, instead of from the BIOS's queue. On a timer tick
interrupt, the BIOS queue is checked for any characters using the
original service routine and if any are found, they are moved to KBUF's
queue, if there is room. On a keyboard scan code interrupt, the
original scan code routine is called to process the code and then the
above action for the timer interrupt is performed.
The program assumes very little about the internals of the BIOS service
routines. In particular, it does not need to know where the original
queue is, or even how long it is. In fact, it is possible to load
multiple copies of KBUF to get larger queue sizes (though there is a
better way---see below).
The size of the keyboard queue can be increased be reassembling KBUF.ASM
with a new value for kqsz. If there is interest, a future version of
KBUF might take a command line parameter to select a queue size.
KBUF also adds a new function to interrupt 16h---if AH is 0FFh, then the
scan code in DX is put into the queue, behind what is already there
(i.e., as if it were just typed). This is different from stacking,
which puts the keystroke at the front of the queue. On return, AL=0
indicates success, AL=1 indicates failure (no room in queue).
Version history -
1.0 26 May 1988 First public version
1.1 18 Nov 1988 Added queue stuff call (AH=0FFh)
Feel free to send any problems with or comments on KBUF to:
P.O. Box 60998
Pasadena, CA 91106