Cartridge slot

Cartridge pins

Mega Drive cartridge slot pinout. B side (front), from left to right: B1 SL1, B2 /MRES, B3 SR2, B4 VA9, B5 VA10, B6 VA18, B7 VA19, B8 VA20, B9 VA21, B10 VA22, B11 VA23, B12 /YS, B13 /VSYNC, B14 /HSYNC, B15 EDCLK, B16 /CAS0, B17 /CE_0, B18 /AS, B19 VCLK, B20 /DTACK, B21 /CAS2, B22 VD15, B23 VD14, B24 VD13, B25 VD12, B26 /ASEL, B27 /VRES, B28 /LWR, B29 /UWR, B30 /M3, B31 /TIME, B32 /CART. A side (back), from left to right: A1 GND, A2 VCC, A3 VA8, A4 VA11, A5 VA7, A6 VA12, A7 VA6, A8 VA13, A9 VA5, A10 VA14, A11 VA4, A12 VA15, A13 VA3, A14 VA16, A15 VA2, A16 VA17, A17 VA1, A18 GND, A19 VAD7, A20 VD0, A21 VD8, A22 VD6, A23 VD1, A24 VD9, A25 VD5, A26 VD2, A27 VD10, A28 VD4, A29 VD3, A30 VD11, A31 VCC, A32 GND.

Signals in Mega Drive mode

Cartridge pins function in Mega Drive mode
Pin Function
/M3 Leave floating for Mega Drive mode
/CART Pull low to boot from cartridge
VD15-VD0 Data bus
VA23-VA1 Address bus
/CE_0 Chip enable for $000000-$3FFFFF
/TIME Chip enable for $A13000-$A130FF
/UWR Write enable for upper byte of a word
/LWR Write enable for lower byte of a word
/CAS0 Output enable for $000000-$DFFFFF
/CAS2 Column address strobe for DRAM
/ASEL Row/column address multiplex control for DRAM
/DTACK 68000 data acknowledge
/AS 68000 address strobe
VCLK 68000 clock
EDCLK Video H40 clock
/VSYNC Video signal vertical sync
/HSYNC Video signal horizontal sync
/YS Asserted when outputting background color
SL1 Analog audio input (left speaker)
SR1 Analog audio input (right speaker)
/MRES Hard reset (e.g. Power button)
/VRES Soft reset (e.g. Reset button)

Signals in Master System mode

Cartridge pins function in Master System mode
Pin Function
/M3 Pull low for Master System mode
VD7-VD0 Data bus
VA16-VA1 Address bus
VA17 Card chip enable
VA18 Cartridge chip enable
VA19 Master System's /IOREQ
VA21 Pull low when running off card slot
VA22 ??? (PBC pulls it low)
VA23 Pause button (low logic)
/LWR Write enable
/CAS0 Output enable
/CE_0 Chip enable for $0000-$7FFF
/CAS2 Chip enable for $8000-$BFFF
/MRES Hard reset (e.g. Power button)
/VRES Always low (ignore it!!)

The video (/YS, /VSYNC, /HSYNC and EDCLK) and audio (SL1 and SR1) signals work exactly the same as in Mega Drive mode (the latter are useful to provide the Master System FM add-on from the cartridge itself).

Standard address decoding

For starters, Mega Drive cartridges should do the following:

Most of the time you just care about read (and maybe write) accesses to the usual cartridge ranges ($000000-$3FFFFF and $A13000-$A130FF). The signals you need to decode in this case (besides address and data bus) are these:

Signals needed for normal cartridge access
SignalFunction in our case
/CE_0Chip enable for $000000-$3FFFFF
/TIMEChip enable for $A13000-$A130FF
/CAS0Output enable
/UWRWrite enable for upper byte
/LWRWrite enable for lower byte

When doing a read the 68000 always expects a word and picks the bytes it wants.

