Sonic Clean Engine (S.C.E.), a cleaned and slightly optimized source code of the game «Sonic 3 & Knuckles» for the 16-bit retro console Sega Genesis / Mega Drive, is offered for free download. This code has long been used to create projects «Hellfire Saga» and «Sonic 3 & Knuckles: Epilogue» and others.
This source code uses software from other authors, so check their licenses before using.
You can download the source code here.