zeyad

home / work / picogb

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.

source - blog post

super mario land, world 1-1, on the sprig's screen
super mario land on the real sprig.

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 results, from the readme
test rompcsprig
blargg cpu_instrspassedpassed
blargg instr_timingpassedpassed
blargg mem_timingpassedpassed
blargg halt_bugpassedpassed
dmg-acid2pixel-exactpixel-exact
cgb-acid2pixel-exactnot run
four test rom screens: cpu_instrs passed all tests, instr_timing passed, mem_timing passed all tests, halt bug passed
blargg's test roms, captured on the sprig.
the picogb game list on the sprig: akumanor gaiden, two pokemon hacks and super mario land
the game list, with the library on the sd card.
the sprig running mario in front of a laptop
the sprig in front of the chat that built it.