When doing a write, /UWR is asserted for even bytes, /LWR for odd bytes, and both for word accesses. Note that some hardware may assume only byte or word accesses and expect the software to do the correct thing.

Advanced address decoding

The cartridge slot gets the full 68000 address, so it can take over any address it wants. To do so, it needs to decode the full address and pay attention to the /CAS0 (output enable) and /UWR and /LWR (write enables) signals. Note that /CAS0 is not asserted for the $E00000-$FFFFFF range (which is work RAM).

The console asserts /DTACK for the designated cartridge and expansion slot address ranges, as well as its own hardwre. In particular, it does not assert /DTACK for the $800000-$9FFFFF, $A15000-$A15FFF and $B00000-$BFFFFF ranges (as well as a bunch of other ranges). A cartridge that makes use of those ranges will need to pull low /DTACK on its own when accessing them (32X exploits this to arbitrate 68000 and SH-2 access timings to the cartridge).

The following ranges are used by the add-ons and trying to take over them will break compatibility with the Mega CD and 32X. Do not try to stomp on them unless you know what you're doing, people are not going to be happy if a game doesn't work without unplugging the add-ons.

The following ranges should not be stomped either for compatibility with the Teradrive (basically $AE0000-$BFFFFF):

The /CART signal

The Mega Drive can boot from either the cartridge or expansion slot. The way this works is through the /CART signal: when a bootable cartridge is inserted, this signal must be pulled low to let the console know to boot from cartridge.

What /CART actually does is change the address ranges of the main cartridge slot and expansion slot areas:

Address mappings depending on /CART
/CART Cartridge slot Expansion slot
Low $000000-$3FFFFF $400000-$7FFFFF
High $400000-$7FFFFF $000000-$3FFFFF

Note that the /CE_0 signal will be always asserted for whichever is the cartridge slot range (i.e. it accounts for the state of the /CART line).

The Mega CD back-up RAM cartridges are not bootable and show up at $400000. They do this by not pulling low /CART (letting the CD side to boot instead).

The /M3 signal

The /M3 signal is responsible for switching between Mega Drive and Master System modes. Mega Drive games must keep this line floating, while Master System games must pull it low (tie to ground).

Video signals

The Mega Drive has been designed with superimposing in mind (see: 32X). The required video signals are split between the AV output jack (which has the RGB values) and the cartridge slot (which has the remaining signals).

Video signals in cartridge slot
SignalFunction
EDCLKVideo clock for H40
/VSYNCVertical sync
/HSYNCHorizontal sync
/YSBackground color

The EDCLK signal is the pixel clock for the video output, you use this to know when to move onto the next pixel (one pixel is two EDCLK cycles). Note that this is the H40 mode clock, even if the VDP is currently outputting H32 (this is why the 32X only officially supports H40 mode).

The /YS signal goes low whenever the VDP is outputting the background color (i.e. not covered by any of the layers). This is useful to let you output graphics under the Mega Drive's video rather than on top.

Audio input

The cartridge can feed audio to the console through lines SL1 and SR1 (for the left and right speakers, respectively). The audio signal is mixed in with the rest of the audio.

For reference, the 32X's audio output is ±2V (with bias removal). It has enough impedance on its own (about 16 ohm) to feed a pair of headphones.

Reset signals

/MRES and /VRES are the console's reset signals. The former is asserted once when the console first powers on, while the latter is asserted alongside it and whenever the Reset button is pressed. Their main purpose is to let you reset whatever hardware you have on the cartridge (if needed).

Both are open drain and connected directly to the bus, meaning that while the console may assert it, the cartridge can also do it by pulling them low. Never pull them high when not asserting them.. The /MRES signal will reset the entire console while the /VRES signal will only reset the CPUs and YM2612 (but not the VDP and PSG). You usually want the latter.

Note that /VRES is completely useless in Master System mode since it's constantly held low by the console (presumably to keep the 68000 out of the way?). You'll have to rely on /MRES in that case.