Ben Stragnell Gets Super Mario Bros. Running on the Raspberry Pi Pico in a Custom NES Emulator

Impressive effort pushes bit-banged VGA and PWM audio out of the RP2040 microcontroller, running at just 48MHz.

Gareth Halfacree
a month agoGaming / RetroTech

Developer Ben Stragnell has pushed the Raspberry Pi Pico board to its limits, writing a fully-functional Nintendo Entertainment System (NES) emulator which runs on the RP2040 microcontroller — including VGA video and PWM audio outputs.

Launched late last month, the Raspberry Pi Pico is the first outing for the company's in-house RP2040 microcontroller — a dual-core Arm Cortex-M0+ part with some interesting features, including a 133MHz or higher clock speed and programmable input/output (PIO) blocks which can be used to add functionality otherwise missing from the stock peripherals.

To prove its capabilities, Stragnell set himself a challenge: To emulate Nintendo's classic Nintendo Entertainment System (NES) eight-bit games console, complete with video and audio — no small feat on a device which lacks both video and audio outputs.

"Here's a Raspberry Pi Pico pretending to be a NES," Stragnell posted to Twitter in celebration of his success. "The RP2040 is an amazing piece of work — congratulations to everyone involved. This is a $4 microprocessor board simulating a 6502 plus all the NES hardware (PPU, APU) while bit-banging VGA signals and PWM audio. And it works when clocked at less than half the default speed!

"It's actually entirely C and ARM/Thumb asm [assembly]. But (fun fact): Most of the asm is auto-generated from one of the ugliest Ruby scripts in the world! [The emulator is] 100% custom, but it was instructive to look at some other emus to see how they handled some of the more esoteric PPU stuff. I was concerned about getting existing implementations to run fast enough, since I was targeting 48Mhz. However, given that the actual silicon is so much faster than 48Mhz it might be a worthwhile project to try a proper port [of an open-source NES emulator.]"

Stagnell has not yet published the source code for the project, but additional details are available in the Twitter thread.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire:
Related articles
Sponsored articles
Related articles