Overview

Some Sega systems include a simple BIOS to handle the boot process, display a bumper screen, display instructions/error screens and provide built-in games - or a subset of these. This page describes the behaviour of the various BIOS software known to exist.

Master System

M404 Prototype BIOS

M404 Prototype BIOS bumper screen
M404 Prototype BIOS bumper screen

This BIOS was dumped from a prototype Master System originally sent to Sega of America. Its functionality is quite different from any other BIOS:

None of this functionality interferes with the operation of other BIOSes' checks of the header at $7ff0, which may or may not have been deliberate.

Only two games are known to boot with this BIOS: the Japanese version of Fantasy Zone, and Choplifter. These are known to be two of the earliest games developed for the Master System.

Prototype BIOS v1.0 (1986)

This BIOS is found in some prototype/demonstration Master System consoles and is very similar to the 1.3 BIOS but lacks:

Other small differences from 1.3:

US/European BIOS v1.3 (1986)

This BIOS checks to see if any of the available slots (card, cartridge or expansion, in that order) have anything attached to them, and boots the first available. This is done using port $3E to map different slots into memory, and checks to determine if valid data was found in any slot.

US/European BIOS bumper screen
US/European BIOS bumper screen

The first thing it does is display an animated bumper screen, as shown on the right. While this is animating, the Sega two-tone "jingle" is played. This is purely to reinforce the Sega Master System brand.

It then checks the slots in turn. For each slot, 16 bytes are copied to RAM and checked if they contain a valid ROM header. It does this from offsets $7ff0, $3ff0 and $1ff0 in turn.

It checks to see if the first eight bytes match the ASCII string "TMR SEGA"; if so, it proceeds to further tests. If no header is found at any of the three locations, the slot is assumed to be empty.

The next check is the region: if the high four bits of the last byte of the header do not equal 4, it is rejected with a "SOFTWARE ERROR" message.

Finally, it checks the checksum using this code:

 Checksum:
    ld     a,e          ; add (hl) to de
    add    (hl)
    ld     e,a
    ld     a,d
    adc    $00
    ld     d,a
    inc    hl           ; move pointer on and decrement counter
    dec    bc
    ld     a,b          ; repeat until counter is zero
    or     c
    jr     nz,Checksum
    ret

It sums bc bytes from offset hl into de. This is used to checksum different regions of ROM according to the ROM header. A lower region is checked, intended to cover all of the ROM before the header (last 16 bytes); an upper region is then checked (if applicable) assuming a standard Sega mapper. The lower four bits of the last byte of the header define the regions checked:

ValueLower region checkedUpper region checkedTotal size
$a$0000..$1FEFn/a8KB
$b$0000..$3FEFn/a16KB
$c$0000..$7FEFn/a32KB
$d$0000..$BFEFn/a48KB
$e$0000..$7FEF$8000..$0FFFF64KB
$f$0000..$7FEF$8000..$1FFFF128KB
$0$0000..$7FEF$8000..$3FFFF256KB
$1$0000..$7FEF$8000..$7FFFF512KB
$2$0000..$7FEF$8000..$FFFFF1024KB
$3..$9Not supported

If the calculated value does not match the one in the header, a "SOFTWARE ERROR" message is again shown. Otherwise, the slot is booted.

US/European BIOS screenshot
US/European BIOS screenshot

The last value written to port $3E is also saved in RAM location $c000 (the first byte of RAM). This allows software released in more than one format to safely use port $3E, if necessary, by using this value to correctly re-enable the slot it booted from.

If all slots are found to be empty, an instructional screen is shown. While it is showing, it is possible to press a key combination ([Up]+[1]+[2] on the Player 1 controller; additional buttons may also be pressed and it will still work) to trigger a "secret" Snail Maze game.


Uncommon BIOS v2.0 (1987)

This BIOS is an uncommon variation of v1.3 which has been recently discovered (cf. discussion here )

The only major difference with v1.3 is the cartridge detection code, which doesn't do any ROM header or checksum verification. Instead it just checks that the first 513 bytes of ROM are not identical. As such, it behave like a Japanese SMS and allows booting cartridges that don't read properly (they would crashes) or Japanese titles (via a custom made adapter for cartridge, or cards). So this is a cool side-effect. Here is the code:

FirstBlockCheck:
    ld hl, $0000
    ld bc, $0201
    ld de, ROM_FirstBlockCopy                  ; copy in RAM the first 513 bytes of the potential ROM location
    ldir
    ld a, (ROM_FirstBlockCopy)                 ; and we are going to compare the 1st byte with the next 512
    ld hl, ROM_FirstBlockCopy+1                ; we will consider it a valid ROM if the 513 bytes don't all
    ld bc, $0200                               ; contain the exact same value (so this BIOS can boot Japanese ROMs!)
