[comp.sys.amiga] How to read the keyboard?

cpb@doc.ic.ac.uk (C P Brown) (10/05/90)

Can anyone tell me the best Intuition-friendly way of saying
"is the z key pressed down at the moment" (or any other key) so that
I can detect whichever keys are being pressed?

I'm aiming to do it in Modula-2, but C or assembler or any pointers in
the right direction welcomed.

Thanks for any help,

Phil

lphillips@lpami.wimsey.bc.ca (Larry Phillips) (10/06/90)

In <2305@gould.doc.ic.ac.uk>, cpb@doc.ic.ac.uk (C P Brown) writes:
>Can anyone tell me the best Intuition-friendly way of saying
>"is the z key pressed down at the moment" (or any other key) so that
>I can detect whichever keys are being pressed?
>
>I'm aiming to do it in Modula-2, but C or assembler or any pointers in
>the right direction welcomed.

Open the keyboard.device, use DoIO, and use the IO command CMD_READMATRIX

-larry

--
It is not possible to both understand and appreciate Intel CPUs.
    -D.Wolfskill
+-----------------------------------------------------------------------+ 
|   //   Larry Phillips                                                 |
| \X/    lphillips@lpami.wimsey.bc.ca -or- uunet!van-bc!lpami!lphillips |
|        COMPUSERVE: 76703,4322  -or-  76703.4322@compuserve.com        |
+-----------------------------------------------------------------------+

UH2@psuvm.psu.edu (Lee Sailer) (10/06/90)

In article <2305@gould.doc.ic.ac.uk>, cpb@doc.ic.ac.uk (C P Brown) says:
>
>Can anyone tell me the best Intuition-friendly way of saying
>"is the z key pressed down at the moment" (or any other key) so that
>I can detect whichever keys are being pressed?
>

I dunno if it is the best way, but you can open the keyboard.device and
send it a message.  You'll get back a bit pattern that tells you exactly
what keys are depressed.

I've got a toy ecxample around somewhere.  I based it on a chapter from
the RKM manual, Libraries and Devices.

                                      lee
>I'm aiming to do it in Modula-2, but C or assembler or any pointers in
>the right direction welcomed.
>
>Thanks for any help,
>
>Phil