Monday, 13 October 2014

Commodore 64 Diagnostics Test Harness

This is something I've been meaning to get around to for a while, and testing the Commodore 128 has brought it to the front. Last year I built up a couple of Commodore 64 Diagnostic cartridges, the C64 Dead Test and the standard C64 Diag.
They both test RAM, VIC and SID functions, the standard diagnostic cartridge can also test the external ports of the C64. With just the cartridge, these test fail, the keyboard is reported as open, and the cassette, control, serial, user ports and interrupt tests are marked as bad. The chip list shows the two 6526 CIA's are shown as bad these drive the ports. The 6581 SID is also shown as bad even if you can hear it playing the sound test, as it provides two analogue inputs for the control ports.
To test these, most of the ports need loopback adapters, basically sending a single to one pin and reading it back via a loopback connection to another pin. There are a couple of schematics on the net. The first appears to be reverse engineered from an original test harness. This is slightly difficult to follow as all the wiring goes back to a 26 pin connector on the user port adapter, so you have to trace it through that. The second source also includes ROM images and manuals for the diagnostic cartridges. contains a slightly different schematic and also the ROM image. Credit to all those guys for providing the schematics.
I've been adding bits as required over time. The first was the serial loopback, The red button on the top is wired as a reset switch.
The next was the user port. The Commodore original had a cartridge sized box as part of the user port, which housed the circuitry for the control ports, but that meant a lot of wires going from there to the control ports, The user port tests is just a series of loopback connections, all it got from there was power, which can also be got from the control ports, so I just made this as a loopback.
The cassette port is also looped back, but provides a switching signal to the control port tests, derived from three outputs via two resistors. There is some discrepancy between the two schematics I referred to, the resistors values are exchanges and there is no loopback. I built mine according to the first and it seems to work fine.
These two were given D shell covers (37 way for the user port and 15 way for the cassette port) which fit reasonably well.
I made the keyboard connector loopback form on old keyboard cable. I've also added an LED and resistor to form a power indicator.
The joystick tester uses two 4066 switches to switch the fire button and four direction signals between the two ports. Theses are controlled by the signal from the cassette port. I built these up on a small board. Also on there are the four 120K resistors used to test the X and Y analogue inputs on each port.
This was all housed in a small box to hopefully plug directly into the side of the case. It didn't quite work out as it obstructs the power switch, and also the sloped side of the C64C case.
To get around this, I made a set of extenders for the joystick connections. Just a plug soldered to a socket with some tape wrapped around.
With these extenders, it fits fine, just looks a bit odd.
And that completes the loopback test setup.
Without opening the case, the keyboard tests shows 'open', but all the others now pass.
This board has been removed from it's case, and the keyboard loopback installed. All tests now pass.
I had a productive day going through a small backlog of faulty C64 boards, All but a few were repaired, or at least the faulty chips marked up for replacements. At the end of the day, I tracked down a couple of faulty 6526 CIA's, a couple of 6569 VICs, and a faulty 6510 CPU. There were more 6581 SID's than I usually find (several partial failures), and the usual pile of 906114-01 PLAs. Also fixed but not shown, a couple of 7406's, some 4264 DRAM's and a 74LS257 - most of the memory faults had previously been fixed.
The same cable set can be used on the C64C.
And also on the C128, which is where all this started.