Repair & Schematics
Sega Mega-Tech Arcade

Mega Drive Game Load (Sega Mega-Tech)

24min

Depending on which game you insert, the 68k and Z80 come out of reset differently.

Choose a Mega Drive game like Sonic The Hedgehog 2 for Mega Drive load.

If you are unsure which type of game you have, measure with a multimeter in the cartridge between the !M3 (pin B30) and ground (A1 / A32).

B30 is the third pin in from the right when looking at the game, and grounds are the outer 2 pins on the back plane.

If the pin is shorted, it is a Master System game.

Detecting Mega Drive Games

The 315-5308 is responsible for querying the cartridge slots !M3 (pin 78).

This pin left floating high means it is a Mega Drive game (Not a Mark 3 Master System game).

If you observe the 315-5308 !M3 (pin 78) during boot, if the game is a Mega Drive game it will remain high all the time.

It is best to do this test with a single game inserted so you know the M3 line is always related to that cartridge.

Cartridge connector pinout
Cartridge connector pinout
īģŋ
315-5308 Pinout
315-5308 Pinout
īģŋ

Game Loading

Game data involves many circuits:

  • 68k - Main Game Processing
  • 315-5313 - Work RAM control and Video Processing
  • 315-5308 - Controls 68k/Z80/WRAM/VRAM bus control flow
  • Z80 - Mostly game audio

The 68k is mostly responsible for reading in and processing the cartridge game data.

The 315-5313 processes the video data and controls the 68k work RAM (!UWR, !LWR, !OE0, !CAS0 and !RAS0).

  • All Address / Data pins of the cartridge ultimately connect to the 68k (through buffers).
  • !MRES for cartridge reset is controlled by ??? and should always be high once the SMS system releases the Mega Drive to boot.
  • !CAS0 goes to the 315-5313.
  • !CE0 is used to enable (when low) the Game ROM. These are controlled by IC70 demultiplexer 74F138.
  • !Header OE is used to enable (when low) the Header ROM.
  • !AS is the address strobe output from the 68k.
  • !DTACK is the data transfer acknowledge to the 68k (this is controlled by multiple things not just the cartridge so will still pulse without a cartridge).
  • !UWR and !LWR stay high until a game has loaded then start pulsing as the upper/lower RAM get used.
  • !VRES is the system reset and should always be high just after !MRES. This is tied directly to the 68k reset.
  • !TIME is not important for game load.
  • !M3 is grounded by the cartridge to be in Master System mode.
Cartridge connector pinout
Cartridge connector pinout
īģŋ
68k Pinout
68k Pinout
īģŋ
315-5313 Pinout
315-5313 Pinout
īģŋ

Confirmation Stage Of Boot

It is important to first figure out at what stage the console thinks it is in. This starts with detecting if the no cartridge operation seems valid, then if the game detect seems valid, and finally if a game looks like it has successfully loaded.

Once you confirm that, if you get to game load and still have no AV output you can look more at the AV portion of the system.

Below are some key points to probe with an oscilloscope to easily detect if you are at a certain stage.

Initial operation

The initial operation confirms the 68k and glue logic chips appear to be operational and running as expected.

With the console turned on and a game inserted, set a trigger to capture a rise/fall on the 68k reset line and observe for the following:

The 68k and 315-xxx chips should come out of reset, while reading the header ROM, then go into reset, and come out again when attempting to then load the game ROM.

If loading a Mega Drive game, on the second reset high pulse (Game ROM load) the 68k !DTACK, !CAS0, !AS and !ASEL should all pulses low. If the game load fails it will be just a few times then remain high.

Here is an example of the second high reset pulse on a failed game load (blue is reset pin, red is !AS pin).

Failed game load
Failed game load
īģŋ

The 68k Address 1 (pin 29) will pulse a few pulses when booting.

Address pin 1 (No Game)
Address pin 1 (No Game)
īģŋ

Cartridge Present

