Skip to content

PC 9801 Keyboard

hasu@tmk edited this page Feb 25, 2024 · 63 revisions

TMK PC98-USB Converter

The converter allows PC98 keyboard to be connected to modern computer with USB interface.

Buy prebuilt converter here to support: https://geekhack.org/index.php?topic=72052.0

Discussion thread: https://geekhack.org/index.php?topic=110094.0

Firmware source code

https://github.com/tmk/tmk_keyboard/tree/master/converter/pc98_usb

Keymap Editor

https://www.tmk-kbd.com/tmk_keyboard/editor/unimap/?pc98_usb

Default mapping:

,---.,---. ,------------------------.,------------------------.    ,------------------------.
|   ||PrS| | F1 | F2 | F3 | F4 | F5 || F6 | F7 | F8 | F9 | F10|    | F11| F12| F13| F14| F15|
`---'`---' `------------------------'`------------------------'    `------------------------'
,-------------------------------------------------------------.   -------.  ,---------------.
| Esc|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|JPY|Bspc|  |Ins|Del|  |Hom|End|  -|  /| 
|-------------------------------------------------------------|  |-------|  |---------------|
| Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|      |  |PgD|PgU|  |  7|  8|  9|  *| 
|-------------------------------------------------------`Enter|  |-------|  |---------------|
|Ctl|Cap|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|  \|     |  |  Up   |  |  4|  5|  6|  +| 
|-------------------------------------------------------------|,-----------.|---------------|
| Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /| RO| Shift ||Lef|Mut|Rig||  1|  2|  3|  =| 
`-------------------------------------------------------------|`-----------'|---------------|
    |Kana|Gui|Alt|MHEN|       Space              |HENK|Gui|App|  | Down  |  |  0|  ,|  .|Ent| 
    `---------------------------------------------------------'  `-------'  `---------------'

Stop key is assigned to Magic key.

Connection order

Converter doesn't support hotplugging basically due to limitation of PC-9801 keyboard. You will have to connect keyboard with converter first, and then plug them into USB port.

PC-9801V requires for host to send any command before starting to send scan code.

Key repeating

Key repeating is controlled by PC98 keyboard basically. This means changing repeating rate on host won't work well.

Some of newer PC98 keyboards have 'inhibit key repeating' feature.

PC98 Keyboard Protocol

Interface

On host/converter:
    8Pin mini DIN
       ___ ___
      /  |_|  \
     / 8  7  6 \
    | 5    4  3 |
     \_ 2   1 _/
       \_____/
     (receptacle)

    Pin mini DIN        AVR Pins on TMK converter
    ---------------------------------------------
    1  ~RST(TXD)        PD3
    2   GND             GND
    3  ~RDY             PD4
    4   RXD             PD2
    5  ~RTY             PD1
    6   NC
    7   NC
    8   5V              VCC

The converter doesn't need external pull-up resisters usually but having them on all of four lines won't hurt and can avoid unexpected behaviour at powerup phase.

TODO: Check keyboard and host side schematic.

Signal

Asynchronous, Positive logic, 19200baud, Least bit first

  • DATA - high at idle
  • ~RDY - 0:Ready
  • ~RTY - 0:Resend
  • ~RST - 0:Reset

Data format: 1 start bit, 8 data bit, odd parity, 1 stop bit

RDY

PC98 host keeps RDY line high to prevent keyboard from sending data while processing.

PC-9801V keyboard requires RDY pulse as acknowledgement from host, it doesn't next data without this. Dboard doesn't need this.

https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n359

Commands

http://www.webtech.co.jp/company/doc/undocumented_mem/io_kb.txt

response from keyboard:

    FAh: ACK
    FCh: NACK
    FBh: Not Ready?(Undocumented)

FBh: https://geekhack.org/index.php?topic=110094.msg3164367#msg3164367

Apparently, you need to receive extra byte when receiving FBh response. Confirmed with PC-9801-119(CMP-6D1Y7). https://geekhack.org/index.php?topic=110094.msg3164441#msg3164441

LED control

9Dh 7xh

second byte:
0111 xxxx
     |||`- NumLock
     ||`-- ?
     |`--- CapsLock
     `---- Kana
  • Dboard has LEDs and replies with FA to 9D command but ignore it. The LED indicates just its internal states.
  • PC-9801V has no LEDs and doesn't accept LED command. It replys with 9D to 9D command.

Inhibiting key repeating

0x9C 0x70

This inhibits some keyboards from repeating keys.

Old keyboards do not recognize the command at all, some reply with ACK but cause no effect.

  • PC-9801V keyboard does not support the command, it just replies with same code(0x9C).
  • Dboard sono1 recognizes the command but it does not stop repeating. It applies with 0xFA(ACK) even to unsupported command apparently.
  • Raku Raku keybaord supports this.

This inhibiting feature seems to be supported only by newer keyboards.

Enabling Windows/Menu key

0x95 0x03

This enables Windows and Menu key on PC-9821 keyboards. Confirmed with PC-9801-119(CMP-6D1Y7).

PC-9801V: Not supported
TMK:b604da/LUFA:d6a7df

Keyboard Type: s9F r009F [OLD]
Inhibit Repeat: s9C r009C 
Enable Winkey: s95 r0095 
USB configured.
Dboard sono1: Seems to recognze but without Windows key
TMK:b604da/LUFA:d6a7df

Keyboard Type: s9F rFFFF [OLD]
Inhibit Repeat: s9C r00FA s70 r00FA 
Enable Winkey: s95 r00FA s03 r00FA 
USB configured.

CMP-6D1Y7: New type and Windows key is enabled

TMK:6a6c07/LUFA:d6a7df

Keyboard Type: s9F r00FA r00A0 r0080 [NEW]
Inhibit Repeat: s9C r00FA s70 r00FA
Enable Winkey: s95 r00FA s03 r00FA
USB configured.

https://geekhack.org/index.php?topic=110094.msg3164146#msg3164146

Scan Codes

PC-9801

,---.,---. ,------------------------.,------------------------.    ,------------------------.
| 60|| 61| | 62 | 63 | 64 | 65 | 66 || 67 | 68 | 69 | 6A | 6B |    | 52 | 53 | 54 | 55 | 56 |
`---'`---' `------------------------'`------------------------'    `------------------------'
,-------------------------------------------------------------.  ,-------.  ,---------------.
| 00 | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E |  | 38| 39|  | 3E| 3F| 40| 41|
|-------------------------------------------------------------|  |-------|  |---------------|
|  0F  | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B|      |  | 36| 37|  | 42| 43| 44| 45|
|-------------------------------------------------------`  1C |  |-------|  |---------------|
| 74| 71| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28|     |  |   3A  |  | 46| 47| 48| 49|
|-------------------------------------------------------------|,-----------.|---------------|
|   70    | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 70/7D || 3B| 5E| 3C|| 4A| 4B| 4C| 4D|
`-------------------------------------------------------------'`-----------'|---------------|
    | 72 | 77| 73| 51 |        34                | 35 | 78| 79|  |   3D  |  | 4E| 4F| 50| 1C|
    `---------------------------------------------------------'  `-------'  `---------------'
