Amy Farbright

Sonic 1 Mega CD Port

Source here. Download here!

For the 2024 Sonic Hacking Contest, I made a port of Sonic 1 for Mega Drive to the Sega Mega CD, an often-overlooked hardware addon for the console. I worked on it over the course of about two months, as a way for me to learn new hardware and to give an example for others to work off of for developing their own games for it. There are a few notable things about this project:

Due to the new storage format, many changes had to be made to fit everything. With no ROM area to work with, you lose the 512kb of space the game would otherwise fit into (and the other 3.5mb of space you could use to store new data statically). Instead, you have to divvy up your data between:

PRG RAM is an attractive option for moving things into, but the Mega CD can't easily access the Mega Drive's video hardware (the VDP chip). Mega CD's processor is a Motorola 68000 (same as Mega Drive's) running at a higher clock speed, so game code could absolutely be run on it, but you quickly run into design problems of how to coordinate interaction with the VDP. Given the deadline I had, I decided the better option would be to mimic the way Sonic CD (a classic Sonic game originally developed for Mega CD) handles its normal levels.

I set up a system where a set of "kernel" programs, running on the Mega Drive and Mega CD simultaneously, cooperate to load in levels to Word RAM as nearly-standalone code modules that the Mega Drive then executes. Fitting each level into Word RAM required trimming a lot of unnecessary data from Sonic 1's assembly code, and making heavy use of assembler directives to selectively include relevant parts of code and data, sometimes aligned to expected memory addresses.

This port also features notable sound modifications. The biggest draw of using a CD as a medium of storage is the possibility of streaming high-quality audio. While I was not able to set that up in the time I had, I did manage to set up playback of drum samples on the Mega CD, replacing the Mega Drive's PCM playback. I converted the raw waveform data from the format used by the original game's sound engine, to a format directly usable by the Mega CD's onboard audio chip. Then, in the kernel, I recieve signals from the Mega Drive to play certain samples where appropriate. I hope to expand on this further in future releases.

I'm excited for what this project can do for the future of homebrew on the Mega CD. It's not a terribly well-documented piece of hardware, but its potential definitely opens up a lot of possibilities for how to expand existing Mega Drive games.