Using a Special Cartridge to Read Wikipedia Articles on a Nintendo Game Boy
A somewhat simple idea
The Nintendo Game Boy is perhaps one of the most famous handheld gaming devices to ever be produced. Although many consider its non-backlit LCD and basic array of buttons to be "primitive", the simplicity and ability to slot in a tiny game cartridge allowed users to take their games wherever they went.
The YouTuber and maker who goes by the name "there oughta be" (Sebastian Staacks) wanted to expand upon this principle by producing his own modified Game Boy cartridge that could enable Wi-Fi communication on this otherwise offline device.
Additionally, the information read from a webserver could then be sent to the console and displayed on its screen, such as a Wikipedia article.
As its most central component, the cartridge's ESP8266 module is what allows the Game Boy to make web requests and receive data back. As a bonus, the ESP8266's fast speed and low profile was a perfect fit for inclusion on a slim game cartridge.
An onboard AT28C256 32KB EEPROM module was added to the design in order to reduce latency between the Game Boy's CPU performing a memory load operation and getting data back.
Finally, a series of logic gates were included to check memory addresses, along with some passive components that provide smooth power to everything else.
How Game Boy cartridges work
Most electronics hobbyists are probably familiar with the SPI communication protocol and its use of two, asynchronous lines that are used to shuffle data between a pair of devices.
Ordinarily, this is the protocol that would be preferred, but because the Game Boy had to retrieve data as fast as possible for game loading, it instead relied upon a more traditional memory bus approach. In this manner, the cartridge exposes 16 address pins, 8 data pins, several control pins, and a clock pin that is toggled at 1MHz.
The Game Boy uses the lower 15 bits of the address bus to address up to 32KB of ROM. while the upper half is internal. It also provides power to the components within the cartridge via a +5V pin and a GND pin.
A need for speed
Staacks' initial idea was to simply attach a fast, modern microcontroller to the address and data pins, wait for a request, and then spend up to 200 CPU cycles processing information before returning it to the Game Boy.
However, this presents a challenge since the ESP8266 would only have a mere 500 nanoseconds from first detecting the request to have data ready- an impossible task. Instead, Staacks opted for a hybrid approach that would use a 32KB EEPROM chip to store program data that needs immediate access while the 80MHz ESP8266 can make a web request, parse the response, and store it within memory in the background.
Addressing the ESP8266
But now this presents another problem, as the Game Boy now has to "know" which device it needs to talk with in order to get information. Staacks implemented his own addressing scheme by combining address bits A1 through A15, with A15 inverted, in an AND gate while having the A0 bit denote if a read or write operation is being performed.
Additionally, the clock signal coming from the console is passed to a NOR gate that only passes that clock along to the ESP8266 if it is currently being addressed. Therefore, any address that is not 0x7ffe or 0x7fff is automatically sent to the much faster EEPROM.
Building the PCB
With the circuitry figured out, Staacks was able to move to the fabrication phase of his project where he designed a PCB and soldered all of the aforementioned components to it.
He even included a few test points near the top for programming the ESP8266 and debugging the circuit if anything went wrong. The EEPROM chip he chose is removable, thus making it easy to wipe and re-flash with new code if the need arises.
Displaying articles on the Game Boy
The code for the Game Boy was written using the Game Boy Development Kit (gbdk) which allows for custom programs to be written for a variety of handheld consoles.
Because it has support for the stdio library, all the code had to do was send a short request to the ESP8266, read in the response, and use the standard print function to output it on the screen. You can see the code for both the Game Boy and ESP8266 here on Github, as well as the design files for the PCB and cartridge.
Extending the functionality
As seen in Staacks' video, his Wi-Fi-enabled Game Boy cartridge is a joy to use, but he wishes to extend what it can do beyond just Wikipedia in the near future too.
Namely, the ESP8266 could act as a web scraper for a whole host of websites, thus letting him retrieve Tweets or some other kind of social media post and then display the result in all of its pixelated glory. You can read about this project in a lot more detail here on Staacks' blog.