Viewing the cartridge port from above, such that the cartridge label would face the bottom of the picture: Attach:sms-export-cart.png Applies to: All Master System consoles released outside Japan and Korea. %define=z80 border="1px solid #047" bgcolor=gray padding-left=0.5em padding-right=0.5em% %define=vdp border="1px solid #047" bgcolor=purple padding-left=0.5em padding-right=0.5em% %define=io border="1px solid #047" bgcolor=DimGray padding-left=0.5em padding-right=0.5em% ||border=1 ||! Description ||! Number||! Direction||! Connector ||!Direction ||!Number ||!Description || || Front|||||| @@┌───┐@@ ||Back |||||| || _NMI [[#NMI |Attach:info.png]]|| 50|| %vdp%VDP%% →|| @@│] [│@@ ||← %vdp%VDP%% ||49 ||[[#M |Attach:info.png]] _MC-F || || _KbSel [[#KbSel |Attach:info.png]]|| 48|| %vdp%VDP%% →|| @@│] [│@@ ||← ||47 ||[[#Clock |Attach:info.png]] _Clock || || _Reset [[#Reset |Attach:info.png]]|| 46|| %io%IO%% →|| @@│] [│@@ ||← %z80%Z80%% ||45 ||[[#BusAck |Attach:info.png]] _BusAck || || _BusReq [[#BusReq |Attach:info.png]]|| 44|| %z80%Z80%% ←|| @@│] [│@@ ||→ %io%IO%% ||43 ||[[#JyDs |Attach:info.png]] _JyDs || || _Int [[#Int |Attach:info.png]]|| 42|| %vdp%VDP%% →|| @@│] [│@@ ||← %z80%Z80%% ||41 ||[[#Wait |Attach:info.png]] _Wait || || _Halt [[#Halt |Attach:info.png]]|| 40|| %z80%Z80%% →|| @@│] [│@@ ||← %z80%Z80%% ||39 ||[[#Refresh|Attach:info.png]] _Refresh || || _IOReq [[#IOReq |Attach:info.png]]|| 38|| %z80%Z80%% →|| @@│] [│@@ ||← %z80%Z80%% ||31 ||[[#M1 |Attach:info.png]] _M1 || || A15 [[#address|Attach:info.png]]|| 36|| →|| @@│] [│@@ || ||33 ||[[#power |Attach:info.png]] +5V || || _CONT [[#CONT |Attach:info.png]]|| 34|| %io%IO%% ←|| @@│] [│@@ ||← ||35 ||[[#address|Attach:info.png]] A12 || || A7 [[#address|Attach:info.png]]|| 32|| →|| @@│] [│@@ ||← ||37 ||[[#address|Attach:info.png]] A6 || || A5 [[#address|Attach:info.png]]|| 30|| →|| @@│] [│@@ ||← ||29 ||[[#address|Attach:info.png]] A4 || || A3 [[#address|Attach:info.png]]|| 28|| →|| @@│] [│@@ ||← ||27 ||[[#address|Attach:info.png]] A2 || || A1 [[#address|Attach:info.png]]|| 26|| →|| @@│] [│@@ ||← ||25 ||[[#address|Attach:info.png]] A0 || || D0 [[#data |Attach:info.png]]|| 24|| ↔|| @@│] [│@@ ||↔ ||23 ||[[#data |Attach:info.png]] D1 || || D2 [[#data |Attach:info.png]]|| 22|| ↔|| @@│] [│@@ || ||21 ||[[#power |Attach:info.png]] Gnd || || Gnd [[#power |Attach:info.png]]|| 20|| || @@│] [│@@ || ||19 ||[[#power |Attach:info.png]] Gnd || || D3 [[#data |Attach:info.png]]|| 18|| ↔|| @@│] [│@@ ||↔ ||17 ||[[#data |Attach:info.png]] D4 || || D5 [[#data |Attach:info.png]]|| 16|| ↔|| @@│] [│@@ ||↔ ||15 ||[[#data |Attach:info.png]] D6 || || D7 [[#data |Attach:info.png]]|| 14|| ↔|| @@│] [│@@ ||← %io%IO%% ||13 ||[[#CE |Attach:info.png]] _CE || || A10 [[#address|Attach:info.png]]|| 12|| →|| @@│] [│@@ ||← %vdp%VDP%% ||11 ||[[#M |Attach:info.png]] _M0-7 || || A11 [[#address|Attach:info.png]]|| 10|| →|| @@│] [│@@ ||← ||9 ||[[#address|Attach:info.png]] A9 || || A8 [[#address|Attach:info.png]]|| 8|| →|| @@│] [│@@ ||← ||7 ||[[#address|Attach:info.png]] A13 || || A14 [[#address|Attach:info.png]]|| 6|| →|| @@│] [│@@ ||← %vdp%VDP%% ||5 ||[[#M |Attach:info.png]] _M8-B || || _Rd [[#rd |Attach:info.png]]|| 4|| %z80%Z80%% →|| @@│] [│@@ ||← %z80%Z80%% ||3 ||[[#MReq |Attach:info.png]] _MReq || || _Wr [[#wr |Attach:info.png]]|| 2|| %z80%Z80%% →|| @@│] [│@@ || ||1 ||[[#power |Attach:info.png]] +5V || || Front|||||| @@└───┘@@ ||Back |||||| Arrows indicate typical directions of signals (into or out of the slot). Note that address lines can be driven by the cartridge slot if the Z80 is asked to give up the bus. !!Pin descriptions See also [[Bus Signals]] for a more in-depth look at how the bus signals are generated. !!!Signals from Z80 Cartridges should not drive these, they are driven by the CPU. !!!![[#Halt]] _Halt - CPU is halted Not normally used by cartridges. Z80 CPU manual says: -> HALT State (output, active Low). _HALT indicates that the CPU has executed a HALT instruction and is waiting for either a non-maskable or a maskable interrupt (with the mask enabled) before operation can resume. During HALT, the CPU executes NOPs to maintain memory refresh. !!!![[#IOReq]] _IOReq - I/O request vs memory request Z80 CPU manual says: -> Input/Output Request (output, active Low, tristate). _IORQ indicates that the lower half of the address bus holds a valid I/O address for an I/O read or write operation. _IORQ is also generated concurrently with _M1 during an interrupt acknowledge cycle to indicate that an interrupt response vector can be placed on the data bus. !!!![[#address]] Address lines These specify the address for a memory or I/O read or write. !!!![[#rd]] _Rd - Read Z80 CPU manual says: -> Read (output, active Low, tristate). _RD indicates that the CPU wants to read data from memory or an I/O device. The addressed I/O device or memory should use this signal to gate data onto the CPU data bus. !!!![[#wr]] _Wr - Write Z80 CPU manual says: -> Write (output, active Low, tristate). _WR indicates that the CPU data bus holds valid data to be stored at the addressed memory or I/O location. !!!![[#MReq]] _MReq Z80 CPU manual says: -> Memory Request (output, active Low, tristate). _MREQ indicates that the address bus holds a valid address for a memory read of memory write operation. !!!![[#BusAck]] _BusAck This is low in response to a [[#BusReq|bus request]]. Z80 CPU manual says: -> Bus Acknowledge (output, active Low). Bus Acknowledge indicates to the requesting device that the CPU address bus, data bus, and control signals _MREQ, _IORQ _RD, and _WR have entered their high-impedance states. The external circuitry can now control these lines. !!!![[#Wait]] _Wait Z80 CPU manual says: -> WAIT (input, active Low). _WAIT communicates to the CPU that the addressed memory or I/O devices are not ready for a data transfer. The CPU continues to enter a _WAIT state as long as this signal is active. Extended _WAIT periods can prevent the CPU from properly refreshing dynamic memory. This is not normally driven by the cartridge. !!!![[#Refresh]] _Refresh Z80 CPU manual says: -> Refresh (output, active Low). _RFSH, together with _MREQ indicates that the lower seven bits of the system’s address bus can be used as a refresh address to the system’s dynamic memories. This is intended for use with on-cart DRAM that needs to be refreshed. !!!![[#M1]] _M1 Z80 CPU manual says: -> Machine Cycle One (output, active Low). _M1, together with _MREQ, indicates that the current machine cycle is the opcode fetch cycle of an instruction execution. _M1 together with _IORQ, indicates an interrupt acknowledge cycle. !!!Signals to Z80 !!!![[#BusReq]] BusReq - Bus Request If driven low, the cartridge is asking the CPU to let it write to the address/data bus. Z80 CPU manual says: -> Bus Request (input, active Low). Bus Request has a higher priority than _NMI and is always recognized at the end of the current machine cycle. BUSREQ forces the CPU address bus, data bus, and control signals MREQ IORQ, RD, and WR to go to a high-impedance state so that other devices can control these lines. BUSREQ is normally wired-OR and requires an external pull-up for these applications. Extended BUSREQ periods due to extensive DMA operations can prevent the CPU from properly refreshing dynamic RAMS. See also [[#BusAck|BusAck]]. No original cartridges do this, but some homebrew prototypes have been made which use it for "DMA" functionality - having something on the cartridge drive the bus for faster writes to system RAM, the PSG and the VDP. !!![[#data]] Data pins The data pins are how data is transferred to or from the cartridge. A ROM-only cartridge should only drive these when there is an active memory request and _CE is low, but they can also be read by a mapper chip and when writing to SRAM. !!!I/O chip signals !!!![[#Reset]] Reset Signal sent from the I/O chip to reset the system on startup. Cartridges may use this to initialise their state. !!!![[#CONT]] CONT The value of this bit (high or low) is readable on the [[PeripheralPorts#PortDDIOPortBAndMiscellaneous|second controller input port]]. !!!![[#CE]] _CE Chip enable, active low. The I/O chip will only lower this for the slot when it's enabled via [[port $3e]], and a memory request is active (_MReq is also low). !!!![[#JyDs]] JyDs, aka KILLGA If driven high, the I/O chip will ignore requests to the [[peripheral ports]] (i.e. reading the controllers). This can allow cartridge hardware to use the $c0..$ff I/O space. !!!Signals from the VDP The VDP does some gate logic to provide some useful signals to the cartridge that are derived from other pins. It is also in charge of generating both maskable (VDP-related) and non-maskable (Pause button) interrutps. !!!![[#Int]] _Int - Interrupt Low when a frame or line interrupt is triggered by the VDP. Not normally used by cartridges. This is sent to the Z80 and also to the cartridge slot. Z80 CPU manual says: -> Interrupt Request (input, active Low). Interrupt Request is generated by I/O devices. The CPU honors a request at the end of the current instruction if the internal software-controlled interrupt enable flip-flop (IFF) is enabled. _INT is normally wired-OR and requires an external pull-up for these applications. !!!![[#NMI]] _NMI - Non-Maskable Interrupt Low when NMI is triggered by the Pause button being pressed. Not normally used by cartridges. This is sent to the Z80 and also to the cartridge slot. Because it's managed by the VDP, NMI always happens at a consistent point in the video frame. Z80 CPU manual says: -> Input/Output Request (output, active Low, tristate). _IORQ indicates that the lower half of the address bus holds a valid I/O address for an I/O read or write operation. _IORQ is also generated concurrently with _M1 during an interrupt acknowledge cycle to indicate that an interrupt response vector can be placed on the data bus. !!![[#M]] _M0-7, _M8-B, _MC-F (aka _EXM2, _EXM1, _CSRAM) These are low when memory address ranges $0000-$7fff (slots 0 and 1), $8000-$bfff (slot 2) and $c000..$ffff (system RAM area) have active memory requests. They are just the logical OR of _MReq and the relevant address line [@ _M0-7 = _EXM2 = _MReq + A15 _M8-B = _EXM1 = _MReq + !A15 + A14 _MC-F = _CSRAM = _MReq + !A15 + !A14 @] !!!![[#KbSel]] _KbSel (aka JRead) This is low when the controller ports are being accessed - specifically, when an I/O port in the range $c0..$ff are being accessed. It is therefore also low when the [[YM2413]] or [[audio control port]] are being accessed. !!!Other things !!![[#Clock]] _Clock This is the system master clock signal, e.g. 3579545Hz for NTSC systems. !!![[#power]] Gnd, +5V These are the power connections.