Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sample.eng.ohio-state.edu!purdue!haven.umd.edu!uflorida!winnie!zach!mark From: mark@zach.fit.edu ( Mark R. Craig) Newsgroups: comp.sys.amiga.programmer Subject: Re: Checking for a Keystroke (in C) Message-ID: <2676@winnie.fit.edu> Date: 20 Jun 91 03:34:43 GMT References: <1991Jun19.131033.14578@schaefer.math.wisc.edu> Sender: usenet@winnie.fit.edu Reply-To: mark@zach.UUCP ( Mark R. Craig) Distribution: usa Organization: Florida Institute of Technology, ACS, Melbourne, FL Lines: 36 In article <1991Jun19.131033.14578@schaefer.math.wisc.edu> mueller@math.wisc.edu writes: >This question probably will require a somewhat lengthy answer. I hope that >someone out there will take the time. > >I have the SAS/C compiler for the AMIGA and I want to write a routine that >I can call that will check for a keypress. If a key is being pressed, I want >the routine to report the key being pressed. If not I want it to return -1 >or some such thing. Can anyone tell me how to do this (or direct me to some >source code that does this)? I have a feeling that I'm going to have to use >the keyboard device or the input device or the console device. If so, I'm >really going to need some help getting started. > >Thanks much in advance. > >Carl Mueller (mueller@math.wisc.edu) I would be VERY interested in such code! I would think that there would be a system register that contains the keypress (a buffer perhaps) that could be scanned. I know on UNIX the solution would be an ioctl call (do a read with FIONREAD flag or something like that (I forget the exact call)) - it worked like a charm. On a similar topic, I originally used a lot of overhead stuff for reading the joystick (OpenPort, etc.)...then after looking at an old Amiga World, I replaced all that stuff (I'm holding back on saying garbage - don't want to get flamed by real gurus :-) ) with about 8 or so lines of code. One problem with this method is that it doesn't buffer joystick responses - but that's what I wanted anyways.... Hope someone comes up with an easy way of doing the keyboard scan! Mark Mark R. Craig Internet: mark@zach.fit.edu UUCP: ...!winnie!zach!mark