Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!deimos!unmvax!nmtsun!nraoaoc From: nraoaoc@nmtsun.nmt.edu (Daniel Briggs) Newsgroups: comp.sys.ibm.pc Subject: Re: 2 problems Message-ID: <3942@nmtsun.nmt.edu> Date: 10 Mar 90 23:26:57 GMT References: <3123@bingvaxu.cc.binghamton.edu> Reply-To: dbriggs@nrao.edu (Daniel Briggs) Distribution: comp Organization: National Radio Astronomy Observatory, Socorro NM Lines: 27 In article 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. The usual way to do this is to catch the hardware keyboard interrupt yourself. (This is interrupt nine, not sixteen.) The keyboard generates both a make and a break code for every keystroke. (I am not certain about repeats in this context.) You maintain a flag like "space_is_down" in your program. Set this true when you get a 'make code', and reset it to false when you get a 'break code'. Note that the normal BIOS simply ignores all break codes, and doesn't even pass them to DOS. (Except for the shift keys.) Programming the keyboard in this manner is a little gruesome. When I tried some of this, (a long time ago), I simply copied the code from the IBM XT Technical Reference manual BIOS listing. (I highly recommend this as required reading if you want to get down and dirty when programming PCs). Read the interrupt nine handler carefully, and it should tell you all you need. Beware, though, I have seen instances where some clone keyboards occasionally drop the break codes. This is bad news for a game such as I describe. ----- This is a shared guest account, please send replies to dbriggs@nrao.edu (Internet) Dan Briggs / NRAO / P.O. Box O / Socorro, NM / 87801 (U.S. Snail)