Pac-man (bootleg) Repair Logs

From Arcade Otaku Wiki
Jump to: navigation, search

Repairer: Asayuki

Symptom: Music notes never stopping

Date: 3/Sep/2016

This bootleg board had a very funny issue on the audio: the notes of the music wouldn't stop and kept playing forever.

Check out for yourself: https://www.youtube.com/watch?v=Ckdzzu7wxBY

As you can hear, the music that plays when the game starts does not have the characteristic "staccato effect" which is typical of the Pac Man game.

(proper Pac-Man music for reference: https://www.youtube.com/watch?v=dScq4P5gn4A&t=43s)

A lot of people wouldn't even notice the issue (let alone the seller of the board, who insisted that everything was fine, because of course!) until the music stops; in the first video you can somewhat hear that the last note keeps playing indefinitely after the music has finished playing. The note stops once I insert another coin; you can clearly hear the difference before and after that.

I initially tought this would be a software issue, because everything else seemed just fine and all the other sounds played quite well. I was definitely wrong, but this has been quite difficult to prove. I dumped the ROMset and found out that it was a weird mixture of files from several different sets all of which were already known to MAME. Since both this weird mixture and the missing Namco logo were disturbing to me, I decided to reprogram the board with a specific known ROMset which is a bootleg of the original japanese set. The Namco logo was back again after the cure, and the ROMset was in a state that was confirmed by emulation to have no sound issues. Yet, the audio issue persisted. I needed to use my logic analyzer and compare the behaviour of the board with the code's behaviour under MAME's debugger to realize what the problem was. And I had to delve deep into the sound generation logic of the game. The schematics of this Namco game are available; this made my fascinating trip a lot easier.

Schematic portion of the audio section.

This schematic looks cryptic and strange, but it's a very clever design. Imagine Commodore's famous SID chip, with its internal three voices, different waveforms, ADSR and stuff. The Namco engineers implemented all that in software assisted TTL logic!

First of all, let me give you a reading key: the objects at 2L and 2K (74LS89) are two 16x4 RAMs. Yes, you read that correctly: 16 locations by 4 bits each! A total of 32 nibbles. The object at 1K (74LS283) is a 4 bit adder, the one at 1L (74LS174) is a latch. The custom at 1M is just a PAL with some custom logic from Namco. We'll see in a moment what it does, but for the time being you can consider that as a PROM. Finally there is another latch at 2M (74LS273) and two weighted resistors DAC circuits separated by a 4066 analog switch at 1N.

To understand how this works, we need a bit more information which is there in MAME (pacman.cpp) for the taking: the 32 nibbles stored in 2L and 2K are:

  • 20 bit (5 nibbles) accumulator for voice 1
  • 4 bit (1 nibble) waveform selector for voice 1
  • 16 bit (4 nibbles) accumulator for voice 2
  • 4 bit waveform selector for voice 2
  • 16 bit accumulator for voice 3
  • 4 bit waveform selector for voice 3
  • 20 bit frequency value for voice 1
  • 4 bit volume level for voice 1
  • 16 bit frequency value for voice 2
  • 4 bit volume level for voice 2
  • 16 bit frequency value for voice 3
  • 4 bit volume level for voice 3

Frequency and volume codes are stored in the memory at 2L, while accumulator and waveform are stored in the memory at 2K. The interrupt handler code of the CPU, called at the end of each video frame, copies blindly from the main CPU RAM to these two memories 32 values which it has elaborated previously. Therefore the audio generator gets updated once per frame. Writing is done through the multiplexers at 3L (74LS157) and 3K (74LS158). The latter has a feature which inverts the output bits you feed in, which is a clever way of compensating for the RAMs at 2L and 2K also having inverted outputs. When the CPU is not writing to these two memories, the multiplexers are switched to let the hardware control the memories. The PAL at 3M (bottom left of the schematic) takes care of timing this hardware access.

All 32 values are read sequentially, 8 bits at a time. Once all of them has been read, the sequence repeats. This occurs very fast because it's timed by the horizontal scanning counter (4H, 8H, 16H and 32H). The frequency values come out LSB first from 2L, and at the same time the accumulator values come out LSB first from 2K. 1K sums them together and latches them in 1L so that the result is presented to the PAL at 1M. The result is also fed back to the RAM at 2K and written there as the new value for the accumulator. Since this is done 4 bits at a time, it's hard to follow. But for the sake of simplicity imagine the following:

You have a 16 bit value you call "accumulator". At regular intervals you sum this value to a constant 16 bit quantity you call "frequency". Your accumulator will increment by the given amount with every sum. The larger the frequency value, the faster the accumulator will increment. Once the accumulator has reached the maximum value it can hold, it will roll back to zero and keep counting. With this mechanism you have generated a "ramp" of upward-going numbers which gets steeper as you increase the frequency. Sounds familiar already? Now you can use this ramp of numbers as addresses into a wave table, right? That's exactly the purpose of the PAL at 1M. It internally generates digital audio waveforms based on this ramp value provided by the last nibble of the sum through its inputs A[0:4]. The other nibbles are just used for counting and don't take part in the actual sound data lookup. The waveform is selected by the inputs A[5:7] which come from the RAM at 2K. The 4 bit audio waveform data is then stored by the latch at 2M which presents it to the weighted resistors R6, R7, R8 and R9 at its outputs (Q[5:8]). At the other end of those resistors we have an analog signal.

The RAM at 2L also contains volume values, which are latched at the same time as the digital audio data from the sound generator PAL. These volume values are used to enable the single switches in the 4066 at 1N. These, in turn, forward or block the audio signal to the second weighted resistor set R1, R2, R3, R4 and R5. The final result is the ability to control the volume of the analog signal emitted by the sound generator.

Now that you know the entire mechanism you can better see the importance of the timing PAL at 3M, without which it wouldn't be possible to run this entire orchestra.

Back to our issue, it turned out that Pacman's audio code is lazy and doesn't clean up after its mess. It doesn't zero out the frequency registers when the notes finish playing, but rather shuts them up forcibly by setting a zero volume for them. Can you see where this is going? Yes, the 4066 analog switch at 1N had one defective switch which was letting the sound through even when it was not supposed to. Funny, eh? :)

Stage clear
Lucky bonus



Repairer: channelmaniac

Model: Pac-1 / Pac-2 Pac Man board set Symptom: Dead. Audio amp chip gets VERY hot.

Board has 2 edge connectors. The smaller one had a homebrew JAMMA adapter connected to it.

Board had activity on the EPROMs but no video out. Checked the pinout of the board on the large connector, traced it over to the small connector, and found that the board did not have the video pinned out correctly to the adapter. Checked the pinout and found the adapter to be totally wired wrong.

Rewired the adapter and when pinning out the small connector I found that there was no Coin 1 input on it. Used an unused pin and wired it to the Coin 1 pin on the large connector. Tested the board when finished.


Model: Pac-1 / Pac-2 Pac Man board set Tip: Pinout for small connector

1: Gnd
2: Gnd
3: Gnd
4: Speaker +
5: +12v
6: N/C
7: N/C
8: N/C
9: +5v
10: Player 1 Down
11: Player 2 Down
12: Player 2 Start
13: Player 1 Start
14: Player 1 Right
15: Player 1 Left
16: Blue
17: Green
18: Sync

A: Gnd
B: Gnd
C: Gnd
D: Speaker Gnd
E: +12v
F:
H:
I:
K: +5v
L:
M:
N: Coin 1 (Must be added! Connect to pin I on the large connector - across from pin 8)
P: Coin 2
R: Player 1 Up
S: Red
T: Player 2 Right
U: Player 2 Left
V: Player 2 Up

Coin 1 input is NOT available on the small connector. Use the unused pad at location N to add it. Run a jumper wire from Pin I on the large connector to the pad at location N.


Model: Pac-1 / Pac-2 Tip: Software ROMs

The ROMs aren't readily available for this board but, the Namco Pac Man code is what it uses. It's just divided into 2716 EPROMs instead of 2732.

I didn't test all of them, but the EPROMs I did check are coded as this:

Pac-1 CPU board:
6E: Lower half of namcopac.6e
6F: Lower half of namcopac.6f
6H: Not checked
6J: Not checked
6K: Upper half of namcopac.6e
6M: Upper half of namcopac.6f
6N: Not checked
6P: Not checked

I would assume the rest would follow suit as would the video EPROMs on the Pac-2 video board.

The ROM code was found in the puckman.zip file used for MAME.


Model: Pac-1 / Pac-2 Pac Man board set Tip: Pinout for large connector

1: Gnd
2: Gnd
3: +5v
4: +5v
5: +7.5v Unregulated
6: 2 Player Start Lamp
7: Coin Counter
8: Coins 2 Switch
9: Service Switch
10: 2 Player Start
11: 1 Player Right
12: 2 Player Up
13: 2 Player Right
14: 1 Player Down
15: Gnd (Use for Speaker -)
16: Video Green
17: Video Sync
18: Speaker +
19: +12v
20: +12v
21: Gnd
22: Gnd

A: Gnd
B: Gnd
C: +5v
D: +5v
E: +7.5 Unregulated
F: 1 Player Start Lamp
H: Lock Out Solenoid
I: Coin 1 Switch
K: Test Switch
L: 1 Player Start
M: 1 Player Left
N: 1 Player Up
P: 2 Player Left
R: Gnd for Table Mode (Unconnected for upright)
S: Gnd
T: Video Red
U: Video Blue
V: 2 Player Down
W: +12v
X: +12v
Y: Gnd
Z: Gnd

Pinout courtesy of the Mowerman website. His site was down at the time I needed this but the Internet Archive had a copy.