Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!unmvax!ariel!ariel.unm.edu!sorc From: sorc@carina.unm.edu (Paul Caskey) Newsgroups: comp.sys.ibm.pc Subject: Re: 2 problems Message-ID: Date: 12 Mar 90 03:51:36 GMT References: <3123@bingvaxu.cc.binghamton.edu> <3942@nmtsun.nmt.edu> Sender: news@ariel.unm.edu Distribution: comp Organization: The Village Lines: 33 In-reply-to: nraoaoc@nmtsun.nmt.edu's message of 10 Mar 90 23:26:57 GMT On 10 Mar 90 23:26:57 GMT, nraoaoc@nmtsun.nmt.edu (Daniel Briggs) said: Daniel> In article Daniel> sorc@carina.unm.edu (Paul Caskey) writes: > >I figured if I dug deep enough, there would have to be some way to ask >the computer to go look at the space bar and tell me if it was up or >down at any given instant. But I really don't think you can. If you >do come up with a solution for this, I'd be really curious to see it. Daniel> The usual way to do this is to catch the hardware keyboard Daniel> interrupt yourself. (This is interrupt nine, not sixteen.) Daniel> The keyboard generates both a make and a break code for every Daniel> keystroke. (I am not certain about repeats in this context.) Daniel> You maintain a flag like "space_is_down" in your program. Set Daniel> this true when you get a 'make code', and reset it to false Daniel> when you get a 'break code'. Note that the normal BIOS simply Yeah! Duh...how embarassing. I can't believe I didn't see that. For some reason it didn't occur to me that it's good enough to know whether a key has just been pressed or just been released, because like you said, if it was pressed and not released yet, it's still down. :-) Sigh....I hate it when I look so hard for something that I miss the obvious solution. Ah well. -- /*********/ Paul Caskey pcaskey@ariel.unm.edu Only lawyers represent anyone's ideas but their own. /*********/