There are only a few checks needed to confirm if the system realises there is a game inserted.

When cart is in, it should pull the !CART pin to ground. Measure it with a multimeter to confirm. On the Mega-Tech this is sent through the I/O Port Expander IC24 on Port C.

Reading Game Headers

The SMS Z80 reads the Port C of the I/O expander to determine which cartridge slots have their !CART pin low indicating a game is present.

After this, for each game starting at 8 and working back, it reads the header ROM.

That means when the system wants to read from the cartridge at all it first sets CE0 to low.

When it wants to read header information it sets the !Header OE to low, and !CAS0 to high.

When it wants to read the Game ROM it sets the !Header OE to high and !CAS0 to low.

The !CE0 pins are controlled by the 74F138 demultiplexer IC70.

The !Header OE pins are controlled by the 74F138 demultiplexer IC41.

The !CAS0 pins are controlled by the 74F138 demultiplexer IC39.

For all of the demultiplexers:

  • A0/1/2 follow the truth table for which cartridge is being controlled
  • !E0 is always low
  • E2 is always high
  • !E1 is high then pulses low during the time the output is being controlled
74F138 Pinout
74F138 Pinout
īģŋ

To check if the Z80 sees a game present, observe the data pins coming out of the I/O Expander into the SMS Z80 Data pins from Port C, for them going low.

Once it is detected, you should be able to observe an attempt to read the game header first by probing the !Header OE pins (IC41 pins 7, and 9 to 15) pulsing low and the !CE0 (IC70 pins 7, and 9 to 15) pulsing low the same, and finally the !CAS0 pins (IC39 pins 7, and 9 to 15) going high on each cartridge right after out of reset.

The cartridges go in order, so !Q0 (pin 15) is cartridge slot 1 and !Q7 (pin 7) is cartridge slot 8.

During the period when the header is being read the pin constantly pulses, it doesn't just stay low. See below an example where the game header is being read in the first half.

Document image
īģŋ

NOTE: Game headers are read from cartridge slot 8 first, and slot 1 last.

If you do not see the expected signals on the CAS0, !Header OE or !CE0 pins, check the A0, A1 and A2 pins as well as !E pins which control the output pins.

TODO: Complete trace pinout for these chips

You should also then see the 68k Data and address pins toggling.

Systems Check OK

The Mega Drive does a basic system checks on initial boot, which ensures the 315-5313 can communicate with the 315-5308 and 315-5309.

Once this communication is established it reads the game data by releasing the bus master to the 68k (through the 315-5348) and if it is valid and the game starts, it brings the Z80 out of reset.

Game Loading

Once the system has initialized, the 315-5313 should send its !BGACK (pin 100) high going to the 315-5348 (pin 4), which in turn outputs it releases its pin 17 going to the 68k !BGACK (pin 12) allowing it to float high and become bus master.

At this point the 68k starts to toggle its address lines reading in the data from the data bus (ultimately going to the game cartridge) and load the game.

