Keyboard

From The Dragon Archive
Revision as of 15:05, 3 August 2014 by Jedie (talk | contribs)

Dragon32Keyboard4.JPG


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


Dragon 32 keyboard map:

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

e.g.:

  • '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: