SGDK 1.70 (february 2022)
Copyright 2022 Stephane Dallongeville
SGDK is a free development kit allowing development of software in C language for the Sega Mega Drive. It contains the development library itself (with the code sources) and some custom tools used to compile resources. SGDK uses the GCC compiler (m68k-elf target) and the libgcc to generate a ROM image. Binaries (GCC 6.3) are provided for Windows OS for convenience, but you need to install it by yourself for other operating systems. Note that SGDK also requires Java (custom tools require it), so you need to have Java installed on your system.
SGDK library and custom tools are distributed under the MIT license (see license.txt file). GCC compiler and libgcc are under GNU license (GPL3) and any software build from it (as the SGDK library) is under the GCC runtime library exception license (see COPYING.RUNTIME file)
First, you need to know that SGDK uses the C language (assembly is also possible, but not necessary) so it's highly recommended to be familiar with C programming before trying to develop with SGDK. Learning C language at same time as learning 'Sega Mega Drive' programming is definitely too difficult and you will end up getting nowhere. It's also important to have, at least, a basic knowledge of the Sega Mega Drive hardware (specifically the video system).
MEGA DRIVE TECHNICAL INFO REFERENCES
- And-0 - Awesome Mega Drive Development references:
- Raster Scroll - Sega Mega Drive Graphics guide:
- Mega Cat Studios - Sega Mega Drive graphics guide:
- Sik's Blog dedicated to MD assembly programming but explain a lot of stuff (and in a nice way) about the Sega Mega Drive hardware:
- A nice article from Rodrigo Copetti explaining the Mega Drive architecture:
- Genesis Software Manual which contains absolutely everything you need to know about the Sega Mega Drive:
INSTALLATION AND DOCUMENTATION
Then when you feel ready you can go further and finally install SGDK :)
You can find installation instructions and tutorials about how use SGDK on the wiki:
SGDK comes with doxygen documentation (generated from .h header files) which provides descriptions about SGDK structures and functions. You can find it in the 'doc' folder (open your local doc/html/files.html in your browser).
It's important to know that SGDK heavily relies on resources which are compiled through the rescomp tool. You should read the rescomp.txt file to understand which kind of resources you can use and how to declare them. Then you can look at the 'sample' folder from SGDK and, in particular, the sonic sample which is a good showcase of SGDK usage in general (functions and resources).
You can find a lot of tutorials online about SGDK but be careful, some are outdated or sometimes just wrong.
I really recommend starting from the wiki which provides the basics to start, but if you need more visual and more complete tutorials you can give either of these a try:
MD programming tutorials from Ohsat:
Very complete and visual tutorials from Danibus (spanish only):
HELP AND SUPPORT
If you need help or support with SGDK, you can join the SGDK Discord server:
You can also go to the Spritesmind forum which is dedicated to Sega Mega Drive development and has a specific section for SGDK:
MACOSX / LINUX
Unix/Linux users should give this very simple script a try, allowing you to use SGDK from Wine easily:
There is also a new solution proposed by Daniel Valdivieso to use SGDK with VSCode under any OS using Wine:
Another great alternative is to use the complete MarsDev environment developed by Andy Grind: https://github.com/andwn/marsdev It suppots all OSes, provides SGDK compatibility as well as 32X support, so be sure to check it out.
MacOSX users also have access to SGDK with Gendev for MacOS from the Sonic3D project:
A modern way to install it on any environement is to use Docker.
To build the
sgdk base image:
docker build -t sgdk .
And then to compile the local env, such as
samples for example:
cd sample/sonic docker run --rm -v "$PWD":/src sgdk
$PWDwill not work on Windows,
%CD%has to be used instead.
- To avoid writing
./outfiles as root, execute the docker command as current user:
docker run --rm -v "$PWD":/src -u $(id -u):$(id -g) sgdk
- You can also try the alternate Doragasu docker solution which uses a native linux compiler (much faster): https://gitlab.com/doragasu/docker-sgdk
You can find a Visual Studio template in the 'vstudio' folder to facilate SGDK integration with VS.
Or, to take it even further, you can also install the VS extension made by zerasul:
SGDK is completly free but you can support it on Patreon: https://www.patreon.com/SGDK
Thanks =) I wish you a great and happy time coding!
- Doragasu for the multi-tasking engine (based on Sik implementation), MegaWifi support and others nice additions.
- Sik for the multi-tasking base implementation and for all its unvaluable Plutidev Sega Mega Drive technical information source.
- Chilly Willy for making almost all the JOY / controller support in SGDK (and the joy test sample ^^).
- Astrofra for the starfield donut sample and the revamped readme ;)
- Gligli for building and providing GCC 6.3 for Windows.
- Gunpog for making the new SGDK logo.
- Vojtěch Salajka for the script allowing to use SGDK easily from Wine (Linux/Unix but may work on OSX too).
- Daniel Valdivieso for another Wine based solution to use SGDK on multi-OS (including a VSCode template).
- Andy Grind for the MarsDev project allowing to use SGDK on any OS and also supporting 32X dev.
- Kubilus for the GenDev Linux port of SGDK.
- Sonic3D for the GenDev OSX port of SGDK.
- Vladimir Kryvian for Visual Studio support and template.
- Steve Schnepp for Docker support.
- Andreas Dietrich for the nice Wobbler & scaling effect samples.
- clbr for various contributions.
- jgyllinsky for providing / improving build batches.
- nolddor for fixes / contributions.
- starling13 for fixes.
- davidgf for its contributions (apultra tool, improved assembly LTO optimization).
- ShiningBzh / Jeremy and Kentosama for their precious help in testing.
- Vetea and Studio Vetea Discord people in general for their support and kindness.
- all those i forgot and generally all people helping by providing support, reporting bugs and supporting SGDK in any way !
Of course I thank all my patreon for their continuous support but I want to dedicace a very special and warmfull thanks for my premium patreon supporters (100$ / month):
- Bitmap Bureau (Xeno Crisis team)
- Neofid Studios (Demons of Asteborg team)
POWERED BY THE SGDK!
These projects are known to be based on the SGDK (non-exhaustive list):
Tanzer by Mega Cat Studios
MASIAKA by Resistance
Xeno Crisis by the Bitmap Bureau
Demons of Asteborg Neofid Studios
Random list of SGDK-powered games and demos
- 2048 by atamurad
- Abbaye des Morts (l') unofficial MD port by Moon-Watcher
- Art of LeonBli (the) by Resistance
- Barbarian unofficial MD port by Z-Team
- Demons of Asteborg by Neofid Studio
- Devwill Too MD by Amaweks
- Fatal Smarties made for the GGJ 2016
- Fullscreen NICCC 2000 by Resistance
- IK+ Deluxe unofficial MD port by Z-Team
- Irena by White Ninja Studio
- Omega Blast by Nendo
- Perlin & Pinpin by Lizardrive
- Right 2 Repair by Super Megabyte made for the GGJ 2020
- Return to Genesis unofficial MD port by Z-Team
- Road to Valhalla by Bounty/Banana & Resistance
- Spiral (the) by Resistance
- Tetris MD unofficial MD port by Nero Jin
- ThunderCats MD by Rolando Fernández Benavidez.
- Travel by Resistance
- Wacky Willy Weiner Sausage Surfer made for the GGJ 2017