Once loaded, the !BGACK pin will periodically (every frame, 50/60Hz), assert low handing over control to the Z80 (I presume, haven't checked) for about 200us.

Here is how the !RESET, !BGACK, Data and Address pins look during boot.

68k Game Load
68k Game Load
īģŋ

Failed Game Load

The most consistent way I have found to detect a failed game load on a Mega Drive game is observer the A5 address pin of the 68k as shown above in yellow.

If the game fails to load, it will stop right after the Game Load section and go low and stay low.

If you observer the D5 data pin, it will do similar but float high once it has failed.

Game Loaded

The final check is if the game has successfully loaded.

Capture on the 68k reset line, a period before the second rise is when the game ROM is read. So after the header has been read the !Header OE pin should go high, and the !CE0 and !CAS0 should start toggling low to enable the game ROM, followed by the address and data pins toggling to read the data.

The confirmation of successful load is ultimately the !BGACK pin starts to toggle low (releasing control to the Z80 for audio processing).

The !CE0 pins are controlled by the 74F138 demultiplexer IC70.

The !Header OE pins are controlled by the 74F138 demultiplexer IC41.

The 74F138 sends the cartridge pins low when the A0 to A2 pins are changed.

74F138 Pinout
74F138 Pinout
īģŋ
74F138 Logic Table
74F138 Logic Table
īģŋ

Usually, a bad game stops reading almost instantly and the reset line with go back low. Address 1 of the 68k (pin 29) is a good place to monitor, and if it stops fast then something is wrong (the data, the enable pins, the cartrige pins etc...) so the data read in is invalid and game loads stops.

Address 1 (Failed Load)
Address 1 (Failed Load)
īģŋ

If you see constant activity it's a good sign the game is running.

Also !UWR and !LWR (also go to 68k pins 7 and 8) only pulse when game has loaded, otherwise always high. So, if you see activity on these pins, it is another confirmation.

Finally, you should see !DTACK, !CAS0, !AS and !ASEL are all also constantly pulsing.

Cartridge Detect (Mega-Tech)

The SMS Z80 uses the IC24 CXD1095Q port expander to read the pin B26 (what is !ASEL on Mega Drive) pins of each cartridges.

I presume B26 on the Mega-Tech cartridges is !CART. I am 99% sure of this as the cartridges also sink B26 to ground.

CXD1095 Pinout
CXD1095 Pinout
īģŋ

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).

When Port C is selected on the I/O Expander, it maps the SMS Z80 data pins to pin B26 (!CART). Slot 1 to 8 are pins PC0 through 7 which then map to the Z80 D0-7.

The Z80 basically reads a single byte in which tells it which of the 8 cartridges are present by which bits are low.

Cartridge connector pinout
Cartridge connector pinout
īģŋ
Z80 SMS Pinout
Z80 SMS Pinout
īģŋ

16-bit Data Path

The 68k data pins all pass through two transceivers IC50 and IC53 above the 68k. These are 74245 bus transceivers.

74245 Pinout
74245 Pinout
īģŋ

The DIR pins 1 are connected together and controlled by the 315-5349 to the right of it, on pin 5. The DIR also go to the IC52 74HC244 octal buffer pin 17 (2A4 input).

The !OE pins 19 are connected together and controlled by the 315-5349 to the right of it, on pin 12.

Both DIR and !OE should pulse constantly during out of reset metadata loading.

The 68k ZD lower byte of data (D0-7) goes into the A bus of the transceiver above it (IC53 74HC245).

The 68k ZD upper byte of data (D8-15) goes into the A bus of the transceiver above it (IC50 74HC245).

The B buses go to the cartridge data pins.

23-bit Address Path

The address pins A1-23 all pass through a bunch of 74HC244 Octal Buffers.

74244 Pinout
74244 Pinout
īģŋ

The first byte of the address A1-A8 go through the IC38 on the 8 inputs.

The second byte of the address A9-16 go through IC40 on the 8 inputs.

The last 7 bits of the address A17-23 go through IC42 on 7 of the 8 inputs.

Then all the outputs map to the cartridge address pins.

The !OE are tied to VCC, and the !2OE are enabled by the 315-5348 pin 20.

All address and data pins on all 8 cartridges are tied together.

Checking Traces

Here is a trace map for checking continuity.

Cartridge 68K Trace Routes
Cartridge 68K Trace Routes
īģŋ

Black Screen On Parts of Games

One thing to be aware of is parts of some games, like Sonic 2 intro demo right after the Player 1 / Player 2 screen, can show as black when using some monitors (or in my case an OSSC), as certain games can use a mode called Interlace Mode 2.

Thanks to david656 and mourix for the insight from ukvac.com forums.

Sonic 2's 2 player mode uses the Megadrive's Interlace Mode 2, which allows the system to output a 320x448 image by alternating between even and odd lines every frame. This allows the game to display two full screens' worth of graphics, at the cost of effectively halving the frame rate to 30.

īģŋ