Unix pages
Home -> UNIX software -> JOYCE -> The PCW keyboard

The PCW Keyboard

Physically, there are three main designs of PCW keyboard:

PCW8256/8512
Grey, function keys between the main block and the number pad.
PCW9512/9512+
White, XT-style layout with function keys on the left.
PCW9256/10
White, but with the 8256/8512 layout.

Electrically, all three keyboard types are identical.

Keycaps

The keyboard layout for keyboards on dot-matrix PCWs (8256, 8512, 9256, 10) is:

Keyboards on daisywheel PCWs (9512, 9512+) have this layout:

There are a few slight differences in the keycaps (for example, "{" and "}" on the dot-matrix keyboard are replaced with "¼" and "¾" on the daisywheel). The CPMKEYS command under CP/M supports both these layouts. If a PCW has a mismatched keyboard connected (eg, an 8256 with a 9512 keyboard) the commands CPMKEYS 8 and CPMKEYS 9 can be used to force a particular keyboard type.

Hardware

Both keyboards use the same controller: an 8048, part number 40027.

Option links

There are three option links on the keyboard PCB:

Connection

The PCW keyboard connector is a 4-pin DIN socket. Seen from the outside of the case, it has this pinout:

Protocol

Unlike a PC keyboard, the PCW keyboard does not send scancodes. Instead, it repeatedly sends the entire keyboard state: 17 words of 12 bits each.

The information in the next two paragraphs, and the timing diagrams, have been superseded by James Ots on Hackaday: PCW Keyboard timings.

I don't know the exact timings used by the keyboard. I've guessed that they're similar to the ones used by the PC1512 keyboard, which isn't too different electrically. The PCW keyboard runs at a slower clock speed, so I have based my estimates on a 6µs quantum rather than 5µs.

By default the Data and Clock lines float high. To send a bit, the keyboard sets the Data line low or high, waits (for ~6µs), pulls Clock low, waits (again, for ~6µs) and then returns both lines to high. Before sending each word, the keyboard toggles Data twice while leaving Clock high. This may be used by the PCW's controller to maintain synchronisation.

Each 12-bit word is sent most significant bit first. The first 4 bits are an offset (0x0 to 0xF); the remaining 8 are a byte, which will be stored in PCW memory at 0x3FF0 plus the offset. As mentioned above, the full keyboard state is 17 words; the first and last words both write to offset 0xF, while the ones in between write to offsets 0, 1, 2, 3, ... , 0xE.

The meaning of the bytes in the keyboard state is:

Bits 11-8Bit 7Bit 6Bit 5Bit 4 Bit 3Bit 2Bit 1Bit 0
0Keypad 2Keypad 3Keypad 6 Keypad 9PasteF1/F2Keypad 0 F3/F4
1Keypad 1Keypad 5Keypad 4 Keypad 8CopyCutPTR Exit
2[+]½ShiftKeypad 7 >Return]Del->
3.?;<P[ -=
4,MKLIO 90
5SpaceNJHYU 78
6VBFGTR S6
7XCDSWE 34
8ZShift LockATabQ Stop21
9<-DelJ1 Fire 1J1 fire 2 J1 rightJ1 leftJ1 down J1 up
AAltKeypad .Keypad EnterF7/F8 [-]CancelExtra F5/F6
BJ2 Fire 1J2 fire 2 J2 rightJ2 leftJ2 down J2 up
C(KP enter)(Space) (KP 0)(Exit)(F1/F2) (F3/F4)
C (if LK2 present)(Shift)(S) (D)(A)(X)(W)
D~LK2Shift Lock LED(Space) (KP 2)(KP 3)(KP 1)(KP .) (KP 5)
ELK3LK1 (never set)(Shift) (Space)(W R P ] ; > . ½) (Q E O [ L < , /) (Z X C V B N M) (A S D F G H J)
FUpdate flagTicker(Shift) (Space)(W R P ] S F X V) (Q E O [ A D Z C) (B N M , . / ½) (H J K L ; < >)
Notes:

Key Matrix

The keyboard matrix is given in the service manual:

RowDB7DB6DB5DB4 DB3DB2DB1DB0
P10Keypad 2Keypad 3Keypad 6 Keypad 9PasteF1/F2Keypad 0 F3/F4
P11Keypad 1Keypad 5Keypad 4 Keypad 8CopyCutPTR Exit
P12[+]½ShiftKeypad 7 >Return]Del->
P13.?;<P[ -=
P14,MKLIO 90
P15SpaceNJHYU 78
P16VBFGTR S6
P17XCDSWE 34
P24ZShift LockATabQ Stop21
P25<-DelKeypad . Keypad EnterF7/F8 [-]Cancel ExtraF5/F6
P26AltJ1 Fire 1 J1 fire 2J1 right J1 leftJ1 down J1 up
P27J2 Fire 1J2 fire 2 J2 rightJ2 leftJ2 down J2 up

Except for two lines, this matrix is identical to the first 12 bytes of the keyboard controller state returned to the PCW. Those two lines (highlighted in the table above) are deliberately swapped by the controller firmware. My guess is that initial development was done with a keyboard that did support joysticks; when these were removed the keyboard matrix was redesigned, but the controller was reprogrammed to swap the two rows to retain compatibility with the old layout.

CP/M Key Numbers

Since the PCW keyboard does not send scancodes, there are no 'key numbers' at the hardware level. CP/M assigns the following key numbers for use by programs such as SETKEYS:

In expanded form:

Key numberKey
0F3/F4
1Keypad 0
2F1/F2
3Paste
4Keypad 9
5Keypad 6
6Keypad 3
7Keypad 2
8Exit
9PTR
10Cut
11Copy
12Keypad 8
13Keypad 4
14Keypad 5
15Keypad 1
16Del->
17]
18Return
19>
20Keypad 7
21Shift
22½
23[+]
24=
25-
26[
27P
28<
29;
30?
31.
320
339
34O
35I
36L
37K
38M
39,
408
417
42U
43Y
44H
45J
46N
47Space
486
49S
50R
51T
52G
53F
54B
55V
564
573
58E
59W
60S
61D
62C
63X
641
652
66Stop
67Q
68Tab
69A
70Shift Lock
71Z
72<-Del
73F5/F6
74Extra
75Cancel
76[-]
77F7/F8
78Keypad Enter
79Keypad .
80Alt

John Elliott 16 March 2011.