Based on community decompilations of the 3.0 binary, here is what the logic looks like in pseudo-assembly. Warning: This is reconstructed for educational use.
Using tools like Floating IPS (Flips), apply the Sonic.EXE 3.0 patch to a clean Sonic 1 (UE) Rev 1.bin. This gives you the borked binary.
In recent years, due to the rise of Sonic.EXE: The Disaster (a fangame by My5tMatthew) and Sonic PC Port (by Rubberduckcool), many developers search for a modern source code.
There is no official Sega SDK for Sonic.EXE 3.0. sonic.exe 3.0 source code
However, a GitHub repository named Sonic-EXE-3.0-Decomp exists (status: often DMCA'd or archived). This is a fan-made translation of the Assembly logic into C# (for Unity) or C++ (for SDL). If you want to study the logic without learning 68k Assembly, search for "Sonic.EXE 3.0 C# Port."
Note on Ethics: Sega holds the copyright to Sonic the Hedgehog. Distributing the full, pre-patched ROM is illegal. Distributing the source code diff (the changes only) is generally protected under fair use for educational purposes.
To understand the code, you must understand the artifact. Version 3.0 is distinct from 2.0 (the "X" version) and the later "PC Port." Based on community decompilations of the 3
The first hurdle researchers face is a brutal reality: There is no official "source code" in the modern sense.
Sonic.EXE 3.0 was not built in Unity or Unreal Engine. It was built using Sonic the Hedgehog ROM hacking tools. Specifically, the game runs on the Sega Mega Drive/Genesis hardware. The "source code" is actually a patched .bin file (often distributed as an .smc or .bin) applied to a vanilla Sonic 1 ROM.
When people search for the "Sonic.EXE 3.0 source code," they are usually looking for one of three things: Historically, the creator(s) of the 3
Historically, the creator(s) of the 3.0 version never released a clean assembly source repository. The game was shared as a pre-patched binary via MediaFire and YouTube descriptions. Consequently, retrieving the code requires retro-engineering.
“Sonic.EXE 3.0’s source code is the creepypasta’s creepypasta — a horror that keeps unfolding after you close the game.” — r/creepygaming