[Coco] Detecting Shift key.

Steven Wallis stevenw890 at gmail.com
Thu Sep 21 20:39:20 EDT 2017


Text from "Description of the Dragon Keyboard And Video Hardware"
          Revision 1.1   01/06/95   by Paul D. Burgin

The attachment might also help you to understand this better??


DRAGON/TANDY KEYBOARD MAP
=========================

This section describes how to read the Dragon or Tandy CoCo keyboard
at the hardware level. Using this technique simultaneous and continuous
keypresses can be detected.

Begin by writing a byte to $FF02 to specify which 'rows' of keys you want
to enable. A '0' in the specified bits means enabled, '1' means disabled.
Now read from $FF00 to check which 'columns' any pressed keys are in.
Each '0' bit means that the key specified in the table is currently
pressed, and '1' indicates keys not pressed.

                       |      Tandy $FF00 Read
                       | B0  B1  B2  B3  B4  B5  B6
                    ---+----------------------------
                    B0 | @   H   P   X   0   8   ENT
                    B1 | A   I   Q   Y   1   9   CLR
                    B2 | B   J   R   Z   2   :   BRK
      $FF02 Write   B3 | C   K   S   ^   3   ;
                    B4 | D   L   T   v   4   ,
                    B5 | E   M   U   <   5   -
                    B6 | F   N   V   >   6   .
                    B7 | G   O   W   SPC 7   /   SHF
                    ---+----------------------------
                       | B2  B3  B4  B5  B0  B1  B6
                       |      Dragon $FF00 Read

Notice that the 'columns' are swapped for the Tandy in comparison to the
the Dragon - hence if a Tandy game running on a Dragon asks you to press
the '1' key, you should press the 'Q' key!

The joystick file buttons are also connected to IO address $FF00, and are
always enabled. The right joystick button clears bit 0 if pressed, and
the left button clears bit 1. Bit 7 of $FF00 is also used by the joystick
hardware, for the comparator feedback.
-------------- next part --------------
      HOW TO CHANGE THE ADOS/ADOS 3/EXTENDED ADOS 3 CONTROL KEYS!
      -----------------------------------------------------------


1. Extract the .BIN from the .DSK and rename it to .ROM.

2. Edit the file with a hex editor and remove the first and last 5
   bytes from the file (so it is now 8192 bytes).

3. Edit the file with a hex editor and change the following two bytes
   as needed: KEYBOARD ROW & KEYBOARD COL.
   NOTE: When looking at ADOS memory ($C000-DFFF) on MAME or on a real
   CoCo add $C000.

ADOS:
=====
$19C3  LDA $EF     '--> KEYBOARD ROW: Change $19C4 was $EF or 11101111
                   'NOTE: The above bits are inverted!
$19C5  STA $FF02   'Put A in $FF02 to check the Bit4 row.
$19C8  LDA $FF00   'Check these columns.
$19CB  ANDA $08    '--> KEYBOARD COL: Change $19CC was $08 or 00001000
                   'Checks the Bit3 column (DnArrow).

ADOS 3:
=======
$1A01  LDA $EF     '--> KEYBOARD ROW: Change $1A02 was $EF or 11101111
                   'NOTE: The above bits are inverted!
$1A03  STA $FF02   'Put A in $FF02 to check the Bit4 row.
$1A06  LDA $FF00   'Check these columns.
$1A09  ANDA $48    '--> KEYBOARD COL: Change $1A0A was $48 or 01001000
                   'Checks the Bit6 & Bit3 columns (Ctr & DnArrow).

EXTENDED ADOS 3:
================
The code above is still the same and in the same location, but I can't
test it until Extended ADOS 3 works in MAME.

KEYBOARD MAP:
=============
                          |         $FF00 Read
                          |
                          | B7  B6  B5  B4  B3  B2  B1  B0
                          |$80 $40 $20 $10 $08 $04 $02 $01
                   -------+---------------------------------
                   B0 $FE | --  Ent 8   0   X   P   H   @
                   B1 $FD | --  Clr 9   1   Y   Q   I   A
                   B2 $FB | --  Brk :   2   Z   R   J   B
     $FF02 Write   B3 $F7 | --  Alt ;   3   Up  S   K   C
                   B4 $EF | --  Ctr ,   4   Dn  T   L   D
                   B5 $DF | --  F1  -   5   Lf  U   M   E
                   B6 $BF | --  F2  .   6   Rt  V   N   F
                   B7 $7F | --  Shf /   7   Spc W   O   G
                   -------+---------------------------------

           Alt,Ctr,F1,F2 = CoCo 3 only.
           $FF00 Bit7 = Joystick comparison result.



More information about the Coco mailing list