“It took a while, but I finally managed to create my own Game Boy cartridge. With WiFi! At this point, it can only demo a simple telnet-style communication and access Wikipedia articles, but I am confident that I will showcase more in the future. For now, the interesting and surprisingly tricky part is how the thing works at all.
If you just want to see the cartridge in action or want to get into all the details, I highly recommend to watch the video first as it goes through the difficulties and their respective solutions. In contrast, this article here is less visual in its explanations and mostly documents the device in detail, so unless you are already familiar with the parallel memory interface of the Game Boy, you might want to start with the overview from the video.
What it does
Before you waste your time with this article, I should probably make clear what this cartridge can do and, maybe more importantly, what it cannot do. This is a basic 32kiB Game Boy cartridge with an ESP8266 microcontroller to add Wifi capabilities. With this, you can access data from the internet or your local network on your Game Boy or send data from it. Since the ESP8266 can do a lot of preprocessing for the Game Boy, a Twitter client is just as conceivable as a Reddit browser. If you implement one. This is not a generic browser, but you can relatively easily implement services on the ESP8266 and write simple code that is executed on the Game Boy as an interface.
At the time of writing this article, I have only implemented two demos: A simple communication demo that allows you to log onto the cartridge via telnet and send and receive text messages. And a Wikipedia client, which allows you to enter the title of an article1, then fetches the “extract” of that article and displays it.
This cartridge does not allow you to play your old games online or to access your ROM library via network. Playing old games online would only be possible if you were able to modify them massively, because they would have no idea what a network is, how to handle its delay and how network access even works on my cartridge design. Accessing the ROM library seems more realistic to me in principle, but since on my cartridge the Game Boy software is executed from a regular EEPROM which cannot be programmed by the micro-controller, this would require a redesign to either allow the ESP8266 to program the EEPROM with a binary from the network or to replace the memory entirely, which other projects did, but which has a few drawbacks as you will learn below.
The cartridge interface
Since I decided to add WiFi to a cartridge instead of adding WiFi to the link cable (for which two nice projects already exist 23), we should first discuss, how a Game Boy cartridge works and how we can communicate here. In contrast to the link cable that communicates at a leisurely 8 kHz rate, the Game Boy cartridges are not an interface to implement arbitrary communication, but a serious parallel memory bus, running at 1 MHz. Instead of comfortably sending some data to sync multiplayer games, it is the backbone of all Game Boy memory with a very specific protocol and a relentless clock.”