delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/12/02/03:47:37

Date: Wed, 2 Dec 1998 10:47:39 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: detecting multiple keypresses
In-Reply-To: <36646BFF.77F3@gecm.nospam.com>
Message-ID: <Pine.SUN.3.91.981202104716.24125E-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019