Friday, 27 November 2015

Commodore 64 PLA replacements

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

A common cause of  a black screen*, garbage on the screen, intermittent startup or general instability in Commodore 64's is the 906114-01 PLA chip. A custom gate array chip which handles all the address decoding in the C64. As usual, original stocks dried up many years ago, but there are various options to replace these. It is sometimes a bit of a lottery, as the timing in the C64 was never quite right. You can get a C64 that will only work with some PLAs, or PLAs that will only work in certain C64s.
I've tried various things in the past, a popular option is to use an EPROM to replace the PLA. This just need a bit or rewiring, I've tried that a few times (see previous article on C64 EPROM PLA replacements). It sort of works, but with mixed results, better on some boards than others.
There are a few designs around using CPLDs, but most of the 5V ones have been discontinued, so they would need 3.3V to 5V level shifters  on the outputs. I did try building one with two GAL chips a couple of years ago. I'm going to revisit that at some point, as it should be viable, but I haven't quite got the equations right yet.
Timing seems to be an issue, only certain EPROMs seem to work at the right speed, the Atmel AT27C512R-45PU (45nS) being a good choice. It appears the reason for the timing issues is that one signal (/CASRAM) needs to be delayed a little longer than the rest. When designing the two GAL version above, I passed that signal from the first chip through to the second to get the additional delay. That led me to adding an additional gate delay onto the EPROM board. I built this one with TTL logic gates buffering the /CASRAM signal between the EPROM and the board, shown without the headers for clarity.
The jumpers select 1, 2, 3 or 4 gate propagation delays, adding around 30 to 120nS to that signal. That works well in a lot of cases, 1 or 2 delays (30nS or 60nS) seems to be good for a lot of boards. Another simple option demonstrated in this video shows you can get a similar effect by adding some additional capacitance to the pin.
I've built up some boards with space for a suitable capacitor, 68 or 82pF being around the right value. It should probably be an RC filter, but just the C seems to work.
I've tested this on several boards, and it seems to work quite well. Testing over several hours with the diagnostics cartridge and test harness and with an assortment of games it seems to run well,
I dug out a a couple of boards which has been a bit picky about PLAs in the past, one liked it, one didn't. I've used turned pin headers which fit into most sockets. I've had a few boards with intermittent sockets, so it is worth replacing them with turned pin sockets. Also in a fit of optimism, some boards actually have the PLA factory soldered in.
After all the above photos, this one may look like a mistake, I've put the PLA in the socket at the back of the case, not the middle. Bit it isn't a mistake, at least not a mistake by me. The PLA is indeed in a different place. For some reason Commodore had a board that had been around for several years and several revisions with the only two 28pin socketed chips close by each other in the middle of the board. When they came to revise that board, not much else changed (apart from the VIC II and surroundings). But some clever chap decided to swap around the SID and the PLA between the two most common versions of the C64, the 250407 and the 250425.
What's great is the SID has 12V on pin 28, and the PLA has 5V. Get them the wrong way around and you fry the PLA. If it doubt, power on with both sockets empty and measure the voltage at pin 28, or look for the two capacitors around pins 1-4 of the SID. I've had at least one C64 arrive with those chips the wrong way around, and a baking hot PLA running at 12V. Since the PLA outputs are pulled up to it's supply voltage, that also sends up to 12V to some of the pins that are outputs on the PLA. On the SID these pins are some of the data and address bus, so can send 12V to most of the chips on the board. Oh dear, not a good move.
I have some of both the logic gate delay and the capacitor delay board. I can supply these with a programmed 27C512, tested on some of my Commdore 64's.Whether they work on your particular C64 is difficult to say. It would be nice to have a guaranteed replacement, but no sign so far.

* N.B. when I say black screen, this is video sync but only a black screen displayed. This is different from no video sync, which usually indicates the VIC II chip is at fault.