[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [MiNT] Detecting whether a key is pressed



> From: owner-mint@fishpool.com [mailto:owner-mint@fishpool.com]On Behalf
> Of Mario Becroft
> Sent: Friday, July 02, 1999 11:23 AM
> To: MiNT Mailing List
> Subject: [MiNT] Detecting whether a key is pressed
>
>
> I have a particular requirement for GEM program, whereby it must be able
> to determine whether a specified key is pressed at any time.
>
> The AES only causes an event when a key is pressed, but not when it is
> released, meaning that it is impossible to keep track of the state of a
> given key.
>
> I thought that I might be able to use MiNT's Psigintr function to cause my
> program to be notified when data arrives from the keyboard. However I do
> not believe this would work since although my program would be notified
> that data had arrived from the keyboard, there would be no way to
> determine what the data was.
>
> An ideal answer would be some kind of system call or system variable which
> reflects the current state of any key. However I do not believe there is
> such a thing.
>
> To clarify, I do not need to know when a key is pressed or released; only
> whether it is currently pressed or released.
>
> Does anyone have a suggestion as to how I could accomplish this, apart
> from using a TSR program which monitors the status of the keys?

The "right" way to do that would be to have a device u:\dev\keybd, and to
define it in a way such that you get the information you need.

Now the trouble is -- (N.)AES just uses the VDI input functions, which in
turn use the BIOS. Intercepting the chain of keyboard processing probably
will generate a lot of confusion, unless your keyboard device driver is just
"peeking", but not actually reading characters (does that make sense?).

Regards, jr