Introducing the megaboy
A few weeks ago, I was cleaning the kitchen’s under-sink. I found a small white carton box I hadn’t seen in a while, so I opened it. The box contained two Game Boy Colors, a lot of games, and some Game Boy Link cables. I thought I’d given them to a friend years ago, but I hadn’t.

So that Sunday morning, I was staring at the Game Boys. I put a pair of rechargeable AA batteries and a Super Mario cartridge in the Yellow GBC. It started but froze. Tried the green GBC, and the game booted and ran perfectly. I played for a while on the couch while the sun entering through the window warmed my feet.
At one moment, my thoughts flew. What can I build with these? I am not that into gaming; I don’t play any games, and each time someone asks me what I do, I always say “play with the computer”, but playing with the computer for me is more about coding, learning, reading, studying, not actually playing games.
I recalled seeing an Instagram reel of a guy who built a speedometer with a Game Boy (Ref) for his car, so I thought, hmm, my race car runs a Megasquirt 2 with MS2/Extra firmware. It would come in handy if I could see real-time sensor values and add datalogging. Why not live-tune the VE (Volumetric Efficiency) and spark (ignition timing) tables as well?
- Getting started
- Why a bridge?
- The parts
- The bridge software
- The Game Boy side
- First data on the screen
- Moving to the MS2
- What’s next
Getting started
So I jumped straight from the couch into the office. First, what do I need to accomplish this project? Scavenging the drawers, I found one of my bench-testing Megasquirt ECUs, an MS1 one. Not precisely the one I have in the car, but good enough for preliminary testing. Hooked it up to my JimStim and connected it to the Mac using a Prolific PL2303 cable. Fired up TunerStudio and connected it to make sure the thing was working.

From the Game Boy console perspective, I had to understand how the serial data protocol worked, find out the data link port pinout, and discover how to code and install a custom game in a… cartridge, I guess? For the latter, I found that these Game Flash carts have an SD card slot that permits saving Game Boy games onto the SD card and booting them into the console. For the first, the gbdev website came in handy, as well as the GBAlinkport.pdf file from reinerziegler.
I wasn’t that interested in actually coding the visualization/datalogging/tuning tool (from now on, the game), so I delegated that task to Claude, with the prompt:
clod pls code a game for my gameboy color, I’ll be using an EverDrive cart, and the goal is to have full real-time data visualization, data logging, and basic tuning capabilities for Megasquirt MS1 and MS2 ECUs. We will start with MS1 compat, then move to MS2.
I called it megaboy: half MegaSquirt, half Game Boy. Only later did I notice that it is also an anagram of Game Boy.
While Claude was coding, I started to collect the required parts for the bridge.
Why a bridge?
But first: why a bridge at all? There are several moving parts here:
- Different voltages: Megasquirt uses RS232 levels, about +/- 5 to +/- 12 volts, with inverted logic. The Game Boy link port uses 5 volts logic, and, as I later found, some units use 3.3 volts. So first of all, we need to put a MAX232 or MAX3232 chip in the middle to convert voltage levels. But that only adapts the voltage.
- Different serial types: The Megasquirt uses asynchronous UART, 9600 baud (MS1) or 115200 baud (MS2), 8N1, no clock line. Each side times the bits with its own clock. The Game Boy link port is a synchronous shift register with one clock line. A byte moves only when one side drives the clock. The Game Boy hardware has no UART and cannot find the start bits and bit timing of a UART stream.
- What the Game Boy cannot easily do:
- Polling: The Megasquirt sends nothing on its own; it only replies to serial commands such as S, R, etc., and it needs timeouts, gaps between commands, etc. The Game Boy would have to run this request/response loop while it also draws the screen.
- Decoding: the raw values need lookup tables (e.g.
thermfactor,matfactor, MAP tables) and also 32-bit division for RPM, and this is slow AF on the Game Boy CPU. - Tuning safety: I recalled this last, during the table tuning implementation: the bridge should keep a page cache, check write limits, and verify read-back. This is a no-go for the Game Boy CPU and ROM.
- MS2 and datalogging: Megasquirt MS2 uses a different protocol with CRC32 envelopes, and the datalogging feature needs SPI for the SD card and a FAT file system, also a no-go for the Game Boy.
So the bridge should convert the protocol and decode the data. The Game Boy only receives the small decoded frames LINK_T_RT, LINK_T_STATUS, LINK_T_TABLE and sends small commands back. This keeps the ROM small and the display fast.
The parts
But… what is the bridge, in terms of electronic parts? Well,
- A microcontroller: for the Megasquirt 1, an ATmega328 (Arduino Nano, Arduino Uno, etc.) will suffice. For the Megasquirt 2 running at 115200 baud, SD logging, and a real-time clock for the logging data, the ATmega328 falls short (one hardware UART, 2 KB RAM). Since it was Sunday and I only had a few Arduinos, I started with it. In the shopping cart, I added a handful of Raspberry Pi Pico (RP2040). The Pico has two hardware UARTs (no need for SoftwareSerial emulation like in the ATmega328), plenty of RAM (264 KB), and two cores, so I can delegate a whole core for fast datalogging.
- 3-channel bidirectional logic-level shifter: For unknown reasons, I had more than ten 4-channel BSS138 boards, and I only need 3 of the 4 channels. These boards can convert the high-voltage side of the Game Boy to the low-voltage side of the Pico/Arduino.
- A RS232 transceiver: naturally, I would use a classic, rugged MAX232 chip. but the MAX232 runs at 5 V, okay for the Arduino Nano but not okay for the Pico’s 3.3 V lines. A MAX3232 board suits that better, plus the boards already have all the passive components installed as well (such as the capacitors).
- A real-time clock board: I found the DS3231 module a good fit, so I added it to the cart. Of course, I didn’t have a DS3231, but a classic DS1307. The problem? The DS1307, AKA “Tiny RTC” works with 4.5- 5.5 V, but our RP2040 works with 3.3 V. Aside from that, the DS3231 also features a temperature-compensated oscillator on the chip, at about +/- 2 ppm (about 1 minute per year) vs. the external 32 kHz crystal with no temperature compensation on the DS1307. Not a big deal for data logging files, but 🤷🏽.
- SD card module: I bought a cheap SPI module. My version had an AMS1117 voltage regulator, but I removed it and just jumpered the VCC line to 3V3 so I can feed it with 3V3 from the Pico.
- Small parts: a PCB mount, a male DB9 connector, a 1N4007 diode, and two 10k Ohm pull-up resistors.

