Mail Archives: djgpp/1998/12/02/03:47:37
On Tue, 1 Dec 1998, Edward Hill wrote:
> I have spent a while looking at
> getkey() and _bios_keybrd() and a few more
> but I can't seem to find anything to use
> to just detect if a particular key is pressed.
>
> so say if(keyboard_keypressed('a')printf("a\n");
> if(keyboard_keypressed('b')printf("b\n");
> and the a and b buttons are both held down
> a and b will be printed out.
There is no library function that does this. Moreover, no BIOS
service can possibly do this for you, since the BIOS can only process
a single keypress at a time (if you press two keys, the BIOS only
returns the first one and ignores the second).
AFAIK, the only way to have this functionality is to install a
hardware interrupt handler for Int 9. Allegro might be a good place
to start, since it already includes functions to hook the keyboard
interrupt.
- Raw text -