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.

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.