The following shows changes to the 68K Memory Map with a MegaCD/SegaCD attached:

Sega CD Model 2 attached to a Model 2 Sega Genesis.

Start address

End address

Description

$000000

$01FFFF

MegaCD BIOS ROM

$020000

$03FFFF

MegaCD "Program RAM" Bank Access

$200000

$23FFFF

MegaCD "WORD RAM"

$A12000

$A120XX

MegaCD "Gate Array"

$FFFD00

$FFFDFF

MegaCD Interrupt/Exception vectors

MegaCD BIOS ROM is always only visible to the main 68K, and decompresses a separate BIOS for the MegaCD "SubCPU" into "Program RAM". "WORD RAM" access is restricted to one 68K at a time, which is determined by a setting in the "Gate Array". "Program RAM" is $80000 bytes in size, but is only accessible by the Genesis 68K in banks of size $20000, and only when the MegaCD 68K is in "BUSREQ" (stopped). The MegaCD 68K may be stopped/reset, and the available "Program RAM" bank may be set by use of the "Gate Array".

The ROM header starts at $000100 and contains information about the cartridge. The following assembly code shows how to declare the header:

dc.b "SEGA GENESIS"

dc.b "(C)SEGA 1992.SEP"

dc.b "YOUR GAME HERE

dc.b "YOUR GAME HERE

dc.b "GM XXXXXXXX-XX"

dc.w $D951

dc.b "J

dc.l 0

dc.l ROM_End

dc.l $FF0000

dc.l $FFFFFF

dc.b (Blank)

dc.b (Blank)

dc.b (Blank)

dc.b (Blank)

dc.b (Blank)

dc.b "JUE

Explanations for each field:

The name of the console. Should be either "SEGA GENESIS" or "SEGA MEGA DRIVE" (depending on the region you are planning to program your game for). Must be 16 characters long.

Firm name and build date. Must be 16 characters long, firm name is four characters long.

Domestic name. Must be 48 characters long.

International name. Must be 48 characters long.

Program type and serial number. First two characters are either "GM" (game) or "AL" (educational). After the space, a series of eight digits gives the serial number. The final two digits give the version number.

End of the ROM. It's best to use a label at the end of your source file to determine this.

Start of RAM. Just about every game starts at $FF0000, but RAM is mirrored at several other places, and you can use those if you want.

End of RAM. Should be $FFFF after the starting point.

Backup RAM ID. Fill this with spaces if there is none, otherwise, use this formula:dc.b "RA",%1x1yy000,%0010000
where x is true when the RAM is for backup and false if not. (I've no idea what the difference is.) yy is 11 if addressing is odd bytes only, 10 if even only, and 00 if both.

Start address of backup RAM. Fill with spaces if there is no backup RAM.

End address of backup RAM.

Modem support. Fill with spaces if there is no modem, otherwise follow this formula:"MOxxxxyy.zzz"
where xxxx is the firm name, yy is the modem number, and zzz is the version number. (This is also unused)

Notes. Put whatever you want here, and fill the empty spaces with zeroes.

Country codes. J is for Japan, U is for the United States, and E is for Europe. You need to fill in the rest of this field with spaces. So, JU for the country code would tell the Sega that the game is for Japan and the US, JUE would tell it that it is for Japan, the US, and Europe

Back in 1990, Accolade released a few unlicensed games for the Genesis. Sega was not pleased about this, so they invented TMSS and put it on all new consoles they manufactured. TMSS forces the game to write the ASCII string "SEGA" to $A14000 within a short period of time, or the VDP will be deactivated. On version 0 of the console, this location is reserved, and writing here may cause a crash, so the game has to first make sure that it's running on a console that has TMSS. Sega uses the following routine for that:

The checksum is a 16-bit number (word) located in the header which is present in all licensed games.It was used to check the integrity of the data by storing a pre-calculated number (the checksum) using the original data and comparing it with the checksum of the existing data in the cart, probably to prevent code changes without authorization (in-house).

The checksum is, basically, the sum of the whole cart, all its bytes, starting at address $200. As you can guess, if only a byte is changed the checksum changes too. Somewhat like the CRC/CRC32 algorithms, though those are much more accurate than this method.

You don't need to implement the checksum if you program your own homebrew rom, because the checksum is exclusively checked by software. But, anyway, this is how a typical checksum routine from a licensed game would look.