2013-02-23 01:15:03 +09:00
PC98 to USB keyboard protocol converter
=======================================
2021-09-17 14:16:45 +09:00
Main target is TMK prebuilt converter(ATMega32u2) but it will work on dev boards with ATMega32u4.
2013-02-22 09:53:46 +09:00
2021-01-17 15:59:37 +09:00
To initialize keyboard correctly you have to connect keyboard with converter first and then plug them into USB port.
Otherwise, keyboard may not work.
2013-02-22 09:53:46 +09:00
2021-09-18 09:10:28 +09:00
You can buy [TMK prebuilt converter ](https://geekhack.org/index.php?topic=72052.0 ) here to support this project.
2021-09-17 14:16:45 +09:00
2021-09-18 09:10:28 +09:00
Discuss or report issue on github or [this thread ](https://geekhack.org/index.php?topic=110094.0 ).
2021-09-17 14:16:45 +09:00
2013-02-23 01:15:03 +09:00
Connector
---------
2018-07-23 09:53:35 +09:00
On host/converter:
2013-02-22 09:53:46 +09:00
2013-02-23 01:15:03 +09:00
8Pin mini DIN
___ ___
/ |_| \
/ 8 7 6 \
| 5 4 3 |
\_ 2 1 _/
2018-06-07 17:29:13 +09:00
\_____/
2013-02-23 01:15:03 +09:00
(receptacle)
2013-02-22 09:53:46 +09:00
2014-01-04 22:45:52 -05:00
Wiring: You can change this with editing config.h.
2013-02-23 01:15:03 +09:00
2013-02-22 09:53:46 +09:00
Pin mini DIN MCU
----------------------------------
2014-04-25 15:16:12 +09:00
1 ~RST(TXD) PD3
2013-02-22 09:53:46 +09:00
2 GND GND
2013-02-23 01:15:03 +09:00
3 ~RDY PD4
4 RXD PD2
2018-08-19 08:39:41 +09:00
5 ~RTY PD1
2018-06-07 17:29:13 +09:00
6 NC
7 NC
2013-02-22 09:53:46 +09:00
8 5V VCC
2013-02-23 01:15:03 +09:00
2013-02-22 09:53:46 +09:00
Protocol
--------
2014-01-04 22:45:52 -05:00
Signal: Asynchronous, Positive logic, 19200baud, Least bit first
2013-02-23 01:15:03 +09:00
Frame format: 1-Start bit(Lo), 8-Data bits, Odd-Parity, 1-Stop bit
2013-02-22 09:53:46 +09:00
2020-12-09 13:16:03 +09:00
Prebilt Firmware
----------------
Prebuilt firmware HEX files are available under 'binary' directory.
2013-02-22 09:53:46 +09:00
Build Firmware
--------------
2020-12-09 13:16:03 +09:00
Just use 'make' to bild firmware for TMK PC98 converter(ATMega32u2).
2013-02-23 01:15:03 +09:00
2018-07-23 09:53:35 +09:00
$ make clean
2013-02-22 09:53:46 +09:00
$ make
2013-02-23 01:15:03 +09:00
2020-12-09 13:16:03 +09:00
To flash firmware run this command
2018-07-23 09:53:35 +09:00
$ make dfu
2021-09-17 14:16:45 +09:00
then push button on the converter to flash firmware.
2018-07-23 09:53:35 +09:00
2020-12-09 13:16:03 +09:00
If you are using ATMega32u4 based board use following commands to get firmware HEX file.
2018-09-08 09:34:50 +09:00
$ make -f Makefile.32u4 clean
$ make -f Makefile.32u4
2020-12-09 13:16:03 +09:00
And flash it on your board using specific program method.
2018-09-08 09:34:50 +09:00
2018-07-23 09:53:35 +09:00
PC98 Scan Codes
---------------
,---. ,---. ,------------------------. ,------------------------. ,------------------------.
2019-09-05 00:20:32 +09:00
|Stp| |Cpy| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15|
2018-07-23 09:53:35 +09:00
`---' ` ---' `------------------------' ` ------------------------' `------------------------'
,-------------------------------------------------------------. ,-------. ,---------------.
2019-09-05 00:20:32 +09:00
| Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| -| =|JPY|Bspc| |Ins|Del| |Hom|Hlp| -| /|
2018-07-23 09:53:35 +09:00
|-------------------------------------------------------------| |-------| |---------------|
2019-09-05 00:20:32 +09:00
| Tab | Q| W| E| R| T| Y| U| I| O| P| [| ]| | |RUp|RDn| | 7| 8| 9| *|
2018-07-23 09:53:35 +09:00
|-------------------------------------------------------`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|Rig| | 1| 2| 3| =|
`-------------------------------------------------------------' |-------| |---------------|
2019-09-05 00:20:32 +09:00
|Kana|Win|GRP|NFER| Space |XFER| ^2|Win| ^3| | Down | | 0| ,| .| ^1|
2018-07-23 09:53:35 +09:00
`-------------------------------------------------------' ` -------' `---------------'
2019-09-05 00:20:32 +09:00
^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
2018-07-23 09:53:35 +09:00
,---. ,---. ,------------------------. ,------------------------. ,------------------------.
| 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| 4D| 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| 3C| | 4A| 4B| 4C| 4D|
`-------------------------------------------------------------' |-------| |---------------|
| 72 | 77| 73| 51 | 34 | 35 | 79| 78| 5E| | 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
2018-06-07 17:29:13 +09:00
2013-02-23 01:15:03 +09:00
PC98 keyboard commands
2018-06-07 17:29:13 +09:00
----------------------
2013-02-23 01:15:03 +09:00
http://www.webtech.co.jp/company/doc/undocumented_mem/io_kb.txt
2013-02-24 18:10:50 +09:00
2018-06-07 17:29:13 +09:00
response from keyboard:
FAh: ACK
FCh: NACK
2013-02-24 18:10:50 +09:00
Inhibit repeating key:
2018-07-23 09:53:35 +09:00
9Ch, 70h
2018-06-07 17:29:13 +09:00
LED control:
9Dh 7xh
second byte:
0111 xxxx
|||`- NumLock
||`-- ?
|`--- CapsLock
`---- Kana
2018-07-23 09:53:35 +09:00
Enabling Win and App key on PC-9821 keyboard:
95h, 03h
Raku Raku keyboard support
--------------------------
NEC PC-9801-98-S02 - raku raku keyboard:
https://deskthority.net/photos-f62/nec-pc-9801-98-s02-t5212.html
To build firmware for the keyboard
$ make KEYMAP=rakuraku clean
$ make KEYMAP=rakuraku
$ make KEYMAP=rakuraku dfu
Its scan code map is very different from standard types. This is not tested.
Other PC98 converter projects and resource
------------------------------------------
2021-09-18 09:10:28 +09:00
### TMK wiki
- https://github.com/tmk/tmk_keyboard/wiki/PC-9801-Keyboard
2021-09-17 14:16:45 +09:00
2021-09-18 09:10:28 +09:00
### PC-9800シリーズ テクニカルデータブック HARDWARE 編 1993年 p139, p343
- https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n151
- https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n355
2018-08-19 08:39:41 +09:00
2021-09-18 09:10:28 +09:00
### PC98 to USB
- http://davy.nyacom.net/kbd98usb/
2018-07-23 09:53:35 +09:00
2021-09-18 09:10:28 +09:00
### PC98 to PS/2
- http://www.tsp.ne.jp/~sawada/mago/c_gka98at.htm
- http://www.tsp.ne.jp/~sawada/mago/src/gka98at.asm
2018-07-23 09:53:35 +09:00
2021-09-18 09:10:28 +09:00
### Scan code
- http://ixsvr.dyndns.org/usb2pc98
2018-09-08 21:23:30 +09:00
NOTES
-----
### Tested on
- PC-9801V
- DIGITAL WAVE Dboard
### RDY
PC98 host keeps RDY line high to prevent keyboard from sending data while processing.
2021-09-18 09:10:28 +09:00
- https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n359
2018-09-08 21:23:30 +09:00
2021-09-18 09:10:28 +09:00
PC-9801V keyboard requires RDY pulse as acknowledgement from host, it doesn't next data without this. Dboard doesn't need this.
2018-10-15 21:37:52 +09:00
2018-09-08 21:23:30 +09:00
### Inhibit key repeating
The command(9Ch, 70h) works with Raku Raku keybaord but not with Dboard.
### LED indicater
2018-10-15 21:37:52 +09:00
Dboard has LEDs but replys with FA to 9D command but ignore it. The LED indicates just its internal states. Dboard replays with FA to 9C command but it doesn't seem to understand repeat setting.
PC-9801V has no LEDs and doesn't accept LED command. It replys with 9D to 9D command. PC-9801V doesn't accept repeat setting command. It replys with 9C to 9C command.
2021-01-17 15:59:37 +09:00
### PC-9801V
2018-10-15 21:37:52 +09:00
Note that you have to connect this keyboard with converter before plug in USB port. It seems this keyboard requires for host to send any command before starting to send scan code.
2021-01-17 15:59:37 +09:00
### Connection order
Converter doesn't support hotplugging due to limitation of PC-9801 keyboard.
You will have to plug keyboard into converter during without power first, and then plug them into USB port.