Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!agate!sunkist.berkeley.edu!raymond From: raymond@math.berkeley.edu (Raymond Chen) Newsgroups: comp.lang.c Subject: Re: NOVICE question: How to know when a key is pressed Keywords: key, keypress, c, novice Message-ID: <1991Apr12.230400.12749@agate.berkeley.edu> Date: 12 Apr 91 23:04:00 GMT References: <1991Apr11.155200.12819@ericsson.se> Sender: usenet@agate.berkeley.edu (USENET Administrator) Reply-To: raymond@math.berkeley.edu (Raymond Chen) Organization: U.C. Berkeley Lines: 20 In-Reply-To: etxpihl@tore.ericsson.se (DEE Tomas Pihl) Originator: raymond@sunkist.berkeley.edu In article <1991Apr11.155200.12819@ericsson.se>, etxpihl@tore (DEE Tomas Pihl) writes: >I want to know how you can scan if a specific key has been pressed. ... You didn't say what operating system you were using, so I'll assume you're using what I'm using. The keyboard strobe lives at $C000; when a key is available, the top bit goes on. The lower seven bits contain the ASCII code of the key that was pressed. To clear the strobe, access memory location $C010. Note also that if the high bit of $C062 is clear, you should convert uppercase ASCII characters to lowercase; this is the standard method for entering lowercase for those who have installed the `shift key mod' by connecting the BUTTON2 pin on the game controller chip to the second connector pin on the keyboard decoder card. (Only works for newer keyboards; for older ones, you'll need to do some soldering.) Hope this helps. -- This article has not been closed-captioned for the humor-impaired. [Easy extra credit: What computer system am I describing?]