Port Expander IC24 (Sega Mega-Tech)
The IC24 I/O Expander CXD1095 connects the SMS Z80 data pins to various places, including the YM2612 sound IC, buttons and the custom PAL chips.
There are 8 bits to the port expander, and 5 ports, meaning the Z80 can interface with 5 different bytes of information coming from 5 sources (except for Port X which is only 4 bits).
As the CXD is setup, it basically multiplexes one of the ports (A, B, C, D and X) to the data pins of the SMS Z80.
All outside connectors to the physical buttons (buttons from Player 1 CN4, Player 2 CN7 and Select CN2 for example) pass through NEC 2501 photocouplers to isolate the buttons physical shorting to ground from the ICs inputs. It adds a bit of protection.
The buttons are pulled high on the diode Anode side (positive), and then the button shorts the Cathode (negative) to ground to turn the LED on, which in turn saturates the base of the photo-sensitive transistor on the output side (pins 9-16) triggering the output sides (Collectors) to pull low also.
To bypass the photo coupler ICs all together you can just short the collector pins (10, 12, 14 and 16) to ground to simulate button presses.
When Port A is selected it maps the data pins to various buttons.
CXD Port Pin | Through | Final Pin |
A0 | IC36 Pin 16 > Pin 2 | SELECT (CN2 Pin 1) |
A1 | IC36 Pin 14 > Pin 4 | ?? (CN2 Pin 2) |
A2 | IC36 Pin 12 > Pin 6 | ??(CN2 Pin 3) |
A3 | IC36 Pin 10 > Pin 8 | ?? (CN2 Pin 4) |
A4 | IC35 Pin 16 > Pin 2 | DOOR SW 1 (CN2 Pin 5) |
A5 | IC35 Pin 14 > Pin 4 | DOOR SW 2 (CN2 Pin 6) |
A6 | IC35 Pin 12 > Pin 6 | ??? (CN2 Pin 7) |
A7 | IC35 Pin 10 > Pin 8 | TEST (CN2 Pin 8) |
When Port B is selected it maps the data pins to various buttons.
CXD Port Pin | Through | Final Pin |
B0 | IC26 Pin 16 > Pin 2 | A1 (CN2 Pin 9) |
B1 | IC26 Pin 14 > Pin 4 | A2 (CN2 Pin 10) |
B2 | IC26 Pin 12 > Pin 6 | A3 (CN2 Pin 11) |
B3 | IC26 Pin 10 > Pin 8 | A4 (CN2 Pin 12) |
B4 | IC25 Pin 16 > Pin 2 | SERVICE (CN2 Pin 13) |
B5 | IC25 Pin 14 > Pin 4 | ENTER (CN2 Pin 14) |
B6 | IC63 Pin 10 > Pin 8 | P1 Start (CN4 Pin 8) |
B7 | IC46 Pin 10 > Pin 8 | P2 Start (CN7 Pin 8) |
Port C connects to all 8 cartridge slots pin B26 (!ASEL) which are for row/column address multiplex control for DRAM of each cartridge slot.
Slot 1 to 8 are pins PC0 through 7.
If a game is inserted it pulls !ASEL low, letting the SMS Z80 know there is a game in the slot. Otherwise, the pin is high.
So, if you have a game in slot 1 and 6, the binary data on PC0-7 would be 11011110 where bits 5 and 0 are low.
Port D4 goes to the IC23 Inverter input pin 5, which the output pin 6 goes to the OR gate of IC21 pin 4, who's output pin 6 goes to the Mega Drive Z80 !Reset pin 18.
Port D2 (pin 22) and D3 (pin 23) go to the IC51 OR Gate (pin 10, pin 9) which controls the enabling of the controller buttons to the Mega Drive.
The rest of the port D goes to the 74LS245 Bus Transceiver (IC13) near the Audio IC.
The Port D connects to the A side of the transceiver, and the B side connects to YM2612 Audio IC.
This port is responsible for connecting the YM2612 D0-7 to the SMS Z80 D0-7.
Port X goes to the custom PAL chips 315-5347 and 315-5348.
These two PAL16L8BCN chips appear to interface some of the pins of the 315-5313 and 68k of the Mega Drive system, to the CXD I/O Expander back to the SMS Z80.
CXD Port Pin | Through | Final Pin |
X0 | IC30 315-5348 Pin 16 > ??? | ??? |
X1 | RA9 Pin 4 | ??? |
X2 | RA9 Pin 3 | IC57 Pin 5 P1 START/C AND Gate |
X3 | IC31 315-5347 Pin 1 > ??? | ??? |
There are several ways to trigger the buttons presses.
The first and most obvious is to join the pull-up 5V to the 5V of the system, and short the actual button pins on the external connectors to ground.
However, this requires fully working photo-couplers. Perhaps those are bad. Instead, you can just ground the associated port pins on the CXD1095 (IC24) to ground for the specific button you want to press. This method does not require the external 5V pull-up shorting together either.