The bridge software
The final version of the bridge (the RP2040 one, with RTC and datalogging) is about 1,500 lines of bare-metal C on the Pico SDK, plus about 1,000 lines of shared code that the Game Boy ROM also uses: the link protocol, the MS1/MS2 decoders, and the table definitions. No RTOS, no fancy stuff. One big loop on the first core, and another loop on the second core for the SD card. In short: it polls the ECU, converts the MS1 or MS2 data into one common format, sends it to the Game Boy over a bit-banged link, and logs it to the SD card.


Core 0 runs the main loop:
- If the ECU is not connected, it tries again every second. After boot, it waits three seconds before it talks to the ECU, so it doesn’t mess with the ECU while it starts (more on that later).
- It polls real-time data: about 20 Hz on the MS1 (that’s all you get out of 9600 baud) and up to 40 Hz on the MS2.
- It decodes everything into one common struct (
ecu_rt_t). From there on, the code doesn’t care whether the ECU is an MS1 or an MS2. - It queues a real-time frame for the Game Boy and hands the same row to the SD logger.
- Once per second, it reads the RTC and sends the STATUS, TIME, and LOG frames.
- If the Game Boy asked for something (read a table, write a cell, burn, change the ECU type, set the clock, start or stop a log), it runs that command, one at a time.
- Last, it sends one queued byte to the Game Boy (
gb_pump). The bridge drives the link clock, and every byte it sends out also brings one byte back from the Game Boy
The ECU type and the MS2 poll rate live in the last sector of the Pico’s flash, so the bridge remembers them after a power cycle. Until you pick an ECU type on the Game Boy, the bridge doesn’t send a single byte to the ECU.
Core 1 is for logging. Core 0 puts rows and start/stop requests in a queue; Core 1 probes the card, opens files, writes CSV rows, and syncs once per second. SD cards can take their sweet time to answer, and early on, a card probe could freeze the whole bridge for half a second. With all the card work on core 1, a slow card only blocks core 1, and the dash keeps going.


