Fill me! - link to tutorials - link to some useful forum posts, wiki pages, source code - link to emulators that are useful for development


How to Program Maxim of SMS-Power has written maybe THE tutorial to get you started in the world of SMS programming. It assumes little prior knowledge, and in nice step-by-step instructions, you are shown how to create the classic "Hello World" first program. Along the way you learn about important aspects of the SMS system, i.e how the tile-based graphics are encoded, how the colors work, etc. You also learn how to set up a well-functioning z80 assembler development environment, with a z80 customized text editor, assembler and emulator tightly integrated.

Create a Racing Game hang-on has written a tutorial on how to create a super simple racing game, based on the same set of tools as Maxim's Hello World. Crucial game design elements are discussed in progressive steps: 1) How to create assets like background, sprites and sound/music; 2) how to make a vertically scrolling road; 3) how to control a race car with player one's joystick; and finally 4) how to add some enemy cars. General topics such as sprite buffering, game loops, etc., are also part of the tutorial.

How to Write Spectrum Games Jonathan Cauldwell has written a complete tutorial on how to write Spectrum games, including collision detection, scoring, getting input from controllers, coding enemy logic, etc. Even though the tutorial contains some Spectrum specific parts (i.e. how to get characters on the screen), it generally translates very well into the world of SMS-programming. Novice SMS-programmers can learn important game design concepts from the tutorial. Because both the Spectrum and the SMS is z80-powered, the code examples are easy to follow and adapt to your own SMS project.

Trainers - Do It Yourself hang-on of SMS-Power describes the tools, workflow and tricks he used to make trainer versions of Altered Beast and Golden Axe. It is all about ROM hacking as we enable unlimited lives and a "press pause to power up"-feature for Altered Beast. Golden Axe gets a custom demo style intro screen, and a menu to enable unlimited lives, potions x 2 and level selector/jukebox.

Useful links


The following emulators have debugging functionalities to assist development:

Common pitfalls

Here are some typical issues faced when programming the SMS.

Mapper initialization

The standard Sega mapper must be initialized by code located within the first 1K of ROM. This is because the $0400-$BFFF memory region will point to ROM only if if the mapper chip has a reset input, which not all have. However it is guaranteed that code and data placed in the first 1K of ROM are always accessible, providing a safe area to handle mapper initialization. For example:

        .org    $0000
        im      1
        jp      init

        .org    $0080 ; Or any other location within $0000-$03FF
        ; This maps the first 48K of ROM to $0000-$BFFF
        ld      de, $FFFC
        ld      hl, init_tab
        ld      bc, $0004

        jp      main

init_tab: ; Table must exist within first 1K of ROM
        .db     $00, $00, $01, $02

(note: On a Master System, mapper initialization is performed by the BIOS at start-up. However, commercial software does this again, to deal with consoles with no on-board ROM such as the Game Gear)

Return to top