BlockCheckLoop:
    cpi
    jr nz, BlockCheckSuccess                   ; at least one byte of the block doesn't match the first!
    jp po, BlockCheckLoop                      ; if we haven't checked all the bytes yet, loop
    ret                                        ; check failed

One interesting bug in this code is that the first ROM block is copied in RAM at almost the same address as the RAM copy of the Snail Maze game's tilemap. This causes a visual glitch on the top corners of the maze when run on real hardware (photo 1 , photo 2 )

Other minor differences from v1.3:


Japanese BIOS v2.1 (1987)

This BIOS is similar to the US BIOS, except that because there was no header requirement for Japanese games, especially with legacy SG-1000 software to be supported, this checking has to use a less precise method: it checks to see if there is variation in the data read. It uses this code:

 CheckSlot:
    ld     hl,$0000        ; look at ROM from $0000
    ld     bc,$003c        ; loop 256 times, mask $3c
    ld     a,(hl)          ; get byte
    and    c               ; and with $3c = %00111100
    ld     e,a             ; store in e

 Loop:
    ld     a,(hl)          ; get byte
    inc    l               ; pointer++
    and    c               ; and with $3c
    cp     e               ; compare to first byte
    jp     nz,$0000        ; if not equal, run slot
    djnz   Loop            ; repeat 256 times
    ret                    ; Nothing found

It checks if there is any variation in the middle four bits of the first 256 bytes in each slot and passes execution to the code in that slot if any variation is found. It may be presumed that the hardware ensures that at least these four bits are held constant for all slots when not connected to anything.

Japanese BIOS screenshot
Japanese BIOS screenshot

If it does not find anything in any of its slots it shows an instructional screen, with the text:

電源をOFFにして,
ソフトを入れてください。

Translation: "Turn the power switch to OFF, then please insert some software."

It animates the screen while playing the main theme from "Space Harrier" on both the PSG and the YM2413 simultaneously.

ROM part code: MPR-11124

Dumped by Hiroshi.

US/European BIOS v2.4 with Hang On and Safari Hunt (1988)

This BIOS shows the same bumper screen as the US v1.3 BIOS (except the date is changed to 1988). If, at the end of this phase, buttons [Up]+[1]+[2] are being pressed on controller 1 (and no other buttons), it runs the same "Snail Maze" secret game as the US/European Master System BIOS v1.3. If not, it checks for valid data on the three slots.

