Difference between revisions of "Keyboard"

From The Dragon Archive
(Created page with '500px|link= Dragon Keyboard map: <pre> | PB0 PB1 PB2 PB3 PB4 PB5 PB6 PB7 ----|---------------------------------------------- P...')
 
(add coco)
 
(2 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
  
Dragon Keyboard map:
+
How the keyboard matrix scan work is described in "Inside the Dragon" book on page 198-204.
 +
 
 +
 
 +
Dragon 32 keyboard map:
 +
 
 +
<pre>
 +
          LSB              $FF02                    MSB
 +
        | PB0  PB1  PB2  PB3  PB4  PB5  PB6  PB7 <- column
 +
    ----|----------------------------------------------
 +
    PA0 |  0    1    2    3    4    5    6    7    LSB
 +
    PA1 |  8    9    :    ;    ,    -    .    /    $
 +
    PA2 |  @    A    B    C    D    E    F    G    F
 +
    PA3 |  H    I    J    K    L    M    N    O    F
 +
    PA4 |  P    Q    R    S    T    U    V    W    0
 +
    PA5 |  X    Y    Z    Up  Down  Left Right Space    0
 +
    PA6 | ENT  CLR  BRK  N/C  N/C  N/C  N/C  SHFT
 +
    PA7 - Comparator input                                MSB
 +
    ^
 +
    |
 +
    row
 +
</pre>
 +
 
 +
 
 +
CoCo keyboard map:
  
 
<pre>
 
<pre>
    | PB0  PB1  PB2  PB3  PB4  PB5  PB6  PB7
+
          LSB              $FF02                    MSB
----|----------------------------------------------
+
        | PB0  PB1  PB2  PB3  PB4  PB5  PB6  PB7 <- column
PA0 |  0    1    2    3    4    5    6    7
+
    ----|----------------------------------------------
PA1 |  8    9    :    ;    ,    -    .    /
+
    PA0 |  @    A    B    C    D    E    F    G   LSB
PA2 |  @    A    B    C    D    E    F    G
+
    PA1 |  H    I    J    K    L    M    N    O     $
PA3 |  H    I    J    K    L    M    N    O
+
    PA2 |  P    Q    R    S    T    U    V    W     F
PA4 |  P    Q    R    S    T    U    V    W
+
    PA3 |  X    Y    Z    Up  Down  Left Right Space     F
PA5 |  X    Y    Z    Up  Down  Left Right Space
+
    PA4 |  0    1    2    3    4    5    6    7    0
PA6 | ENT  CLR  BRK  N/C  N/C  N/C  N/C  SHFT
+
    PA5 |  8    9    :    ;    ,    -    .    /    0
 +
    PA6 | ENT  CLR  BRK  N/C  N/C  N/C  N/C  SHFT
 +
    PA7 - Comparator input                                MSB
 +
    ^
 +
    |
 +
    row
 
</pre>
 
</pre>
  
e.g.:
+
e.g. (Dragon):
    'U' $55 -> col: 5 - row: 4
+
* 'U' $55 -> col: 5 - row: 4
    'Y' $59 -> col: 1 - row: 5
+
* 'Y' $59 -> col: 1 - row: 5
 +
 
 +
If "U" is pressed, then when PB5 of PIA0 is LOW, PA4 of PIA0 will read LOW, else it will read HIGH.
 +
 
 +
Similarly if "A" is pressed then when PB1 is LOW, PA2 will read LOW, else it will read HIGH.
 +
 
 +
Each key is just a switch bridging a row and a column - if the column is low, then the row will be pulled low when the key is pressed (the A side of the PIA has an internal pull-up, so in input mode it will read as high if not connected to anything - no key pressed).
  
 +
 +
matrix columns '''PB0-PB7''' are:
 +
* configured as outputs
 +
* connected to: $ff02 -> PIA 0 B side Data register
 +
 +
matrix rows '''PA0-PA6''' are:
 +
* configured as inputs
 +
* connected to: $ff00 -> PIA 0 A side Data register
  
  
 
Forum threads:
 
Forum threads:
 
* http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4905
 
* http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=5&t=4905
 +
 +
 +
[[Category:Documentation]] [[Category:Hardware]] [[Category:Software]]

Latest revision as of 14:57, 30 September 2014

Dragon32Keyboard4.JPG


How the keyboard matrix scan work is described in "Inside the Dragon" book on page 198-204.


Dragon 32 keyboard map:

          LSB              $FF02                    MSB
        | PB0   PB1   PB2   PB3   PB4   PB5   PB6   PB7 <- column
    ----|----------------------------------------------
    PA0 |   0     1     2     3     4     5     6     7    LSB
    PA1 |   8     9     :     ;     ,     -     .     /     $
    PA2 |   @     A     B     C     D     E     F     G     F
    PA3 |   H     I     J     K     L     M     N     O     F
    PA4 |   P     Q     R     S     T     U     V     W     0
    PA5 |   X     Y     Z    Up  Down  Left Right Space     0
    PA6 | ENT   CLR   BRK   N/C   N/C   N/C   N/C  SHFT
    PA7 - Comparator input                                 MSB
     ^
     |
    row


CoCo keyboard map:

          LSB              $FF02                    MSB
        | PB0   PB1   PB2   PB3   PB4   PB5   PB6   PB7 <- column
    ----|----------------------------------------------
    PA0 |   @     A     B     C     D     E     F     G    LSB
    PA1 |   H     I     J     K     L     M     N     O     $
    PA2 |   P     Q     R     S     T     U     V     W     F
    PA3 |   X     Y     Z    Up  Down  Left Right Space     F
    PA4 |   0     1     2     3     4     5     6     7     0
    PA5 |   8     9     :     ;     ,     -     .     /     0
    PA6 | ENT   CLR   BRK   N/C   N/C   N/C   N/C  SHFT
    PA7 - Comparator input                                 MSB
     ^
     |
    row

e.g. (Dragon):

  • 'U' $55 -> col: 5 - row: 4
  • 'Y' $59 -> col: 1 - row: 5

If "U" is pressed, then when PB5 of PIA0 is LOW, PA4 of PIA0 will read LOW, else it will read HIGH.

Similarly if "A" is pressed then when PB1 is LOW, PA2 will read LOW, else it will read HIGH.

Each key is just a switch bridging a row and a column - if the column is low, then the row will be pulled low when the key is pressed (the A side of the PIA has an internal pull-up, so in input mode it will read as high if not connected to anything - no key pressed).


matrix columns PB0-PB7 are:

  • configured as outputs
  • connected to: $ff02 -> PIA 0 B side Data register

matrix rows PA0-PA6 are:

  • configured as inputs
  • connected to: $ff00 -> PIA 0 A side Data register


Forum threads: