Rows and columns
The ACE's 67 keys are wired as an 8 × 8 grid. The AB Controller drives one
row at a time on PA0–PA7 and reads the
columns back on PB0–PB7. Find your key,
read off its row and column, and the small number is the ASCII code the controller sends
when you press it.
|
PB0 | PB1 | PB2 | PB3 |
PB4 | PB5 | PB6 | PB7 |
| PA0 |
`$60 | 1$31 | 2$32 | 3$33 |
4$34 | 5$35 | 6$36 | 7$37 |
| PA1 |
8$38 | 9$39 | 0$30 | -$2D |
=$3D | BKSP$08 | ESC$1B | TAB$09 |
| PA2 |
Q$51 | W$57 | E$45 | R$52 |
T$54 | Y$59 | U$55 | I$49 |
| PA3 |
O$4F | P$50 | [$5B | ]$5D |
\$5C | INS$1A | CAPSignored | A$41 |
| PA4 |
S$53 | D$44 | F$46 | G$47 |
H$48 | J$4A | K$4B | L$4C |
| PA5 |
;$3B | '$27 | ENTER$0D | DEL$7F |
SHIFTmodifier | Z$5A | X$58 | C$43 |
| PA6 |
V$56 | B$42 | N$4E | M$4D |
,$2C | .$2E | /$2F | UP$1E |
| PA7 |
CTRLmodifier | MENUignored | ALTignored | SPACE$20 |
FNignored | LEFT$1C | DOWN$1F | RIGHT$1D |
What the controller does with a press
Letters are always capitals. Shift changes the symbols and the number
row and nothing else — there is no lower case at the machine. It exists over the
serial line, and only there.
Four keys send nothing. Caps Lock, Menu, Alt and Fn are scanned like
every other key and then dropped: no character, no state. Caps Lock in particular is not
a lock, because there is no case for it to switch. The switches are in the grid all the
same — see below.
Ctrl sends a control code. Ctrl+A through
Ctrl+Z send 1 to 26, so Ctrl+C is
$03 (break) and Ctrl+H is $08
(backspace). Ctrl+[ sends $1B, the same code as
Esc.
Esc stops a running program. BASIC checks for it between statements.
It is the key to reach for when something runs away; the reset button above it is the
one for when even that does not answer.
Where the grid comes out of the board
The matrix is on the ACE's KEYBOARD header — a 1 × 16
pin header at 2.00 mm pitch, PA0–PA7 on pins 1–8
and PB0–PB7 on pins 9–16. On a stock ACE the board's
own switches are soldered across it. Anyone enclosing the board leaves those unfitted and
wires an outboard keyboard here instead — same grid, same codes.
The same two VIA ports carry the joysticks. That is why the Kernal disables the encoder
before a raw read and enables it again afterwards, and why reading a stick by hand needs
the KBDisable → read → KBEnable dance.
Scanning it yourself. With the encoders released the sixteen lines are
yours: drive one row low through GPIO_DDRA / GPIO_PORTA, read the
columns on GPIO_PORTB, and a 0 bit is a key held at that
intersection. Eight rows gets all 67 keys as switches, the four ignored ones included.
Give the ports back promptly — the controller cannot hand a character over while you
hold them, and is not scanning the board's own keys either — and remember there are
no diodes: three keys in a rectangle report a phantom fourth.