This aspect of its operation is almost identical to the US/European Master System BIOS v1.3. However, due to an overzealous optimization in that version (where an opcode's first byte is used as the last byte of the lookup table preceding it), which was overlooked in this version, the $2 checksum range will not be correctly summed.

It additionally includes support in the checksum routines to save and restore the current mapped bank (assuming a Sega mapper).

If no game is found, instead of showing an information screen, it runs a copy of Hang On and Safari Hunt built in to the BIOS ROM. This game has plenty of unused space for the BIOS routines to be added.

ROM part code: MPR-11459A

Dumped by Mike Gordon.

This is a 128K ROM requiring slot 2 mapping.

US/European BIOS v3.4 with Hang On (1988)

This BIOS functions identically to US/European BIOS v2.4 with Hang On and Safari Hunt, except that its built-in game is Hang On. This game is small so most of the BIOS ROM is blank.

ROM part code: MPR-11458

Dumped by Mike Gordon.

This is a 128K ROM requiring slot 2 mapping.

US/European BIOS v4.4 with Missile Defense 3-D (1988)

This BIOS functions almost identically to US/European BIOS v2.4 with Hang On and Safari Hunt, except that its built-in game is Missile Defense 3D", and it does not feature the "Snail Maze" secret game.

It was only included with some the "Super System" packages (including 3-D glasses and a light phaser); some of these packages instead had another BIOS and Missile Defense 3D as a separate cartridge.

The "Snail Maze" game was probably removed due to lack of space; "Missile Defense 3-D" does not have as much unused space as "Hang On and Safari Hunt".

US/European BIOS with Alex Kidd in Miracle World (1990)

US/European BIOS with Alex Kidd in Miracle World bumper screen
US/European BIOS with Alex Kidd in Miracle World bumper screen

This BIOS features a different bumper screen to previous versions, with just a static Sega logo and no sound. It does not feature the "Snail Maze" secret game.

Its checking routines are almost identical to those of the US/European BIOS v4.4. The built-in game is now Alex Kidd in Miracle World. The $2 checksum range bug is fixed, even though the previously released incompatible BIOSes meant that it could not be used.

The removed items ("Master System" logo, animation, music, "Snail Maze" game) meant that the checksumming code was minimised and was more feasible to insert into unused space in game with an almost-full ROM.

The game is almost the same as the cartridge version, except that:

ROM part code: MPR-12808

Dumped by Mike Gordon.

This is a 128K ROM requiring slot 2 mapping.

European BIOS with Sonic The Hedgehog (1991)

European BIOS with Sonic the Hedgehog bumper screen
European BIOS with Sonic the Hedgehog bumper screen

This BIOS displays a slightly different bumper screen to "US/European BIOS with Alex Kidd in Miracle World", and again with no logo animation, music or "Snail Maze" game for the same reasons. the built-in game is now Sonic The Hedgehog.

Its checksumming routines seem to be taken from the US/European Master System BIOS v1.3 - they do not feature any of the later changes, and the $2 checksum range bug is not found.

It is worth noting that this BIOS was only featured in Master System II systems which have no card or expansion slots; but it attempts to check them anyway.

The game itself is slightly different from the cartridge version - to make room for the BIOS routines, the credits have been removed.

ROM part code: MPR-15155

This is a 256K ROM requiring mapping in both slot 1 and slot 2.

Korean Samsung Gam*Boy/Aladdin Boy II BIOS with Alex Kidd in Miracle World

The BIOS detection code here has to take a similar approach to the Japanese BIOS, in that it cannot assume there will be a header in the ROM, so there is no checksum or region test. Because it is based on different hardware from the Japanese system (an SMS2 variant), it can take a simpler approach: it assumes that unconnected slots will have their data lines tied high, so it checks if there is any non-$FF data in the first 16 bytes of each slot.

Similar to the Sonic BIOS, it checks all three slots (card, cartridge and expansion) even though two of them are not implemented in the hardware.

Game Gear

Game Gear BIOS bumper screen (GG mode)
Game Gear BIOS bumper screen
(GG mode)
Game Gear BIOS bumper screen (SMS mode)
Game Gear BIOS bumper screen
(SMS mode)

No BIOS

Early Game Gear systems have no BIOS.

"Majesco" Game Gear BIOS

This BIOS writes and reads two bytes to and from port $02, in order to detect if it is in GG mode or SMS mode so it can use the correct palette data. In GG mode, this port is for the Gear to Gear Cable, and reading it returns what was written; in SMS mode, its use is uncertain, but it seems from the BIOS that it returns something other than what was written.

It then checks the cartridge at offsets $7ff0, $3ff0 and then $1ff0 for the ASCII string "TMR SEGA". If it is found, it turns on the screen to show a bumper screen with the text "PRODUCED BY OR UNDER LICENSE FROM SEGA ENTERPRISES, LTD." as shown on the right; it then pauses for a few seconds before running the game. If the text is not found, the screen is left turned off and the system is locked up.

This BIOS was first noticed in the Game Gear systems released in 2000 by Majesco, but has since been confirmed to be found in many of the later Sega-distributed Game Gear systems, for example in boards manufactured in 1993.


SF-7000

See the SF-7000 IPL.

Other systems

All other Sega 8-bit home systems (SG-1000, SC-3000, Mark III) have no BIOS.

Some Mega Drive piracy devices have a boot ROM that runs in SMS mode:

Feature Overview

Here is a table of the features/behaviours of the various BIOSes:

BIOSSnail mazeRequired stringChecks regionChecks checksumSlots$2 range bugHeader locations
M404 prototypeCOPYRIGHT SEGACard, Cart, Expn/a$7fe0
1.0 (Prototype)TMR SEGACard, Cart, Exp$7ff0, $3ff0, $1ff0
1.3 (US/EU)TMR SEGACard, Cart, Exp$7ff0, $3ff0, $1ff0
2.0 (??)Card, Cart, Expn/an/a
2.1 (JP)Card, Cart, Expn/an/a
2.4 (Hang On/Safari Hunt)TMR SEGACard, Cart, Exp$7ff0, $3ff0, $1ff0
3.4 (Hang On)TMR SEGACard, Cart, Exp$7ff0, $3ff0, $1ff0
4.4 (Missile Defense 3-D)TMR SEGACard, Cart, Exp$7ff0, $3ff0, $1ff0
Alex Kidd in Miracle WorldTMR SEGACard, Cart, Exp$7ff0, $3ff0, $1ff0
Sonic The HedgehogTMR SEGACard, Cart, Exp$7ff0, $3ff0, $1ff0
Alex Kidd in Miracle World (KR)Card, Cart, Expn/an/a
Game GearTMR SEGACartn/a$7ff0, $3ff0, $1ff0



Return to top
0.34s