Mega Drive SGDK Misc

Take your skills to the next level with these bite-sized tutorials!

Editing the Rom Header


Has this happened to you? You spend days crafting and coding an amazing Pong game for the Mega Drive. You create artistic, beautiful graphics, use highly advanced coding techniques and magical algorithms, and have composed a soundtrack that sounds like Streets of Rage as arranged and conducted by John Williams. Then you compile the game, fire it up in your emulator and see this:

images/sampleheader.png

That just ruins the whole thing, doesn’t it?

But luckily it’s very easy to change the title of your game if you know where to look. And where you need to look is inside your project folder. There you will find a folder named src and inside that, a folder named boot. See that file named rom_head.c? That is where the information is stored that will go in the header of your rom.

The header basically stores meta information about your game, such as the title, release date, copyright information and more. If you simply open rom_head.c in a text editor, you will see all of this information in plain text. All the information is stored in a single struct:

const struct
{
    char console[16];               /* Console Name (16) */
    char copyright[16];             /* Copyright Information (16) */
    char title_local[48];           /* Domestic Name (48) */
    char title_int[48];             /* Overseas Name (48) */
    char serial[14];                /* Serial Number (2, 12) */
    u16 checksum;                   /* Checksum (2) */
    char IOSupport[16];             /* I/O Support (16) */
    u32 rom_start;                  /* ROM Start Address (4) */
    u32 rom_end;                    /* ROM End Address (4) */
    u32 ram_start;                  /* Start of Backup RAM (4) */
    u32 ram_end;                    /* End of Backup RAM (4) */
    char sram_sig[2];               /* "RA" for save ram (2) */
    u16 sram_type;                  /* 0xF820 for save ram on odd bytes (2) */
    u32 sram_start;                 /* SRAM start address - normally 0x200001 (4) */
    u32 sram_end;                   /* SRAM end address - start + 2*sram_size (4) */
    char modem_support[12];         /* Modem Support (24) */
    char notes[40];                 /* Memo (40) */
    char region[16];                /* Country Support (16) */
} rom_header = {
    "SEGA MEGA DRIVE ",
    "(C)FLEMTEAM 2013",
    "SAMPLE PROGRAM                                  ",
    "SAMPLE PROGRAM                                  ",
    "GM 00000000-00",
    0x0000,
    "JD              ",
    0x00000000,
    0x00100000,
    0x00FF0000,
    0x00FFFFFF,
    "  ",
    0x0000,
    0x00200000,
    0x002001FF,
    "            ",
    "DEMONSTRATION PROGRAM                   ",
    "JUE             "
};

And if you change any of the values, they will be incorporated into the rom the next time you compile your project! So if you wanted to change the title of your game that is displayed in the emulator, you would change the third (and fourth) lines of the rom header struct. Be aware however that you cannot exceed the amount of characters reserved for an item. For example, your title_local can only consist of 48 characters, while your copyright note can only be 16 characters long.

So if I change the two instances of SAMPLE PROGRAM to MEGAPONG I will end up with this:

images/realheader.png

Much better! Now the game is fit to be sold on itch.io. (See what I did there?)

And if you want some more information on what each field contains and what values are permissible, check out this great breakdown by Plutiedev.

If you have any questions, comments or criticism, post them in the comments below or reach out to me on Twitter @ohsat_games! Special thanks to Stephane Dallongeville for creating SGDK and everyone in the SGDK Discord for their help and keeping the dream alive!

Take It to the Next Level!

Want to boost your Mega Drive coding skills? Get exclusive bonus steps and project files for each tutorial by supporting me on Patreon!

Become a Patron!
Just Want to Buy Me a Coffee?

Check out the rest of this tutorial series!

  • Creating Graphics for the Mega Drive
  • Color Swapping
  • 4 Programs For Creating Mega Drive Graphics
  • Editing the Rom Header
  • Simple Game States
  • Get Words in Your Inbox!

    Be oldschool and sign up for my newsletter to occasionally get updates and ramblings! Just enter your email address, prove you're not part of Skynet and you're good to go!



    I will not send you spam or sell/give your email address to someone else.  You can of course unsubscribe at any time. By clicking the subscribe button above, you confirm that you have read and agreed to our privacy policy.

    By using the Disqus service you confirm that you have read and agreed to the privacy policy.

    comments powered by Disqus

    Streets of Rage 2 Design Docs

    Original Streets of Rage 2 design docs translated into English!
    Ramblings Translation Mega Drive

    Make a Space Shooter for the Mega Drive!

    February 24, 2020
    Mega Drive Ramblings

    Patreon Revamps

    January 28, 2020
    Mega Drive Ramblings Patreon