picogb
a game boy and game boy color emulator for the hack club sprig, written from scratch. blargg's cpu and timing tests pass on the real hardware.

picogb runs game boy and game boy color games on the hack club sprig, a handheld with a raspberry pi pico (rp2040) inside, with no extra hardware. it uses the arduino core and sdfat, but no emulator, graphics or game libraries, and no nintendo code.
one core runs the emulator, the other scales the 160x144 picture to the 160x128 screen and sends it out. the game library, saves and save states live on the sd card, and a web page adds games from a pc.
the whole story, with the bugs i found by playing, is in the blog post.
Facts
- hardware - hack club sprig, rp2040 at 250 MHz
- frame budget - 16.7 ms
- frame time - about 6 ms for game boy games, 7 to 11 ms for color games
- pokemon pure blue - 15.0 ms to 10.4 ms per frame
- games - up to 8 MB: 1.8 MB in flash, the rest read from the sd card in 4 KB pages
- save states - 4 slots, plus a resume point when you quit
- regression check - 719 homebrew games matched frame by frame after the speed work
| test rom | pc | sprig |
|---|---|---|
| blargg cpu_instrs | passed | passed |
| blargg instr_timing | passed | passed |
| blargg mem_timing | passed | passed |
| blargg halt_bug | passed | passed |
| dmg-acid2 | pixel-exact | pixel-exact |
| cgb-acid2 | pixel-exact | not run |


