The Master System and later hardware supports multiple media - the card and cartridge - as well as featuring an expansion port and a BIOS. All of these are executed from the same space - the memory region $0000-$BFFF. Obviously there has to be some arbitration method to allow them to share this space without problems. This is done by hardware controlling various other sections' ENABLE control lines; this functionality is accessed via port $3E.

Earlier systems (the Mark III and earlier) either only had one media slot, or used a hardware method to activate only one slot: the cartridge provides a bridge between VCC and a line connected to the card's OE line, thereby disabling the card if both are connected simultaneously. (This precedence was reversed in BIOS-using systems.)

Port bits

BitFunctionNo effect on
7Expansion slot enableSMS2, GG, Genesis
6Cartridge slot enableGG, Genesis
5Card slot enableSMS2, GG, Genesis
4RAM enable 
3BIOS ROM enableGenesis
2I/O enableGG, Genesis

All bits are active low: writing a value of 1 disables the corresponding functionality, writing 0 enables it.


The main uses of port $3E are for the BIOS and for accessing the YM2413 hardware.

The BIOS runs code from RAM which disables the BIOS ROM and enables the three other slots in turn (card, cartridge, expansion). It then performs detection routines and runs the code from the first slot with valid data.

The YM2413 hardware is mapped such that it conflicts with the I/O hardware's mapping in the Z80's I/O port map. The YM2413 subsystem includes hardware to automatically disable the I/O hardware when appropriate; but when detecting the YM2413 hardware, it is necessary to disable I/O via port $3E to avoid false detection.

GG BIOS mapping

When enabled, the GG BIOS maps to $0000-$03FF; the rest of the lower 48KB maps to the cartridge as normal. When disabled, the first 1KB of the cartridge fills that space.


Return to top