5E: HOME on PC98XL keyboard
79: ALT on DIGITAL WAVE Dboard
77,78,79: Left Win, right Win and Application on PC-9821 keyboard

,---.,---. ,------------------------.,------------------------.    ,------------------------.
|Stp||Cpy| | F1 | F2 | F3 | F4 | F5 || F6 | F7 | F8 | F9 | F10|    | F11| F12| F13| F14| F15|
`---'`---' `------------------------'`------------------------'    `------------------------'
,-------------------------------------------------------------.   -------.  ,---------------.
| Esc|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|JPY|Bspc|  |Ins|Del|  |Hom|Hlp|  -|  /|
|-------------------------------------------------------------|  |-------|  |---------------|
| Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|      |  |RUp|RDn|  |  7|  8|  9|  *|
|-------------------------------------------------------`Enter|  |-------|  |---------------|
|Ctl|Cap|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|  \|     |  |  Up   |  |  4|  5|  6|  +|
|-------------------------------------------------------------|,-----------.|---------------|
| Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /| RO| Shift ||Lef| ^3|Rig||  1|  2|  3|  =|
`-------------------------------------------------------------|`-----------'|---------------|
    |Kana|Win|GRP|NFER|       Space              |XFER|Win| ^2|  | Down  |  |  0|  ,|  .| ^1|
    `---------------------------------------------------------'  `-------'  `---------------'
^1: Enter on keypad is identical to Enter on alphanumeric portion
^2: ALT on DIGITAL WAVE Dboard while Menu on PC-9821 keyboard
^3: HOME on PC98XL keyboard
^4: CAPS and Kana are locking keys, either mechanically or by firmware emulation

PC-PTOS KBDP03 PC-9801-114

Not confirmed.

,-------------------------------------------------------------------------------------------.
| 73| 62| 63| 64| 65| 66| 67| 68| 69| 6A| 6B| 52| 53| 54| 55| 56| 36| 37|   |   |   |   |   |
`-------------------------------------------------------------------------------------------'
,-------------------------------------------------------------. ,-------.  ,-------------------.
| 00 | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E | | 38| 39|  | 3F| 3E| 61| 40| 60|
|-------------------------------------------------------------| |-------|  |-------------------|
|  0F  | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B|      | |   3A  |  | 42| 43| 44|   | 41|
|-------------------------------------------------------`  1C | |-------|  |-------------------|
| 74| 71| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28|     | | 3B| 3C|  | 46| 47| 48|   | 45|
|-------------------------------------------------------------| |-------|  |-------------------|
|   |  70 | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 70/7D | |   3D  |  | 4A| 4B| 4C|   | 4D|
|-------------------------------------------------------------| |-------|  |-----------| 1C|---|
|   |       |   51  |     34    |   35  |       |   72    |   | |       |  | 4E| 4F| 50|   | 49|
`-------------------------------------------------------------' `-------'  `-------------------'

,-------------------------------------------------------------------------------------------.
|FNC| F1| F2| F3| F4| F5| F6| F7| F8| F9|F10|F11|F12|F13|F14|F15|F16|F17|F18|F19|F20|F21|F22|
`-------------------------------------------------------------------------------------------'
,-------------------------------------------------------------. ,-------.  ,-------------------.
| Esc|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  ^|JPY|Bskp| |Skp|Rst|  |Hlp|Hom|Cpy|  =|Stp|
|-------------------------------------------------------------| |-------|  |-------------------|
| Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  @|  [|      | |  Up   |  |  7|  8|  9| II|  /|
|-------------------------------------------------------`Enter| |-------|  |-------------------|
|Ctl|Cap|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  :|  ]|     | |Lef|Rig|  |  4|  5|  6|  I|  *|
|-------------------------------------------------------------| |-------|  |-------------------|
|SW1|Shift|  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /| RO| Shift | | Down  |  |  1|  2|  3|   |  -|
|-------------------------------------------------------------' |-------|  |-----------|Ent|---|
|SW2| Eisu  | MHEN  |    Space  | HENK  | HIRA  | KANA    |Z/H| | Exec  |  |  0|000|  .|   |  +|
`-------------------------------------------------------------' `-------'  `-------------------'

PC98 Keyboards

Digital Wave Dboard sono1

The keyboard has slide switch on right side to select between three modes. Two of them for NICOLA(Thumb-shift) and the last one is JIS.

In NICOLA modes the two space bars in the center are hard-coded for Thumb-shift Japanese input and it is impossilbe to remap them. The right sapce bar acts just as sapce and it can be remapped. Unless you use this keyboard for Japanese input these modes won't be useful for you.

In JIS mode all of the three space bars act just as space. They are logically identical key, you can remap them but all of them act in same way.

PC9801-116

Key legend difference with PC-9801-106:

PC9801-116 PC98
End HELP
Page Up ROLL DOWN
Page Down ROLL UP
Pause STOP
変換 XFER
Alt GRPH
Print Screen COPY
F11 vf1
F12 vf2

These keys are specific to PC-9801-116. Scan codes for them are unknown.(TODO)

  • 右CTRL
  • Num Lock
  • 右Atl
  • 半角/全角
  • Scroll Lock

https://support.nec-lavie.jp/support/product/data/spec/acb/95070008-2.html

References

Other Conveters