Running Game Boy Games On STM32 MCUs Is Peanuts

Using a STM32F429 Discovery board [Jan Zwiener] put together a Game Boy-compatible system called STM32Boy. It is based around the Peanut-GB Game Boy emulator core, which is a pretty nifty and fast single-header GB emulator library in C99. Considering that the average 32-bit MCU these days is significantly faster than the ~4 MHz  8-bit Sharp SM83 (Intel 8080/Zilog Z80 hybrid) in the original Game Boy it’s probably no surprise that the STM32F429 (up to 180 MHz) can emulate this 8-bit SoC just fine.

Since Peanut-GB is a library, the developer using it is expected to provide their own routines to read and write RAM and ROM and to handle errors. Optional are the line drawing, audio read/write and serial Tx/Rx functions, with the library providing reset and a host of other utility functions. Audio functionality is provided externally, such as using the provided MiniGB APU. Although fast, it comes with a range of caveats that limit compatibility and accuracy.

For STM32Boy, [Jan] uses the LCD screen that’s on the STM32 development board to render the screen on, along with a Game Boy skin. The LCD’s touch feature is then used for the controls, as can be elucidated from the main source file. Of note is that the target GB ROM is directly compiled into the firmware image rather than provided via an external SD card. This involves using the xxd tool to create a hex version of the ROM image that can be included. Not a bad way to get a PoC up and running, but we imagine that if you want to create a more usable GB-like system it should at least be able to play more than one game without having to reflash the MCU.

3 thoughts on “Running Game Boy Games On STM32 MCUs Is Peanuts

  1. I was wondering why Peanut-GB suddenly got so much traffic! There are other projects that use Peanut-GB, like Pico-GB (https://github.com/YouMakeTech/Pico-GB), which allow selecting a game from a connected SD Card to play on the Raspberry Pi Pico at full speed with display and audio. So that doesn’t reflash the MCU every time the user wants to change the game.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.