🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #11066

Re: Non-blocking keyboard reads

#11066
From: Robin Rosenberg
Date: Thu, 19 Jan 1989 10:15
23 lines
1575 bytes
In article <1004@husc6.harvard.edu>, wen@husc4.HARVARD.EDU (A. Wen) writes:
> I've been mulling over ways to do non-blocking keyboard reads without
> polling the keyboard; is there any way that I can be signalled when the
> console device has input available short of creating a new task to block 
> for input and then signal its parent process?
> 
> That is, if I am waiting for the timer to wake me up, but I need to be notified 
> of any keystrokes that may occur in the meantime, is there anything simple
> (short of busy-waiting) that I can do?
> 

You could do it several ways. If you are using windows with IDCMP you might
wait for VANILLA or RAWKEY messages (whichever you put into the IDMCP Flags).
What I think you missed is the fact that you can do *asynchronous* device io.
Use the console device. This will decode the keyboard correctly and give you
funtion keys as well. You SendIO READ requests to the console device. The
device will signal you when it has something to deliver. When you get the
signal you get the reply with WaitIO(). There is an example in RKM Libraries
and devices. If I'm not mistaken it also works. 

------
Robin Rosenberg,	Abo Akademy, FINLAND
email: <rosenbergr@abo.fi> 
Technical Details
Message-ID: <2802@abo.fi>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!enea!kth!draken!tut!ra!tucos!abo.fi!rosenbergr
References: <1004@husc6.harvard.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!enea!kth!draken!tut!ra!tucos!abo.fi!rosenbergr
From: rosenbergr@abo.fi (Robin Rosenberg)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Non-blocking keyboard reads
Message-ID: <2802@abo.fi>
Date: 19 Jan 89 10:15:40 GMT
References: <1004@husc6.harvard.edu>
Organization: Abo Academy, Finland
Lines: 23