Cartridge slot
- Cartridge pins
- Standard address decoding
- Advanced address decoding
- The
/CART
signal - The
/M3
signal - Video signals
- Audio input
- Reset signals
Cartridge pins
Signals 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
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:
- Pull
/CART
low (tie to ground) - Leave
/M3
floating (unconnected)
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:
Signal | Function in our case |
---|---|
/CE_0 | Chip enable for $000000-$3FFFFF
|
/TIME | Chip enable for $A13000-$A130FF
|
/CAS0 | Output enable |
/UWR | Write enable for upper byte |
/LWR | Write 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.
$400000-$7FFFFF
: Mega CD memory$A12000-$A12FFF
: Mega CD ports$800000-$9FFFFF
: 32X memory$A15000-$A15FFF
: 32X and SVP ports
The following ranges should not be stomped either for compatibility with
the Teradrive (basically $AE0000-$BFFFFF
):
$AE0000-$AEFFFF
: Teradrive registers$AF0000-$AFFFFF
: Teradrive window to PC ports$B00000-$BFFFFF
: Teradrive window to PC memory
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:
/CART
| Cartridge slot | Expansion slot | |||
---|---|---|---|---|---|
Low | $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).
Signal | Function |
---|---|
EDCLK | Video clock for H40 |
/VSYNC | Vertical sync |
/HSYNC | Horizontal sync |
/YS | Background 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.