Mail Archives: djgpp/1998/10/29/10:56:32
On Wed, 28 Oct 1998, Mapson wrote:
> But before I need to go to that level: is there a high-level way in
> DJGPP to manipulate, directly access, or even temporarily disable the
> keyboard buffer? If I could make it "recirculating", that would at
> least be a sure (if clunky) solution.
I admit I don't really understand the particulars of the problem and the
solution that you are after. Perhaps you could explain more about the
structure of the program that needs this, and why.
In particular I don't understand what do you mean by ``direct access'' to
the keyboard buffer. How would such a thing help you when you say the
problem is that you don't *know* when the program will be *able* to
access the keayboard?
One way of solving similar problems is to build a program around an idle
loop that checks for keystrokes, and if there are some, stashes them away
in a large circular buffer for later use by other parts of the program.
Since today's machines are so fast, a typical PC can run circles around
even the fastest typist.
Another possibility is to use the timers: you set it up to trigger a
periodic alarm signal that is caught by a SIGALRM handler, and the
handler looks at the keyboard and stashes away any keystrokes that might
be pending. (If you go for this solution, be sure to read the fine print
about the subtle aspects of DJGPP signal handling, at the end of the docs
for the library function `signal'.)
Anyway, there *is* a way to access the keyboard buffer directly, since
the pointers maintained by the BIOS to its head and tail are at known
addresses. I just don't see how that would help to solve your problems.
- Raw text -