Probably there are better ways to avoid needing a dual-core CPU, but since we had it at hand, why not use it?
The Game Boy side
The game is about 3,600 lines of C, built with GBDK-2020 by Claude. It’s a plain 32 KB Game Boy Color ROM, and it saves its settings on the cart.
The link works the other way around compared to most Game Boy multiplayer games: the Game Boy runs in external clock mode, so the bridge is the one that drives the clock. Each time a byte arrives, an interrupt stores it in a 256-byte ring buffer, loads the next byte the Game Boy wants to send (or a zero if it has nothing to say), and arms the next transfer. The main loop then picks the bytes from the buffer and builds the frames. Each frame starts with 4D 42 (“MB”), and has a type, a length, up to 32 bytes of payload, and a checksum.
On the screen side, there are a few pages:
- DASH: the main gauges.
- BOOST: boost and vacuum in psi.
- TRACK: most of the screen shows RPM, coolant, and intake temperature.
- LOG: start and stop the SD log, and see the file, the time, and the rows per second.
- TUNE: the table editor.
- SETTINGS, CLOCK, and ABOUT: ECU type, poll rate, RTC, versions, and the link state.

The first version was slow. Really slow. The Game Boy CPU (an SM83) has no divide instruction, so just printing a number on the screen took 16-bit and 32-bit divisions in software. On top of that, every field was redrawn on every update, even if the value had not changed. Drawing the dash took about 3.1 frames. Now the number formatting gets digits by subtracting powers of ten, the bars use 16-bit math, and the screen only rewrites the tiles that changed. The dash now draws in about 1.2 frames. This also found a sneaky bug: the main loop counted loop passes as frames, so when the dash took three frames to draw, sound, uptime, and blinking ran three times too slow.
For tuning, you can edit VE, spark, AFR, rev limits, and boost tables. An edit goes to the ECU RAM first; burning it to flash is a separate confirmation. The bridge checks each write against the table’s limits and a maximum step; the Game Boy splits larger changes into smaller writes, and the last one gets read back from the ECU. If it doesn’t match, you get VERIFY FAILED. Rev limits also have ordering rules, so you can’t put the soft limit above the hard limit by mistake. And yes, save a backup MSQ in TunerStudio before playing with this.

First data on the screen
The first end-to-end test was the Nano, the MS1 on the JimStim, and the Game Boy. The Nano also prints the decoded values over USB, in the same format as the ecumon script, so I could compare the numbers on the Mac with the numbers on the Game Boy.

Most of the performance work happened on the bench with the MS1, the Pico, and the ROM running in the PyBoy emulator. The MS1 was dropping commands when the bridge sent the next one right after the last reply byte at about eight timeouts per minute. A 5 ms gap between commands fixed it, with zero timeouts in the next test. After that, the 9600 baud link is the limit since the 39-byte real-time reply alone takes about 41 ms, so the MS1 tops out at about 21 rows per second.
Moving to the MS2
MS2/Extra speaks a different protocol at 115200 baud. Each request and reply goes in an envelope with a length and a CRC32, so at least you know when something got corrupted on the wire. The table layouts come from the comms332m2 INI file, and the VE table is 16x16 instead of the MS1’s 12x12.

The MS2 had an interesting surprise. During reset, the RP2040 pulls its UART TX pin low. The MAX3232 turns that into a BREAK on the serial line, and if the ECU boots at the same time, it stays in its serial monitor. So when I connected the bridge over serial to the car, the fuel pump didn’t prime and the engine didn’t start, even though all the wiring looks right. The fix is a 10k pull-up on the TX pin, plus the firmware drives the pin high as its very first step and leaves the ECU alone for the first three seconds.
What’s next
The ROM is full. The game fits in 32 KB without banking, and after the TRACK page there are only about 455 bytes left. The next step is to move the screens into switchable ROM banks, so there is room for new features.
The code is available on GitHub: reynico/megaboy
Older: Hack your already hacked devices