]> git.friedersdorff.com Git - max/tmk_keyboard.git/blob - converter/pc98_usb/REDME.md
pc98_usb: Add RDY pulse in response receive #666
[max/tmk_keyboard.git] / converter / pc98_usb / REDME.md
1 PC98 to USB keyboard protocol converter
2 =======================================
3 Target MCU is ATMega32u2 but other USB capable AVR will also work.
4
5 To initialize keyboard correctly you have to connect keyboard with converter first and then plug them into USB port.
6 Otherwise, keyboard may not work.
7
8
9 Connector
10 ---------
11 On host/converter:
12
13     8Pin mini DIN
14        ___ ___
15       /  |_|  \
16      / 8  7  6 \
17     | 5    4  3 |
18      \_ 2   1 _/
19        \_____/
20      (receptacle)
21
22
23 Wiring: You can change this with editing config.h.
24
25     Pin mini DIN        MCU
26     ----------------------------------
27     1  ~RST(TXD)        PD3
28     2   GND             GND
29     3  ~RDY             PD4
30     4   RXD             PD2
31     5  ~RTY             PD1
32     6   NC
33     7   NC
34     8   5V              VCC
35
36
37
38
39 Protocol
40 --------
41 Signal: Asynchronous, Positive logic, 19200baud, Least bit first
42 Frame format: 1-Start bit(Lo), 8-Data bits, Odd-Parity, 1-Stop bit
43
44
45
46 Prebilt Firmware
47 ----------------
48 Prebuilt firmware HEX files are available under 'binary' directory.
49
50
51
52 Build Firmware
53 --------------
54 Just use 'make' to bild firmware for TMK PC98 converter(ATMega32u2).
55
56     $ make clean
57     $ make
58
59 To flash firmware run this command
60
61     $ make dfu
62
63 then push button on converter to flash firmware.
64
65 If you are using ATMega32u4 based board use following commands to get firmware HEX file.
66
67     $ make -f Makefile.32u4 clean
68     $ make -f Makefile.32u4
69
70 And flash it on your board using specific program method.
71
72
73
74 PC98 Scan Codes
75 ---------------
76     ,---. ,---. ,------------------------. ,------------------------. ,------------------------.
77     |Stp| |Cpy| | F1 | F2 | F3 | F4 | F5 | | F6 | F7 | F8 | F9 | F10| | F11| F12| F13| F14| F15|
78     `---' `---' `------------------------' `------------------------' `------------------------'
79     ,-------------------------------------------------------------. ,-------.  ,---------------.
80     | Esc|  1|  2|  3|  4|  5|  6|  7|  8|  9|  0|  -|  =|JPY|Bspc| |Ins|Del|  |Hom|Hlp|  -|  /|
81     |-------------------------------------------------------------| |-------|  |---------------|
82     | Tab  |  Q|  W|  E|  R|  T|  Y|  U|  I|  O|  P|  [|  ]|      | |RUp|RDn|  |  7|  8|  9|  *|
83     |-------------------------------------------------------`Enter| |-------|  |---------------|
84     |Ctl|Cap|  A|  S|  D|  F|  G|  H|  J|  K|  L|  ;|  '|  \|     | |  Up   |  |  4|  5|  6|  +|
85     |-------------------------------------------------------------| |-------|  |---------------|
86     | Shift   |  Z|  X|  C|  V|  B|  N|  M|  ,|  .|  /| RO| Shift | |Lef|Rig|  |  1|  2|  3|  =|
87     `-------------------------------------------------------------' |-------|  |---------------|
88        |Kana|Win|GRP|NFER|       Space        |XFER| ^2|Win| ^3|    | Down  |  |  0|  ,|  .| ^1|
89        `-------------------------------------------------------'    `-------'  `---------------'
90     ^1: Enter on keypad is identical to Enter on alphanumeric portion
91     ^2: ALT on DIGITAL WAVE Dboard while Menu on PC-9821 keyboard
92     ^3: HOME on PC98XL keyboard
93     ^4: CAPS and Kana are locking keys, either mechanically or by firmware emulation
94
95
96     ,---. ,---. ,------------------------. ,------------------------. ,------------------------.
97     | 60| | 61| | 62 | 63 | 64 | 65 | 66 | | 67 | 68 | 69 | 6A | 6B | | 52 | 53 | 54 | 55 | 56 |
98     `---' `---' `------------------------' `------------------------' `------------------------'
99     ,-------------------------------------------------------------. ,-------.  ,---------------.
100     | 00 | 01| 02| 03| 04| 05| 06| 07| 08| 09| 0A| 0B| 0C| 0D| 0E | | 38| 39|  | 3E| 3F| 4D| 41|
101     |-------------------------------------------------------------| |-------|  |---------------|
102     |  0F  | 10| 11| 12| 13| 14| 15| 16| 17| 18| 19| 1A| 1B|      | | 36| 37|  | 42| 43| 44| 45|
103     |-------------------------------------------------------`  1C | |-------|  |---------------|
104     | 74| 71| 1D| 1E| 1F| 20| 21| 22| 23| 24| 25| 26| 27| 28|     | |   3A  |  | 46| 47| 48| 49|
105     |-------------------------------------------------------------| |-------|  |---------------|
106     |   70    | 29| 2A| 2B| 2C| 2D| 2E| 2F| 30| 31| 32| 33| 70/7D | | 3B| 3C|  | 4A| 4B| 4C| 4D|
107     `-------------------------------------------------------------' |-------|  |---------------|
108        | 72 | 77| 73| 51 |        34          | 35 | 79| 78| 5E|    |   3D  |  | 4E| 4F| 50| 1C|
109        `-------------------------------------------------------'    `-------'  `---------------'
110     5E: HOME on PC98XL keyboard
111     79: ALT on DIGITAL WAVE Dboard
112     77,78,79: Left Win, right Win and Application on PC-9821 keyboard
113
114
115
116 PC98 keyboard commands
117 ----------------------
118 http://www.webtech.co.jp/company/doc/undocumented_mem/io_kb.txt
119
120 response from keyboard:
121     FAh: ACK
122     FCh: NACK
123
124 Inhibit repeating key:
125     9Ch, 70h
126
127 LED control:
128     9Dh 7xh
129
130     second byte:
131     0111 xxxx
132          |||`- NumLock
133          ||`-- ?
134          |`--- CapsLock
135          `---- Kana
136
137 Enabling Win and App key on PC-9821 keyboard:
138     95h, 03h
139
140
141
142 Raku Raku keyboard support
143 --------------------------
144 NEC PC-9801-98-S02 - raku raku keyboard:
145 https://deskthority.net/photos-f62/nec-pc-9801-98-s02-t5212.html
146
147 To build firmware for the keyboard
148
149     $ make KEYMAP=rakuraku clean
150     $ make KEYMAP=rakuraku
151     $ make KEYMAP=rakuraku dfu
152
153 Its scan code map is very different from standard types. This is not tested.
154
155
156
157 Other PC98 converter projects and resource
158 ------------------------------------------
159 PC-9800シリーズ テクニカルデータブック HARDWARE 編 1993年 p139, p343
160 https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n151
161 https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n355
162
163 PC98 to USB
164 http://davy.nyacom.net/kbd98usb/
165
166 PC98 to PS/2
167 http://www.tsp.ne.jp/~sawada/mago/c_gka98at.htm
168 http://www.tsp.ne.jp/~sawada/mago/src/gka98at.asm
169
170 scan code:
171 http://ixsvr.dyndns.org/usb2pc98
172
173
174
175 NOTES
176 -----
177 ### Tested on
178 - PC-9801V
179 - DIGITAL WAVE Dboard
180
181
182 ### RDY
183 PC98 host keeps RDY line high to prevent keyboard from sending data while processing.
184
185 https://archive.org/stream/PC9800TechnicalDataBookHARDWARE1993/PC-9800TechnicalDataBook_HARDWARE1993#page/n359
186
187 PC-9801V keyboard requires RDY pulse as acknowledgement from host, it doesn't next data without this. Dboard doens't need this.
188
189
190 ### Inhibit key repeating
191 The command(9Ch, 70h) works with Raku Raku keybaord but not with Dboard.
192
193 ### LED indicater
194 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.
195
196 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.
197
198
199 ### PC-9801V
200 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.
201
202
203 ### Connection order
204 Converter doesn't support hotplugging due to limitation of PC-9801 keyboard.
205 You will have to plug keyboard into converter during without power first, and then plug them into USB port.