hn.today

Zelda on a Conference Badge

spf13.com7 points0 comments
Screenshot of Zelda on a Conference Badge

Steve Francia describes turning GitHub Universe’s Badger conference badge into a playable NES emulator without replacing its operating system. The RP2350 badge runs MonaOS, a custom MicroPython environment, and offers a 320×240 screen, 16 MB of flash, and 8 MB of PSRAM. A bare-metal emulator would run more easily but erase the badge’s other features, so Francia built the emulator as a removable app that launches from MonaOS and returns to it with the HOME pad. With Gemini’s help, he wrote a roughly 1,100-line emulator supporting the 6502 CPU, a scanline-rendered PPU, and four cartridge mappers. It has no sound, because the badge lacks a speaker, and displays the NES’s 256×240 image centered on the wider screen.

The technical argument is that MicroPython’s Viper mode can make demanding emulation practical by compiling typed Python into ARM instructions and working directly with pointers. Its strict limits - four arguments, no useful Viper-to-Viper calls, and no dynamic structures in hot loops - shaped the emulator’s packed memory layout and self-contained kernels. Initial Zelda performance was 13.7 frames per second; targeted changes, including direct rendering to the display, eliminating costly division, reducing Python-to-Viper transitions, and optimizing CPU instruction dispatch, cut frame time from 72.9 to 23.7 milliseconds. The resulting build reaches about 42 FPS in Zelda before display overhead, with the on-screen sidebar version around 32 FPS. The badge can be rotated upside down for handheld play, with the accelerometer rotating the display and remapping controls.

Read on spf13.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Hardware

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.