Newsgroups: comp.sys.amiga.programmer
Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!lsuc!robohack!compus!cccan!entity
From: entity@cccan.uucp (Cybernetworx)
Subject: Re: Checking for a Keystroke (in C)
Message-ID: <1991Jun27.013554.11040@cccan.uucp>
Organization: CCCAN
References: <Alex_Topic.3452@tvbbs.UUCP>
Date: Thu, 27 Jun 91 01:35:54 GMT

In article <Alex_Topic.3452@tvbbs.UUCP> Alex_Topic@tvbbs.UUCP (Alex Topic) writes:
>
>  Well about keyboard scan..heh  Well one time when I was makeing one of
>those take over the machine demos, I wanted to have keyboard control. For
>instance
>I want 2 keys that would switch to NTSC or PAL right away.. just a test
>thingy I wanted to do/
>     
>      You scan the CIA chip..   $bffd00 something not too sure..hmm let me
>check the manual..heh

Heh..nice way of checking the keyboard :-)   Anyhow, what you are looking
for is $bfec01.  This holds the char as its transmitted from the keyboard.
 
>      Not too sure on what it is. What you get is a RAW keyvalue..and just
>take the value and compare it to what you want it to do. ONly problem I get
>different values..Its weird..hmm      later..
 
Actually, the different values you got were dependant on whether the key
was pressed down or was still up.  I can't remember off hand, but I think
the high bit was set if the key was up, and cleared if it was down.  (It
might not have been the high bit...as a matter of fact, I think it was
bit 0.)

> 
> A.t.
 
One other thing, this method of checking the keyboard is totally unadvised!
If you want to maintain system multitasking and everything, there are many
other ways of reading the keyboard.  In fact, C has several functions
built right in, if you don't care to go through the system routines.  The
above method would only be useful in something where you don't want an
input.handler hogging CPU time, and where you are definitely taking over
the machine.  If you are going this route, make sure CIA-A, Timer A is
left running, since this is what performs the serial transmission from the
keyboard.
 
-- 
          __
    __   ///
    \\\ ///               UUCP:   ...uunet!utai!lsuc!becker!cccan!entity
 CYBERNETWORX             INET:   entity@cccan.UUCP
