If all goes well, I will soon be the owner of an NEC PC-8801mkII “Model 30.” The platform is famous in Japan, as later models of the PC88 featured a ton of independent games, including many from developers who would go on to create games that were popular worldwide (Thexder, Snatcher and Ys all got their start on this platform). It also has a lot of trash, but neither of these things are interesting to me right now. I’d be happier just getting the computer to work (not least, because as a non-SR mkII, there are very few games I can enjoy on it anyway).
When I was shopping, there were almost no PC88 keyboards available. There were lots of PC98 keyboards for sale, and I got quite a few of those, but the PC88 is becoming thin on the ground. What’s more, its keyboards seem to be prized by mechanical-keyboard aficionados for having Alps switches, so there are probably thousands of them in some guy’s closet next to some Symbolics “space cadet” Lisp-machine keyboards.
Things are further complicated by the fact that there are apparently multiple PC-88 keyboards, with incompatible connectors:
- 8801mkII to FR/MR (13-pin DIN)
- 8801FH/MH and onwards (“Type-A”)
- 88VA (“Type-B”)
- On the “post-FH” PC-88, the keyboard connection moves to a serial bus and a 5-pin mini-DIN connector. There are some details on the serial protocol and the revised keycode table, but this article won’t go into it because if you have an FH+, I’m very jealous.
- It appears that all-non-B keyboards can be toggled via an on-board switch to work with the VA, which probably changes the serial protocol or something.
- Type-C through Type-G also exist and also seem to be compatible with all FH+ machines.
What is there to do? This entry covers the initial research I have made to build an adapter from a more common breed of keyboard (USB or PS/2, haven’t decided which) so that my PC-8801mkII can be used. Hopefully in the future, it will also serve to help someone else revive an ancient machine instead of just throwing it in the trash because they can’t find a keyboard.
Future entries will go into the construction of the adapter, assuming I can’t locate a compatible keyboard.
All of these other adapters have been developed by Koichi Nishida, and the links below go to the archives of those pages.
- USB -> 8801mkII keyboard adapter. AVR assembly.
- USB -> 8801 mkII keyboard adapter 2 a revised version from the same author.
- Windows -> USB -> 8801mkII keyboard adapter. Same developer as above, with C++ source code.
As stated here, the PC-88 keyboard is not like modern, normal keyboards. For a keyboard like you would see on an Amiga, a Macintosh or a PS/2-equipped IBM PC, the keyboard and the computer usually communicate bidirectionally over a serial protocol. This keeps the pins down, and the extra microcontroller added to the keyboard isn’t that big of a deal in the long run, price-wise.
However, the PC-8001, the PC88’s ancestor, is from late 1979. It only has a 4MHz Z80; your average keyboard controller from the late 80s (such as the Amiga’s 6502-based MOS 6570-36) has way more beef than the main processor! I guess NEC decided that since they were the sole source of the keyboards, they might as well just build them as cheaply as possible. In fact, the PC-8001 (and earliest PC-8801s) had hardwired keyboards.
What this means in practice is that the PC88 itself does the key reading. The keyboard connector has 13 pins (14 if you count the ground sleeve), and in order to read a key, the computer triggers four of those pins. A multiplexer on the keyboard uses those four lines to activate the appropriate row on the keyboard matrix, and eight lines are triggered in response to tell the computer which keys on that row are pressed.
- What are the patterns of the four lines?
- Are they brought low or pulled high to signal a “1?”
- Is an off-the-shelf hobbyist-friendly microcontroller like the Atmel Atmega fast enough to respond and satisfy the PC88?
One assumption I have made, before having access to the actual machine, is that the keyboard matrix must follow the memory layout. It doesn’t make a lot of sense for it to be any other way, which brings us to…
Keyboard Layout in Memory
In order to determine the keyboard layout in memory, I looked at the source code of the popular M88 PC88 emulator. It has both a PC98 and a regular IBM PC 104-key keymap in
win32/WinKeyIF.cpp, but the structure that is generated in the end looks about the same.
There are 14 ‘rows,’ which seems to indicate that all four bits are needed (24 = 16).
|0b||Roll Down||Roll Up|
There is also an additional row (0x0e) for the PC-88 FH, which is described here: I/O Map. I don’t know what 0x0f would do, it might be a special code to make the keyboard do something, if anything at all.
I don’t know why they chose ABCDEF instead of QWERTY (as the PC98 does) in this memory map. Seems like you would have to wire the keyboard in a very strange way so that the ‘rows’ of the matrix are alphabetical. It makes more sense to me that you would wire it based on the physical layout of the keyboard, but perhaps the software team finished their work before the hardware guys started on the keyboard PCB.
- How do we map all these accelerators? The PC 104-key keyboards don’t really have a great equivalent for “変換”
For now, I think I will try to source an official keyboard.
If that doesn’t work, I’ll build the adapter that I found on Japanese Google up above. If that doesn’t work out, I’ll have to port their basic strategy to a different kind of adapter. In the meantime, this might be the only English-language information about the early PC88 keyboard, so hopefully it will help someone else.
This article is surprisingly popular, and I’m trying to keep it up to date so that it remains useful to people.
- November 29, 2021: Changed links to Nishida-san’s keyboard adapters to use archive.org instead of the original links. Fixed some typos.