C64 PLA chip replacement using an EPROM and adaptor 3-13-2012.
C64 PLA chip replacement using an EPROM and adaptor latest updates and corrections 3-13-2012 The supply of replacement ICs for Commodore computers has been shrinking since Commodore stopped making chips more than a decade ago. Most of what you find now are used "pulls" from existing equipment, some good, some bad. The most common failure in the C64 has been IC U17, a pre-programmed 28 pin generic 82S100 programmable logic array or PLA. That IC normally runs very hot and should have been heat sinked. It was in later versions of the 64. Since the supply of obsolete unprogrammed 82S100 ICs has likewise dried up, a way to replace the Commodore PLA with some other kind of device has been discussed many times on the newsgroup comp.sys.cbm and elsewhere. A 64K EPROM programmed with the code from a working PLA and rewired via a circuit board or other adaptor to cross-connect a few pins has had some success in duplicating the logic of the original PLA. There are several different versions of this modification on the internet. Note that the code for the EPROM must match the pinout of the adaptor that goes with it! The modification I found takes only a few pin swaps to make it work. The other one takes more. Guess which one I chose to use? ;-) With a "burner" on my PC, I began experimenting with various types of EPROMs when my stock of PLA chips was depleted. The original PLA averaged a rather speedy 50nS. The best information I had early on was that a very fast IC was needed to simulate it. Most reprogrammable UV EPROMs are much slower at 150 to 300nS and I already had some of those. A one-time-programmable (OTP) Atmel AT27C512R45 seemed fast enough with its 45nS response time and they were cheap at the time, so a batch of the OTP chips was purchased and some adaptors made out of "sandwiched" IC sockets. One adaptor was needed to extract the PLA code and get it into my computer, and another adaptor to make the programmed EPROM work in the C64. I'm putting up both adaptor schematics and the code on my site if anyone wants to make their own substitute PLA. The resulting replacement ICs do work in many C64 boards but not in others, even ones with the same board number. Now to the reasons... One of my C64 boards (250407) will work with just about any PLA substitute EPROM from the slowest 250nS to the fastest OTP. Other boards are -very- fussy about the replacement PLA. Results with those boards varied from blank screen to less than the normal bytes free at startup to random charactor color errors or program crashes... common indicators of a failing OEM PLA or bad RAM. The sub-PLA could be made to work in some boards by replacing the VIC, the MPU and/or the CIAs. For example, a CPU with a later code date worked in a board with a sub-PLA whereas the earlier CPU chip wouldn't even boot up (blank screen). My oldest 64 board, a 1982 326298, gave me the most trouble. Most of the chips in it are early versions. Swapping some of them out with newer ones made that board work fine. The original RAM ICs Commodore used were either 150nS or 200nS. RAM chips of a certain speed may work with the original PLA but not with the sub-PLA. In one experiment, a sub-PLA worked with all 200nS RAM, then one 150nS RAM chip was substituted, and the bytes free at startup was reduced although the original PLA worked fine with that arrangement. I conclude that C64 ICs work within a narrow "window" of acceptable pulse timing, neither too fast nor too slow. The use of a substitute PLA in some boards obviously creates timing errors, some fatal (blank screen) and others producing subtle screen "glitches" and program crashes. If an EPROM works in a particular board, that's fine. But, what do you do if no sub-PLA seems to work? One workaround I found was to add a small capacitor (one end tied to ground) to the replacement IC output pin 18, the \CAS line to the RAM, which adds a bit of delay to those pulses. I experimented with values between 50pF and 220pF. The bottom line here is that whatever board you have may or may not work 100% with a sub-PLA. It may need to be "tweeked", and most users will not want to do that. So, a drop-in replacement for the original PLA that will work with all boards without any problems is still unavailable. One user found that an ST M27C512-90B6 EPROM worked in most of his boards. That seems to be the best substitute using an EPROM for a replacement PLA. There are apparently others that have made replacements using other chip types. When I repair a C64 that needs a replacement PLA, I can make the sub work in most cases with chip swaps, selecting an optimum speed of the substitute EPROM and/or by using the time delay capacitor. Testing the final product involves 1. observing the bytes free on the opening screen to see if it's normal, 2. looking for "glitches", random color shifts or odd characters anywhere on the screen while a program is running, 3. testing with several different cartridges such as CBM Jupiter Lander (which refused to load in one board when everything else seemed to work) and a passing grade using the C64 diagnostic cart some kind soul gave me years ago. Making the substitute PLA is pretty straightforward. With a few pins rewired via an adaptor (schematic is readpla.jpg) I made with two "sandwiched" IC sockets, I used my ERPOM burner to copy the code from a working PLA chip. The burner reads it as if it were a 27C512 EPROM and the resulting file pla.bin has a checksum of hex DAA0. That code was burned into a standard 27C512 EPROM. I then used another cross-wired adaptor (schematic is eprompla.jpg) to install the EPROM in my C64. One last thing... replacing a PLA with an EPROM in an adaptor socket that plugs into a board-mounted IC socket may cause intermittant operation if the board socket has loose contacts. One way around that is to use an adaptor socket with round pins that are thicker than the standard replacement types. Of course the mod PLA socket can be soldered into the C64 board directly. It's likely to be the last time it will be replaced anyway... as long as it works correctly the first time it's installed. It doesn't need to be heat sinked like the original PLA should have been... the new chip runs cool. Ray Carlsen