Re: [cc65] Commodore PET keyboard scanning

From: Steve Davison <64subnet1gmail.com>
Date: 2010-04-25 12:31:29
On Apr 24, Chiron Bramberger <chiron@bramberger.com> wrote:
> Anyway, the PET's KERNAL (or KERNEL???) has a simple keyboard
> scanner.  ....  (technically it detects it when you hold down the
> cursor or spacebar and maybe a few other keys, but not most of them.
> weird???)

Actually, it is aware of the fact you are holding down a key
(whichever key), and you can read that key with a PEEK (I forget
the address, but I used to use it back in 8th grade...)  The
kernal chooses to only recognize certain keys as repeating.  I
think on the PET there's a POKE you can do to make them all
repeat--not that this will help you.

DISCLAIMER: I have NOT studied how the keyboard works on the PET
specifically.  Most of what I know is true for the C64.  However,
everything I've seen so far about the PET keyboard seems to
indicate that the same concepts are used on both.

The 8x8 matrix does a great job of detecting any 2 keys
pressed simultaneously.  The decode routine in the kernals
make the assumption that there is no more than one key pressed,
though.  (Yes, very simplistic.)  Well, actually 2 keys at a
time to allow for the modifier keys.  Anyway, that is perfectly
adequate for typing, as long as you don't go too fast!

The simple decoding accounts for certain quirky behavior you may
have experienced; such as when you type a little too fast and
don't let up on one key before pressing the next.  (The most
common artifact of this type is probably typing LIST and getting
LIT instead.)  Certain keys have priority over others based on
the order bits are decoded.

Checking for multiple keys pressed simultaneously requires a
custom scan routine.  You may be able to detected up to 8 keys
pressed at once, based on how those keys are situated.  Any 2
keys is no problem, but certain combinations of 3 or more keys
can produce phantom keystrokes.  The combination of keys you
choose may be affected by this phenomenon.

Here's a couple links I stumbled on...
http://www.classic-games.com/commodore64/petdoc.html
http://sta.c64.org/cbm64kbdlay.html

// Steve
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Sun Apr 25 12:31:34 2010

This archive was generated by hypermail 2.1.8 : 2010-04-25 12:31:37 CEST