Donald Hays

Updated Snake for Game Boy

March 9, 2021

It is with great embarrassment that I’m pleased to announce version 1.1 of my Snake game for Game Boy!

This release fixes a single issue: high scores wouldn’t save correctly on some emulators and flash carts.

Originally, the game was configured as a ROM+RAM+Battery cart type. As it turns out, there was—as I understand—never a commercial release of a game with that cartridge type, which means emulators don’t have a reference for how exactly it should behave. As a result, even though every emulator I tested it on at the time worked, I was unknowingly relying on unspecified behavior, and it turns out that it doesn’t work everywhere. I have since changed the game to use the MBC5 memory bank controller, which is well-documented and supported. The game is still 32 kilobytes, and if you have a save file from an emulator that supported the old version, that same save should still work, but saving will now work on more emulators and flash carts.

Also, I moved the initial stack pointer from the end of high RAM to the end of regular RAM. This doesn’t make a practical difference for this game, but it’s just better practice in general: high RAM is fast, but not in a way that the stack can take advantage of.

Finally, updating the game involved a sizable commit to address the surprising amount a project for a long-dead platform had rotted. First, I switched from a custom build script to a more standard Makefile. The updated build process also expects you to install RGBDS externally, rather than have a copy of it in the project folder structure. These changes weren’t necessary, but are better practice. But more importantly, RGBDS itself has been evolving over time, and I addressed some deprecations and language changes.

Also embarrassing, Bubble Factory suffers the exact same save problem. I’ll be fixing it, too, later.