Emulating the X68000 Keyboard Matrix with a Microcontroller for Diagnostics
The Sharp X68000 keyboard relies on a 12×8 switch matrix scanned by a dedicated controller IC. When a key is pressed, the controller detects the intersection of a driven row and a sensed column, then translates that into a scan code sent over a serial-style protocol to the host. Because the matrix is scanned in software-controlled intervals, faults in the wiring, the membrane, or the controller chip can manifest as missing keys, stuck keys, or phantom presses.
Emulating the matrix with a microcontroller lets you bypass the physical keyboard entirely. By driving the row lines and pulling the column lines low at the right moments, a small board can pretend to be any key you want. If a keypress injected by your emulator reaches the X68000 cleanly, you have proven that everything downstream of the connector works. This is enormously useful when trying to decide whether a fault lies in the keyboard, the cable, or the mainboard's keyboard port.
For Australian collectors, this kind of tool has real practical value. The X68000 was never sold through retail channels here, so most machines arrive as imports from Japan. Cables and connectors are decades old, and humidity cycles in coastal cities like Sydney and Brisbane accelerate corrosion on the DIN-style plug. Having a way to test the mainboard independently of any suspect keyboard saves hours of guesswork.
Understanding the X68000 Keyboard Matrix
The keyboard PCB hosts the 96-key matrix along with the controller that drives it. Twelve row lines are pulsed one at a time while eight column lines are monitored for a low signal, and any active intersection is reported as the currently pressed key. The controller also handles the bidirectional protocol over the keyboard cable, including reset, LED indicators, and a handful of diagnostic commands the BIOS sends at boot.
Because the controller manages both row driving and column sensing internally, you cannot easily tap into the matrix without bypassing the chip entirely. Emulation means unplugging that controller from the equation and replacing its behaviour with firmware on your own board. This is otherwise difficult to do without cutting traces on the original keyboard PCB, which is irreversible.
Pinout diagrams are well documented in Japanese service manuals. The matrix lines can be identified by tracing the membrane or following the controller datasheet, and several online repositories maintain errata sheets for the keyboard revisions that shipped with later X68000 models. For an emulator, you do not need to use the original connector at all; you can wire directly to the matrix test points or build a small adapter that goes between the mainboard and the original keyboard.
Why Emulation Helps for Diagnostics
A working emulator lets you isolate faults in a systematic way. Connect only the emulator to the mainboard and confirm that the BIOS responds to your injected keystrokes. If it does, the mainboard is healthy. If it does not, the fault is in the mainboard's keyboard port, its controller IC, or the connector itself. From there you can reconnect the original keyboard through a bypass adapter so that the emulator drives the rows while the keyboard's columns are still read, narrowing the fault further with each step.
I built my first emulator after chasing a phantom "XF3" key on a machine that turned out to have a cracked solder joint under the keyboard connector on the mainboard. The repair was a five-minute job once I knew which joint to reflow, and the emulator went into the toolbox permanently. Speaking of which, if you are working on the power supply side of these machines at the same time, the power supply replacement guide walks through a Mean Well swap that has saved many X68000s in this part of the world.
For Australian collectors this matters beyond convenience. Importing replacement keyboards from Japan is slow and increasingly expensive, and the second-hand market rarely turns up clean units. Being able to confirm that a faulty keyboard is the only thing wrong with an otherwise working machine can be the difference between a sale and a parts donor. Many collectors I know in Melbourne and Adelaide will not buy a "keyboard not working" listing without first borrowing a matrix emulator to confirm the mainboard itself is sound.
Selecting a Microcontroller for the Job
Picking the right microcontroller comes down to how fast you can toggle pins, how many GPIOs you actually need, and how comfortable you are writing firmware. The matrix needs 12 row outputs and 8 column inputs, which is 20 pins minimum. Most builders also use a pin for clock or handshaking, so 22 to 24 usable GPIOs is a comfortable target.
A Teensy 4.0 or 4.1 is often the first choice for retro hardware projects because its ARM Cortex-M7 core can toggle pins in just a few nanoseconds. You can scan the matrix faster than the original controller ever did, which means the X68000 sees your emulated keypresses as perfectly valid. The Teensy also has built-in USB HID support, handy if you want the same board to act as a USB adapter later.
A Raspberry Pi Pico is a strong alternative if you prefer MicroPython or want to use the PIO state machines. PIO precisely times the row and column scanning without CPU intervention, freeing the cores for protocol handling. Both boards are readily available in Australia from Core Electronics in Melbourne or RS Components locally, often with next-day delivery to major cities. An Arduino Mega works in a pinch but its 8-bit AVR core is slow enough that you may need careful assembly to hit the timing windows reliably.
| Microcontroller | Usable GPIOs | Scan Speed | Firmware Complexity | Local Stockists |
|---|---|---|---|---|
| Teensy 4.1 | 40+ | Very high | Moderate | Jaycar, Core Electronics |
| Raspberry Pi Pico | 26 | High | Low (PIO) | Core Electronics, RS, Jaycar |
| ESP32 DevKit | 30+ | High | Moderate | Jaycar, AliExpress local |
| Arduino Mega 2560 | 54 | Moderate | High (assembly) | Jaycar, hobby stores |
| STM32 Blue Pill | 30+ | Very high | High | RS Components, element14 |
Wiring the Matrix to the Microcontroller
Most builders use a 1N4148 diode on each row line to prevent back-feeding when multiple keys are pressed in the same column. The original hardware uses diodes for exactly this reason, and your emulator should preserve that behaviour or you risk phantom keypresses. A 10kΩ pull-up resistor on each column input keeps the line at logic high when no key is active, mirroring the X68000's internal design.
Cable length matters more than people expect. The mainboard expects the keyboard's clock and data edges to arrive within tight timing windows, and even a metre of ribbon cable can introduce enough capacitance to round off the edges. Keep your flying leads short and twist clock and data pairs together if you are running more than about 30 cm.
If your test rig lives in a humid environment, such as a garage workshop in Darwin during the wet season, conformal coating the finished adapter is a sensible precaution. The salt air along the Queensland coast is just as unkind to homebrew PCBs as it is to the original Japanese hardware. A light spray of MG Chemicals 422B silicone conformal coating is enough to keep moisture off the solder joints without making future rework impossible.
Writing the Firmware to Scan and Inject Keystrokes
The firmware has three core tasks: drive one row low at a time, read the eight column inputs, and report any active intersections as the currently pressed key. The X68000 scan rate is around 100 Hz, so your loop needs to complete a full 12-row sweep in under 10 milliseconds. That is trivial for any modern microcontroller, but the more interesting question is how you decide which keys to inject.
The simplest approach is to hardcode a sequence for a power-on self-test. The X68000 BIOS will, without a keyboard attached, sit at a BASIC prompt. By emulating the keys to type a known sequence such as FILES and then RUN, you can confirm that the mainboard is reading the keyboard port correctly. If the machine responds to your emulated input, the diagnostic is complete.
A more flexible approach exposes the matrix over USB serial so that a host PC can send commands like "press F1 for 200 ms" or "hold SHIFT, press X, release SHIFT". This turns the emulator into a scripted injector you can drive from a terminal running on a laptop beside the X68000. For Australian collectors documenting machines for online sales, scripted sequences can also generate screenshots showing every key working without typing them by hand.
When writing the code, remember that the X68000 expects the keyboard controller to acknowledge certain commands, including reset and LED indicators. You can ignore the LED feedback if you wish, but responding to the reset command cleanly avoids confusing the BIOS when it polls the keyboard at boot. Otherwise the machine may sit through a long startup delay waiting for a response that never comes.
Building a Permanent Test Fixture
A throwaway prototype on a breadboard is fine for one-off diagnosis, but if you maintain multiple machines or support other collectors, a permanent fixture pays for itself quickly. A small PCB with the microcontroller, the diode array, the pull-up resistors, and a labelled mini-DIN jack turns the emulator into a professional-looking tool. Add a USB-C connector for power and programming and the fixture becomes something you can hand to a friend without explaining which wire goes where.
Enclosing the fixture in a 3D-printed case protects the board and gives you somewhere to mount status LEDs. One LED can show the firmware is running, another can blink each time a key is injected, and a third can warn if the emulator detects a wiring fault such as a short between two rows. These little touches make the tool feel finished and trustworthy.
For Australian hobbyists, parts for a permanent fixture are easy to source. PCB fabrication through JLCPCB or PCBWay ships here in about a week, and the passive components are stocked at Jaycar outlets in every major city. A finished fixture typically costs less than a round of beers in a Melbourne pub, which is a fair price for something that has saved me from sending out unworking keyboards to other collectors more than once.
Sharing Diagnostic Routines with the Community
The X68000 hobbyist community is small but remarkably generous with documentation. Once you have a working emulator, publishing the firmware source, the schematic, and a few example diagnostic scripts benefits everyone. Other collectors will adapt your routines to their own machines and you will receive bug reports and improvements in return.
GitHub or similar repositories work well for the firmware, while the X68K.NET site is a sensible home for the higher-level documentation, photos of the build, and notes on what each diagnostic script tests. Pinout diagrams, wiring photos, and the comparison table from earlier are all worth including so that someone rebuilding your project from scratch does not have to guess at any step.
Australian collectors have a particular advantage when it comes to this kind of community work. Our timezone sits between Japan and Europe, which means we can hand off debugging sessions to either side of the world depending on the time of day. Several Melbourne-based collectors host workshops at local retro computing meets where these diagnostic tools get demonstrated, and a permanent emulator fixture is a great item to show off.
If you have built a matrix emulator or have diagnostic scripts you would like to share, post your firmware and notes to your own site or to one of the active X68000 forums. Link back to the X68K.NET power supply guide if you have also tackled the Mean Well conversion, and credit anyone whose original firmware you adapted. The X68000 will keep running as long as the people who care about it keep trading knowledge, and a few dozen lines of well-commented microcontroller code are a meaningful contribution to that ongoing project. Browse the projects section of x68k.net for more ideas, and feel free to drop a note if you would like to coordinate on future diagnostic tools.
Nereid-X Expansion Board
A personally-produced LAN+USB+Memory expansion board for Sharp X68000 series computers. Multiple production runs were offered, including a final batch and a later revival reproduction run.
Power Supply Repair
X68 power supply repair and modification services were offered by the site owner, with documentation shared through diary entries spanning 2001–2006.
Server & Networking
Notes on FreeBSD administration, ISP changes, server migration, and networking topics. The site itself ran on FreeBSD with the hns diary system and Namazu search integration.
Get in touch
X68K.NET connects Sharp X68000 enthusiasts through community links and shared projects. Reach out with questions about the Nereid project or X68 resources.