Collapse OS Documentation Browser

doc/sega.txt

asm/ code/ hw/ algo.txt arch.txt avr.txt blk.txt blksrv.txt bootstrap.txt cross.txt design.txt dict.txt dis.txt drivers.txt ed.txt emul.txt faq.txt grid.txt grok.txt impl.txt intro.txt me.txt mspan.txt ps2.txt rxtx.txt sdcard.txt sega.txt selfhost.txt spi.txt usage.txt wordtbl.txt

Sega Master System ROM signatures

When loading ROM, the SMS' BIOS checks for a special signature
at the end of that ROM. If that signature is incorrect, the ROM
doesn't load.

Collapse OS has a program to generate that signature at B165.
This document describes what it does.

At boot, the BIOS checks $10 bytes before the $8000, then
$4000, then $2000 mark for a signature. This signature has
the following structure.

$00-$07: String constant: "TMR SEGA"
$08-$09: null bytes
$0a-$0b: checksum
$0c-$0e: null bytes
$0f     : "size" flag

The checksum is a simple 16-bit sum of all bytes up to the
beginning of the signature.

The size flag can have 3 values: $4a for an 8K ROM, $4b for
16K and $4c for 32K. It can have other values for other kinds
of sizes, but we don't care about them in the context of
Collapse OS.

Generating the signature

Before generating the signature, you need to have the contents
of your ROM somewhere in memory. Then, you load B165 and you
call "segasig" which has the signature "addr size". "addr" is
the adress of the beginning of the ROM and "size" is 0, 1 or 2
depending on whether your ROM is 8K, 16K or 32K.

Calling the word will write the $10 bytes signature at the
end of the ROM.

Note that all I/O use the "Addressed device" words (see
usage.txt), so I/O indirections will work.

Collapse OS and its documentation are created by Virgil Dupras and licensed under the GNU GPL v3.

This documentation browser by James Stanley. Please report bugs on github or to james@incoherency.co.uk.

This page generated at 2024-11-24 21:05:03 from documentation in CollapseOS snapshot 20230427.