Amiga 500 Restoration: A501 Memory Expansion
The previous posts were mostly about cosmetics. This one is more technical, dealing with the repair and some preventative maintenance of the A501 memory expansion card. If you are curious to learn more about the retrobrighting of the computer’s case, don’t worry — I’ll get back to that at a later time.
This is the third post in a series about restoring an Amiga 500 back to its former glory. Here are all of them so far. I’ll try to remember to update this in all related entry.
Amiga Memory — The Basics
When the Amiga 500 was first introduced, it came with 512KB of memory. That was already double the amount the original Amiga 1000 had, but still not a whole lot. Especially when developers started to get familiar with the audio and video capabilities of the machine, RAM became a limiting factor in what you could do. Merely copying a single floppy disk with its 880KB required swapping back and forth between the source and destination disks, because there was no way the contents could be loaded into a memory buffer in one go.
So one of the more popular additions to any stock Amiga 500 was the A501 memory expansion card. There were a few original Commodore revisions, and a plethora of 3rd party clones. They all get installed in the so-called "trapdoor slot", aptly named, because it is reachable by opening a cover on the underside of the computer. With it installed, the Amiga now has 1MB of RAM to work with — a way better baseline for many tasks. I will not go into detail here on the different kinds and speeds of Amiga RAM here. It is a rather complicated story because depending on several hardware and software factors memory could have different speeds and capabilities, especially when it came to the custom graphics and sound hardware. Suffice it to say though, that even the slowest possible expansion is still better than the rather anemic stock 512KB.
When buying my Amiga from eBay I made sure, that it came with a memory expansion. In my case, it even was an original Commodore A501.
The Real Time Clock
In addition to the extra memory virtually all trapdoor expansion boards also add a battery-buffered real time clock. The Amiga itself — apart from very late models — does not have a clock on board. Without one, whenever the power is turned off, the computer forgets the date and time. When you switch it on the next time, it believes it's sometime early in the 1980s, or whatever the last modification timestamp of your boot disk is (which in my opinion is even worse). The A501 fixes that. It brings a clock chip, a very small amount of memory dedicated to keeping the date and time, and a rechargeable NiCd battery to supply the chip while the computer is off. When the computer is on, it gets charged up again. That way software can read the current time and date from the expansion on boot, sparing the user the tedious task of having to set it manually every time.
Batteries don’t age well...
So far so good. Unfortunately, batteries — especially NiCd ones — tend to leak when they get old. When that happens, the chemicals from inside the battery start to corrode and aggressively dissolve anything they come in contact with. Over time, this effect spreads — almost like an infection — across the memory expansion board, destroying the copper traces, solder joints, etc. Given enough time, it will creep into chips and destroy them from the inside. My original Amiga suffered this fate when its battery leaked unbeknownst to me while it was in storage. When I finally tried to use it again years later, it would not even start up to the Kickstart screen, because the damage had spread and eaten parts of the motherboard.
As I remember, it looked quite similar to this poor thing. The pictures were taken from part 1 of Keith Noneya’s YouTube series on meticulously repairing a heavily damaged A501 board. I recommend watching it. The 2nd picture shows that the copper was completely dissolved around where the battery was connected to the board.
So with my new arrival — which was functioning according to the eBay seller — one of the first starts I took was to remove the A501 expansion from the computer and inspect it closely for signs of battery leakage, before even turning the computer on. To do so, I had to remove the metal shield the board was encapsulated in:
To do so, just with the RF shield covering the computer’s mainboard, a series of metal tabs must be opened. Unfortunately, on the A501 they are not just bent over, but also soldered shut. Obviously, Commodore didn’t want curious customers to peek inside. But with a little patience, and armed with a soldering iron, a simple desoldering pump, and some copper braid, I got it open. The pictures show the position of the tabs, and one close up.
If you intend to put the board back into the metal case later, make sure not to lose the plastic sheet that is inside, insulating the underside of the board from the metal of the case. Without it, you would get random short circuits between the soldering joints! You can, of course, also just leave the shield off afterward. Most of the 3rd-party clones did not even have one in the first place.
Removing the Leaking Battery
Fortunately, at first glance my board was not in a bad shape, even though the battery had definitely already begun to leak. This is what one side of the contacts looked like:
The green crust is corrosion, and it has already spread down along the connectors. So it was clear, it needed to be taken off the board. To do so, I heated the soldering points on the underside of the board thought the copper braid. Carefully taking turns heating each of the joints, with a careful but firm pull on the battery from the upper side, it came off after a few cycles.
Once it was out, some minor damage became obvious, but luckily nothing serious:
I cleaned the area with an old toothbrush and Q-tips. To neutralize the alkaline battery fluid residue, I used some vinegar first and cleaned everything up later with and isopropyl alcohol. I took a bit of time to make sure the through-hole and the back of the board were also cleaned. Once everything had dried up, it looked not much different from before, just the crusty bits were gone.
With the battery removed, the RAM expansion worked. That was a good start. But of course, it could not keep the time while off anymore. So this needed to be fixed next.
Building a Battery Replacement Board
While in theory I could have gotten an identical or at least similar battery type, that one would be prone to leaking over time, too. So I — and others before me — wanted to use a more common and more reliable battery type as a replacement. The omnipresent CR2032 coin cell has a nominal voltage of 3V. Even though this is less than the original battery’s 3.6V, the OKI clock chip’s specifications say it can keep working down to 2.0V. With a capacity of about 240mAh (as opposed to only 60-80mAh in the original NiCd), it could theoretically keep the clock chip powered for more than 2 or even 3 years. Good enough for my taste, especially because they are cheap and easy to get, should the need arise.
However, because they are not rechargeable, precautions must be taken to keep the Amiga’s charging current away from it. Otherwise you could be in for some nasty fireworks.
My first idea was to just follow Jan Beta’s lead closely and put a coin cell holder directly onto the A501. However, for a few reasons I decided to modify my approach a bit:
The battery holder I bought has a very tight spring keeping the battery in place. Getting it out for replacement takes quite a bit of force, and I didn’t want to risk damage to the A501 in the process.
- In Jan’s video, you can see that the cell holder does not fit on the board too well, making it a bit difficult to get the A501 into the trap door slot. The same was true for the one I had.
- This being one of the first things I ever soldered in my life, I wanted to limit the risk for the A501 of me damaging accidentally to a minimum.
So I decided to build a little extra circuit on a piece of perfboard. On that, I would place the cell holder, a diode and some additional resistors, which are recommended by a CR2032 manufacturer. This is what it looks like from the top:
I measured 5V charging voltage coming from the Amiga. For that, the PDF linked above recommends at least 200Ω of protective resistance. I only had 150Ω resistors at hand, so in total it is now 300Ω. This is only the second “line of defense” — usually the diode ensures that the battery does not get charged by blocking the charging current from the computer. At the bottom there is a 2 point pin header for jumper wires that then go to the A501.
From below, this is what the board looks like. Notice the I flipped the previous picture, so it aligns with the bottom view.
Finally, after checking everything with the multimeter, I wrapped the edges and the bottom side of the board with insulating tape:
On the A501 I needed to add pin headers, too, to allow me to hook up my little creation. Getting two single pins off of the larger piece took a few tries, because the plastic was rather brittle. But with an old fruit knife and some patience, I managed to do it.
Putting it all together
With the A501 prepared, I could now connect the external battery holder board with two jumper wires.
And because thankfully there is quite a bit of free space in the Amiga’s case, I could easily mount the battery board right next to the trapdoor. I put a power strip on the inside of the bottom case and just stuck the board on there:
The isolating tape sticks to the Power Strip pretty tightly, so I am not worried it will easily come loose. The wires are long enough so that I can take out the A501 through the trapdoor and either disconnect them, or reach in and wiggle off the battery board. This should allow me to safely swap the battery in the future.
Battery Backed up Clock (not) found?
With all this being done, I confidently booted up a Workbench disk. Just to be greeted with this:
I must admit, I was a little disappointed. Should all the careful repair work have been in vain, because in the end the clock chip had been damaged by something in the past? At this point in the Amiga’s startup sequence the
setclock load command is called. It tries to load the time from the expansion board. Apparently, it either could not find the clock chip at all, or at least could not read from it.
I continued to boot and attempted to save the time, both using the Preferences application, as well as via a Shell and
setclock save. Same error message as before: Battery Backed up Clock not found.
Browsing through some forums I learned, that apparently the clock chip memory can get in a corrupt state if it is disconnected from the battery. For these cases, the recommended solution was to run
setclock reset. This, however, apparently is not supported on (my) Workbench 1.3, so no luck there.
Fortunately, a little later I came across this thread on amiga.org with a link to Thomas Rapp’s homepage. In the download area, he offers a little utility called RestartClock. It comes in binary and (assembly language) source code in the RestartClock.lha archive. From what I can tell, it calls the underlying OS clock reset function to bring it back into a known state. So I downloaded it onto my Mac, just to face the next problem: How do I get it onto the Amiga?
File Transfer without a cable — Back to BASIC
With the Amiga RestartClock executable on my Mac, I was stuck. I did not have a serial (null-modem) cable at hand, which I figured I could use to send the file over. But even if I did, I couldn’t find my RS232-to-USB dongle. So I needed another way to get the program across the air-gap. At this point the prospect of ordering a cable and waiting for it to arrive did not appeal to me very much 🙂
I remembered how back in the day we used to type in pages and pages of program listings from computer magazines, because only very few (expensive ones) came with floppy disks attached. Granted, most of that was done on my first computer, the Atari 800XL, but I digress… So just typing on the Amiga would probably not take very long.
But not having an assembler for the Amiga at hand meant that I needed to bring over the binary version. What I did have was an Extras 1.3 disk with AmigaBASIC on it. I figured, if I hex-dumped the executable on the Mac, I could write a small BASIC program to output these bytes into a new file. This is the program:
OPEN "ram:RestartClock" FOR OUTPUT AS #1
IF n MOD 40 = 0 THEN PRINT
IF x<0 THEN x=x+256
The DATA statements at the bottom contain the dumped bytes of the RestartClock executable. The hex dump was created with
hexdump -e'"%07.8_ad " 8/1 "%03d " " " 8/1 "%03d " " |"' -e'16/1 "%_p" "|\n"' RestartClock
on the Mac. It took me only about 5 passes of double checking them all after the initial entry. And boy, had I forgotten how slow and unwieldy AmigaBASIC is! I figure that the roundabout two hours I spent on this were evenly split between reading up on the Amiga BASIC syntax and functions, finding and fixing mistakes in the hex dump, and waiting for the painfully slow scrolling in listing window. That’s why with my original Amiga back in the day I gave up on the thing, as I recalled. If memory serves, I moved on to "GFA Basic" back then, which I remember as way more responsive.
Anyway, when run, the program reads the bytes from the data area one by one, and adds them to a new file in the RAM disk, outputting some progress along the way. You can see how long that takes for a mere 400 bytes. The first attempts were way slower still, because they contained more on-screen output.
I crossed my fingers and ran the newly created command in a shell:
It looked promising, so I then set the date and time in Preferences, saved, and powered off the computer for a good 2 minutes. I then booted into Workbench again, and what do you know:
It worked! I was lucky enough to have a Workbench disk "fresh" enough to not barf at the year 2018. Evidently there are different versions of software and hardware around, exhibiting different more or less annoying bugs related to date and time. I found this “Workbench (Issue 139) [PDF]” magazine from 1998 which has few interesting details on this.
I certainly could have waited for the new RS232-USB-dongle (which has arrived by now, of course). But I really wanted to solve this right then and there, and in retrospect I am glad I did. The whole procedure reminded me, how something that seems trivial – especially by today’s standards – can require some creative thinking. Still, I wouldn't want to go back to regularly transcribing pages and pages of listings from magazines anymore.
Should you go through the same procedure, I highly recommend saving the generated RestartClock program on the Workbench disk (or somewhere other than just RAM disk). When I had to disconnect the battery from the A501 again for some other repairs, the clock was corrupted and needed to be restarted. At that point I was very happy not to have to go through the hex-dump again 😁.