Thursday, July 9, 2015

Restoring the Granddaddy of Modern Computers: the IBM 5150

It Was a Dinosaur Back Then...


At some point a very long time ago in my life, I acquired an IBM 5150 PC from my grandfather.  I'm not sure why he wanted to give it to me at that time, but I did have fond memories of playing old games on 5.25" floppy such as Grand Prix Circuit and Wheel of Fortune with my cousins on hot summer days in Grandpa's garage in Houston (along with a similarly vintage Ferrari 308GTB which always remained under wraps -- I didn't even realize it was blue until after he died), so I was definitely happy to take it.  (The computer, of course. ;)  By most people's definition, the 5150 is the root of the modern personal computer, but in the late '90s when I received the machine, I did not have the right skills nor tools to get it up and working; moreover, with no expansion cards installed (no floppy disk controller nor video card in particular), it would not have been very useful nor even easy to triage and fix.  Fast forward 16 or 17 years since my last attempt, during which time I got degrees in Computer Engineering and Computer Science, and with a little bit of inclination from an outside event, now there's a newly-restored 5150 sucking gobs of power off the grid. :-P

This restoration project was spurred by the closing of a computer store in Arlington, TX called Electronic Discount Sales.  They have been on Pioneer Pkwy for nearly 30 years, but the owner has finally decided after all this time that he wants to "semi-retire," so he has been working on closing the store for several months now by trying to self-liquidate all of the remaining merchandise.  It is quite a large building, probably occupied by a grocery store in its former life before EDS moved in.  The thing that makes this a highly unusual case, though, is EDS contains stuff he received new 10 or even 20 years ago that still has yet to sell.  From a business perspective, we're surprised he's stayed in business this long.  But from a nerd perspective, it is amazing a place such as this still exists with all sorts of retro gadgets we used to enjoy throughout our lives.  Whatever we need to fix or to get further enjoyment out of an old computer or console system, he probably has.  Despite some of this stuff reaching its "knee" in the market (it has stopped losing value and is actually gaining value again), they still had some of these gadgets at shockingly low prices, especially in the video games section.  (To be fair, it did seem like they were asking a lot of money for certain other things they were selling, particularly the "old but not quite vintage yet" laptops.)  Also, for those who remember the earliest PCs, they had a Computer Museum devoted to this old technology, which is also in the process of being liquidated.  It is mostly from the Computer Museum that I have been able to restore my machine to something that works, at least in the most "BASIC" way.

A view of Electronic Discount Sales

A shelf of software from the 1990s

80% Off Everything tends to reveal all the obscure artifacts from an era in computing I'm sure no one misses...

After sitting in my grandpa's garage for a long time, the old relic sat in my mom's garage for yet another 16 or 17 years.  When I opened it up that long ago, it seemed impossible to have been the exact same machine I played all those games on -- after all, it wasn't that long ago back then that I was playing them, and yet this machine was pretty well stripped down and even seemed to be a different color than I remembered.  I didn't even feel confident in turning it on, so I left it alone until two days after visiting EDS, when Mom was able to dig it up from her garage.  After acquiring it, I started reading up on the machine and trying to learn its capabilities and what would make it tick.  Many sources pointed to a book called Upgrading & Repairing PCs, of which I have several editions at Mom's house (including the original edition), so the next day, I met her to get that original edition.  By then, I had about four different ways to confirm some important information:
  • The BIOS on the system is the 3rd iteration BIOS from 10/27/1982 (the most bug-free of them all, but still not great).
  • The system needs expansion cards to do anything useful, such as display video or read from a floppy.
  • The power supply in this particular machine is not stock, and that is a good thing.  The original PSU was very noisy yet only about 40% as powerful as the one provided to me.

The first thing a circuit-savvy individual might wish to do upon receiving an ancient circuit, especially one that has been sitting in Texas garages for most of its life, is to replace any electrolytic capacitors.  We did this on our Gold Wings pinball machine from 1986, and along with other electronic modifications, it now runs like a champ.  Electrolytic capacitors tend to dry up over time due to either low-quality manufacturing or heat stresses on their bodies which will crack the dielectric, let in moisture, and introduce "gremlins" (odd phenomena you can't explain or is hard to troubleshoot when using an electronic device).  There are 16 electrolytic capacitors inside the power supply, but thankfullly, none on the motherboard.  After making careful notes detailing capacitance, voltage, and placement, I sent +DoesItPew to Tanner Electronics in Carrollton to obtain the needed capacitors for the PSU as well as for the two 360K 5.25" full-height floppy disk drives (which I'll get to restoring later).  I spent two or three hours removing and replacing these capacitors, and just after midnight, began putting it back together and eventually tested it on an early SATA hard drive that still had a 4-pin Molex connection for power.  It fired right up like a champ, and the voltages coming out of other Molex connectors appeared to be correct!  Obviously, the capacitor replacement worked (ultimately I'm not sure if it was totally necessary, but for the purposes of doing a good job on a long-lasting restoration, electrolytic capacitors should get replaced).

The next step was to plug this PSU into the motherboard.  However, the inside of this computer was caked full of dust and dirt from the onset.  It is not a good idea to turn on a dirty machine, so I spent a while carefully removing the motherboard and one of the floppy disk drives, and then using a dry toothbrush to brush off all sorts of dust and dirt from the case and motherboard.  I followed everything up with squirts of compressed air, and also did all this work outside in order to keep the house clean and make sure the dust doesn't get a chance to resettle in my machine (as it was a windy day, so the dust particles would blow elsewhere).

With the PC now cleaned (and some of the chips having their shiny luster restored :-P), I plugged the PSU into the motherboard, prayed to the computer gods above, and flipped the big On switch.

Nada.

Not even a sound from the speaker.

Thanks to many folks who have been down this road before, there are some good troubleshooting guides for debugging problems starting an IBM 5150 PC.  The possible symptoms when an IBM 5150 does not beep are that you have a bad power supply or a bad motherboard.  Just because you replace capacitors in the PSU doesn't mean it's all good; again, heat stresses or dust can work "magic" on your circuits so they don't work as intended.  While the computer was running, I whipped out a multimeter and probed the power supply lines in order to assure myself that the voltages coming out of it are good.  Everything checked out within the operating specifications.  Then, I powered the system off and checked the resistance between various "hot" lines and Ground on the motherboard.  Again, all these values appeared within spec.  All this work proves that the power supply is good and there are no shorts on the motherboard.  It has been reported, though, that the tantalum capacitors regulating the power right by the PSU connectors can go bad and cause a short on the motherboard.  Luckily, I didn't need to rework a capacitor, but ultimately I did need to rework something that's much more of a pain -- you'll see later.


A Potentially Huge Time Sink


If the problem has been found not to be in the power supply, yet the computer does not beep a POST code to you, then it's either in the speaker or somewhere in the motherboard.  The speaker was measured to have the correct amount of resistance, and the cone was still in good shape, so that wasn't the issue.  This left the daunting task of finding out what was wrong on the motherboard.  However, there is a culprit far and away more likely than anything else: faulty memory chips.  The memory in the IBM 5150 is unreliable and often goes bad.  Toggling several DIP switches in order to try to adjust the memory got me nowhere, so I elected to remove all of the memory chips in banks 1-3 (bank 0 is soldered into the motherboard directly).  After this, the computer still wouldn't make any noise, so I probed several other things with the multimeter and experimented with some more DIP socket settings, also to no avail.

There is a technique known as "piggybacking" where you take a good chip and set its legs right onto the legs of the bad chip.  This is an unreliable method to triage a PC, though, as you probably don't know if the good chip is actually good, you don't know which bad chip it is, and it's not guaranteed to make the circuit behave as expected if the bad chip is not totally dead.  Nevertheless, I figured I'd give it a shot; it beats the alternative of having to order an obscure ROM chip, program it with a diagnostic tool that's notoriously buggy, and then make an adapter for it just so it fits in the original BIOS slot on the motherboard.  That sounded like an even bigger waste of time than just piggybacking, so I put a random memory chip on top of a random chip in Bank 0, and turned it on.

Nada.

I went back to double-check my DIP socket settings in order to indicate I had the absolute minimum amount of memory installed, and...


Voila!  It worked!



(In retrospect, this was actually a pretty good random guess, since the computer tends to appear dead if the memory fault occurs on the first two chips of Bank 0; I happened to pick the very first one, Bit 0 of Bank 0.)  The first signs of life out of this PC were the long-short-short beep code, indicating it is expecting a video card but did not detect one.  Immediately, I packed everything up and headed down to EDS in Arlington.

The liquidation sale has been going on for quite some time, so what's left of the inventory was rather disheveled.  I sifted through several buckets of ISA cards, but did not turn much up at all that was of the 8-bit ISA variety required for this PC.  I went back to their PC Museum area hoping to find any sort of useful PC card, and one of the associates helped me track down two IBM-compatible CGA/EGA cards to put into my machine.  One card, the Epson Y1272040002, was only $30.  The other, a Compaq Merlin "Enhanced Color Graphics Board", ran for $150.  Given the rarity of the Compaq card on the Internet -- it seemed like I had just stumbled across Unobtainium -- I ended up plunking down for both without much hesitation.  Fortunately, it turns out everything in their Museum is 35% off, so the total was just over $100 for both cards.  After spending about two hours searching that store, I think I found the last things of use to me from there.  What a sad day.  From EDS, I obtained a $65 Tandy CGA monitor and two video cards totaling about $120 (everything considering the 35% discount).  It's also amusing that I'm retrofitting the IBM PC with IBM-compatible parts, though simply due to supply issues more than anything.

After getting home and having some dinner, I tried both of the cards in the PC as-is, and neither of them seemed to do the trick.  The PC was still emitting the long-short-short beeps indicative of no video found.  I decided to take the simpler of the two cards (guess which one that was :-P) and switch its setting from Monochrome to Color.  Upon firing it up... just one short beep!  That's exactly what you want to hear.

I ran to get the CGA monitor from the other room, and plugged it in next to the PC.  Immediately, I was greeted with PC Basic, which is what you see when you don't have any working or enabled floppy disk drives.  This was enough for me, though; I was extremely satisfied with four days' worth of work after work.


Picture of the first video signal emitted from this PC in a very long time
And on the fourth night, the PC Gods proclaimed, "Let there be video!"


I spent the remainder of the night trying to conjure up my BASIC programming skills, yet incorporating some of the differences I had only read about when comparing original BASIC to the QBASIC I used when first starting programming in the late '90s.  One particularly amusing aspect is that you can move the cursor wherever you want to on-screen, so I altered the PC's greeting to say some immature things that were amusing until my program started to scroll the window deep into the depths of spaghetti code (what else are you going to write when you don't exactly know BASIC?).  Overall, I'd say that was pretty impressive to restore a 5150 in just a few hours a day over four days.


Can't just rest on your laurels...


Of course, it's not wise to trust a piggybacked chip for very long.  It needs to be soldered into the board eventually.  Over the long July 4th weekend, I took some time to desolder the bad memory chip from the motherboard and replace it with a DIP socket so that any chip that sits in that spot will be removable thereafter.  This process took a while because I went about it not by simply clipping the pins, but by trying to heat up the solder in each via, then pushing each pin to the center of its via.  After each pin was centered, and ChipQuik was applied to each via as well (bismuth lowers the melting temperature of solder), I would apply yet more heat to several holes at once and eventually managed to pry the chip out with a screwdriver.  Unfortunately, my IC extractor was too thick to navigate around some of the other socketed ICs, so I had to use a screwdriver (a more brutish, primitive method).  Also, when I was pushing each pin to the center of its via, occasionally I would push too hard with the tool and scrape off some of the protective coating on the traces surrounding the chip as I was trying to center the pins.  Next time I know a chip is dead, I likely won't even bother with all this trouble.

Once the chip was removed, I used a desoldering vacuum and solder wick to remove the old solder and bismuth, then set a new DIP socket into place.  It was soldered in with new lead-free solder, and one of the memory chips from Bank 3 was installed into place.  The old chip was indignantly thrown away.  I was very proud when the motherboard I had just reworked successfully powered on and booted to BASIC!

Now that the rework was successful, I took some time to notice the errors thrown up on screen just before BASIC would come up.  First, I was curious as to what "301" meant -- it turns out that the 301 error indicates a problem with the keyboard.  For some reason, I have to leave my keyboard unplugged until after the computer boots up, or else it initializes with the wrong data rate and sends a bunch of gibberish.  In any event (plugged or unplugged), I get the 301.  No big deal right now; I'll try it with one of my Model Ms and see how it goes.

Once I discovered that 301 was an error, though, it got me thinking about the "201" also displaying on my screen.  It turns out 201 is a lot more interesting, and indicates a memory error.  The specific memory error I was getting indicated there were problems with Bit 2, 4, 6, and 8 in Bank 1 (the message was 1055 201 -- 10 = Bank 1, and 0x55 = 0101 0101 in binary, where ones indicate problem bits).  This was because I had no memory installed in Bank 1 anymore, due to trying to isolate RAM problems, so I repopulated Banks 2 & 3 and booted once again.  This time, the machine was satisfied.

There are a couple bugs on the 10/27/1982 IBM PC BIOS that wreak havoc with the memory on the 64-256KB board (which is the one I have).  The first is that, due to a portion of a byte being set with an incorrect value when not all 4 banks of memory are enabled, the system multiplies the number of chips by the wrong number and seriously under-reports the amount of RAM installed in the system.  The second is that, for the same reason but in a portion of a different byte, the system tries to check much more memory in its POST initialization than what might actually be installed.  For instance, if Bank 1 is enabled, it will try to test memory in Banks 1-3.  When Banks 1 & 2 are enabled, it thinks there's so much memory that you would need the memory expansion card in order for all tests to pass.  Luckily, the expected behavior is exhibited when all 4 banks are enabled -- it runs the tests in exactly the 4 banks.  Based on these two bugs, it makes very little sense to run a 64-256K IBM 5150 with less than 256K of memory.

Nevertheless, I used these glitches to my advantage when testing the remainder of the memory chips.  It turns out that only the one chip at Bank 0 Bit 0 was bad, so I have been in contact with some of the local electronics stores to see if any of them happen to carry a suitable replacement.  Luckily, it turns out that technology has run in the bloodstream of the Dallas economy for some time, so I shouldn't be too far away from finding the chip.  However, I have other projects to tend to, now that this system is at least booting up happily...


Useful Sites


If you too are on a quest to restore an IBM PC, XT, or AT system, here are some good places:

No comments:

Post a Comment