sverx / devkitSMS

development kit and libraries for SEGA Master System / SEGA Game Gear / SEGA SG-1000 / SEGA SC-3000 homebrew programming using C language (and the SDCC compiler)
222 stars 34 forks source link
retroprogramming sdcc sega-game-gear sega-master-system sega-sc-3000 sega-sg-1000

devkitSMS

a collection of tools and code (with a very presumptuous name) for SEGA Master System / SEGA Game Gear / SEGA SG-1000 / SEGA SC-3000 homebrew development using 'C' language (and the SDCC compiler).

How to code your own programs using devkitSMS:

note: if you're on Linux or on Windows, all binaries are supplied in the Linux or Windows folders. If you're on a Mac, binaries are kindly provided by Carl-Dixon here - otherwise you can compile the programs yourself from the provided sources.

How to use devkitSMS/SMSlib to code your own SMS/GG program:

How to use devkitSMS/SGlib to code your own SG-1000/SC-3000 program:

How to load your devkitSMS/SGlib code onto a BASIC IIIa/IIIb cartridge:

Software written with SGlib can be loaded to a BASIC cartridge on the SC-3000. The BASIC LOAD command loads the program over the cassette interface to address 0x9800. Once loaded, the program can be run with the CALL &H9800 command.

How to use devkitSMS/PSGlib to use PSG audio/SFX in your SMS/GG/SG/SC program:

How to add external data into your ROM:

How to use more than 48KiB in your ROM ('ROM paging'):

How to build the final .sms/.gg/.sg file:

ADVANCED: How to use more than 32KiB of code in your SMS/GG ROM ('banked code'):

SDCC 4.x supports banked code and this means that it's now possible to page in and out code in a transparent manner. To achieve this, banked code should be written in separate source files that have to get allocated in separate code banks. Upon calling a banked function the code will trigger a slot-1 bank change (using trampolines that are 'hidden' in bank 0 code) and will restore the previous bank upon returning from called function. This means that only code in bank 0 won't ever be paged out, but that means that total code won't be restricted to the 32 KiB maximum size.

You need to:

void some_function (void) __banked {
  //  your code here 
}

Third-party libraries:

A few additional third-party libraries are available and can be used with devkitSMS:

Support devkitSMS:

Check SUPPORT.md to see how you can contribute to development.