6 Feb 2019

Master System II - Sega (uneconomical repair)

Some repairs aren't worth the effort an time they would need. I'm looking at you faulty Pit Fighter PCB! But giving up is the easy way and I like challenges.

Here we have a faulty Master System II. According to previous owner left direction for player 1 is stuck. I powered the console (with Alex Kidd built-in) and sure enough Alex went straight to the left. I opened the unit and found the custom chip handling (amongst other things) inputs was a 315-5237. SMSPower website has tons of info about the MS and is an extremely valuable source, thanks to all of you guys contributing to it. So I quickly found pinout and probed pins used for controls:
- P1 down was floating
- P1 left was stuck low (= seen as button depressed)
- P1 right was stuck low (= seen as button depressed)
Other controls seemed fine (P1 up/buttons, P2 controls). This was confirmed by testing the player 2 port with different games, however behaviour for player 1 changed from game to game:
- Alex Kidd = keeps going left and impossible to crouch/duck
- Double Dragon = keeps going down/right
- etc.

Not that way Alex!

Ugh... I'm cornered.

I suppose this all depends on how each game was coded and what priority was given between up/down and left/right directions.

Anyway pull-up resistors for those inputs are embedded in the custom chip and previous owner already installed an external resistor but it didn't do the trick. I measured resistance for all 3 faulty inputs and found:
- P1 down wasn't connected to anything internally (no pull-up resistor measured, in fact resistance was infinite with any other pin)
- P1 left and P1 right had only few dozens of ohms resistance with ground so wasn't surprising the external 4.7kohm resistor didn't work

I could have stopped there, custom chip being faulty I would have needed a replacement from an other Master System II with the same motherboard. Sega hardware is generally rock solid and only faults I've repaired before on Master System II were broken solders on the AV port and severed traces, in other words even if I had found a compatible donor it's likely repairing it would have been simple. At least simpler than pulling the DIP48 custom chip and transplanting it in the other console.

Having repaired older Sega hardware similar to the Master System (e.g. Mark III) I knew controls could be read and data sent on the bus with simple TTL chips. My idea was to reverse engineer the part of the 315-5237 custom chip handling inputs.
I started to build a small test circuit with the custom chip on a socket and a GAL chip to recreate the faulty part of the custom chip. I lifted pins of the custom chip corresponding to P1 down/left/right and data bits D1/D2/D3 in order to isolate them.


The Master System reads control trough two mapped ports $DC and $DD, inputs are latched to the data bus:
- $DC.d0 = P1 UP
- $DC.d1 = P1 DOWN
- $DC.d2 = P1 LEFT
- $DC.d3 = P1 RIGHT
- $DC.d4 = P1 BUTTON  1
- $DC.d5 = P1 BUTTON 2
- $DC.d6 = P2 UP
- $DC.d7 = P2 DOWN

- $DD.d0 = P2 LEFT
- $DD.d1 = P2 RIGHT
- $DD.d2 = P2 BUTTON 1
- $DD.d3 = P2 BUTTON 2
- $DD.d4 = RESET BUTTON (not present on MS2 anyway)
- $DD.d5 = Cartridge slot CONT signal
- $DD.d6 = P1 LIGHTGUN/REGION BIT 1
- $DD.d7 = P2 LIGHTGUN/REGION BIT 2

Given all other functions of the custom chip were working fine I went for the minimal replacement solution, that is to say reading of P1 DOWN/LEFT/RIGHT inputs and latching them to D1/D2/D3 on the data bus. It was quite easy to figure out equations. Here is the PLD file I wrote for a GAL16V8 chip in case someone else has a similar issue and wants to take inspiration (for some reason WinCUPL didn't allow me to use more than one term for the OE equations so I used a spare output, it might be a GAL16V8 limitation):

Name      315-5237_repair;
Partno    ;
Date      ;
Revision  ;
Designer  Apocalypse;
Company   ;
Assembly  None;
Location  None;
Device    G16V8;
/**  Inputs  **/
PIN 1 = JyDs;
PIN 2 = A0;
PIN 3 = A6;
PIN 4 = A7;
PIN 5 = RD;
PIN 6 = IOREQ;
PIN 7 = DOWN;
PIN 8 = LEFT;
PIN 9 = RIGHT;
PIN 11 = IN_OE;
/**  Outputs  **/
PIN 18 = D1_BUS;
PIN 17 = D2_BUS;
PIN 16 = D3_BUS;
PIN 15 = D1_5237;
PIN 14 = D2_5237;
PIN 13 = D3_5237;
PIN 12 = OUT_OE;
/** Logic Equations **/
OUT_OE = !RD & !JyDs & !IOREQ & A6 & A7;
D1_BUS.OE = IN_OE;
D2_BUS.OE = IN_OE;
D3_BUS.OE = IN_OE;
D1_BUS = !A0 & DOWN # A0 & D1_5237;
D2_BUS = !A0 & LEFT # A0 & D2_5237;
D3_BUS = !A0 & RIGHT # A0 & D3_5237;
D1_5237.OE = !IN_OE;
D2_5237.OE = !IN_OE;
D3_5237.OE = !IN_OE;
D1_5237 = D1_BUS;
D2_5237 = D2_BUS;
D3_5237 = D3_BUS;
And then was successfully tested:



Console (uneconomically) fixed.

No comments:

Post a Comment