NOVICE question: How to know when a key is pressed

Raymond Chen raymond at math.berkeley.edu
Sat Apr 13 09:04:00 AEST 1991


In article <1991Apr11.155200.12819 at ericsson.se>, etxpihl at 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?]



More information about the Comp.lang.c mailing list