Friday, November 12, 2021

Refurbishing an Apple IIe found thrown out on the curb

    Earlier this summer, on a cloudy afternoon with thunderstorms coming, I was out for a quick walk around the neighborhood. The area recently had suffered from some devastating rainstorms with severe flooding, and many homes had flood-damaged furniture and other items piled up on the curbs out front. I gave most of the piles a wide berth, but one such pile immediately caught my eye. 


    I was quite astonished to see, among the other obsolete electronics, a vintage Apple IIe just left out in the trash. Even if it was flood-damaged, this machine was well worth the time to refurbish. This was also a machine with a lot of nostalgic value for me, as I grew up using these in grade school, but not one I had ever actually owned myself.

    I did wonder briefly about the ethics of picking these up - perhaps the people who lived there were merely temporarily storing the parts on their curb, and taking them would be stealing? But they had been obviously dumped as trash along with flood-ruined furniture and bins of rubbish, so I figured they were clearly trash. Furthermore, there were thunderstorms coming to the area later that evening, so whoever left these out obviously didn't care what happened to them.

    I ran home to get the car to come and pick it up, slightly worried that someone else would grab it before it got back but more worried that the approaching thunderstorms would reach us and potentially cause even more flood damage. I ended up grabbing the Apple IIe, the floppy drive, and the printer underneath it that seemed to be associated with it. Unfortunately neither of the monitors near it were compatible with the video output of the Apple, both being VGA input monitors while the Apple produces a slightly non-standard NTSC signal.

Inside the Apple IIe



    The Apple II came at a time when home computers were just starting to shift from made for electronics hobbyists to being useful consumer devices. The Apple I had been entirely made for electronics hobbyists, with the expectation that each end user would be writing their own software and designing and building their own expansion hardware. They were sold as a completed PCB only, with finishing details like a case, keyboard or display being up to the end user to provide. It was as much a learning tool for the people at Apple as much as the end users. The Apple II would be a more complete machine, usable out of the box, with a built in BASIC programming environment that could be more easily used for writing your own programs. It was however still designed for easy modification and repair, with all of the chips on the board socketed, and was built entirely with components that were easily available at the time.

    The IIe was similar to the II in functionality and design, but many of the discrete logic chips were replaced with three custom chips designed by Apple: 
  • The PAL/HAL, which contained high-speed logic that generated the various clock signals used by the rest of the board.
  • The MMU, which performed some complex address remapping to allow the CPU to access the full available memory space (128K of RAM on most machines, plus ROM and memory-mapped registers) with only a 16 bit address bus.
  • The IOU, which managed the clocks and counters for the display, the audio output, and various other input and output functions.
    While the Apple IIe was still designed for easy repair and modification, with all chips still being socketed on the early models, these three chips were only available from Apple (and are hard to find today).

    The Apple IIe, with 80 column text mode and 128K of memory in most models, was actually useful for some business and publishing purposes in addition to being a useful learning tool. American schools and universities bought these in vast numbers, ostensibly for educational purposes although they were largely used for playing games.

    Apple would continue its shift from hobby machines you could open and repair towards building machines with no user-serviceable parts over time, which eventually resulted in the early Apple Macintosh computers with cases that required specialized tools to open and had no user serviceable parts inside. I grew up using those early Macs, and while I learned a lot about how to program from them the hardware of those machines might as well have been a sealed black box to me.


    This particular Apple IIe was one of the earlier ones made. From the color of the lettering on the keycaps I could tell it was from the first year they were manufactured - later IIe machines had dark lettering versus the cream lettering of the first-year models. It had the original version ROMs, and was not one of the later 'enhanced' models. This one also still had the pseudo-Velcro fasteners on the lid, allowing it to come off with just a good pull, which were replaced with more conventional fasteners after the first year. 
    
    One especially nice thing about this computer is that there is really nothing on the board itself to cause corrosion. No batteries to leak, and no electrolytic capacitors on the motherboard itself. There wasn't much even dirt or corrosion inside, the board was in such good shape to make me doubt that it even had been flood-damaged in the first place.


    It had a 64K / 80 column expansion board in the memory expansion slot, a special card slot dedicated to just this card. Though technically an expansion card, this was standard equipment in nearly all IIe machines. Early machines came with a simpler card that only provided the 80 column feature with no memory that the system could access, but those were replaced in nearly all machines with this improved versions.


    Also found in nearly all Apple IIe machines was this dual disk drive interface card. A curious thing to see is that these early cards had no back-panel connections as you would see on expansion cards in modern computers. To connect a drive, you had to feed a ribbon cable in through a hole in the back of the case and plug it directly into the board itself. This card could connect to two floppies, although I only found one with it. I also hadn't found any actual floppy disks, so I wasn't sure if I even could properly test this card.


    It also had this Grappler Printer Interface card, presumably to connect to the printer that had been dumped in the same pile. I also had no idea how to properly test this, since I didn't have any of the software that would be required to use it, and while I had also grabbed the printer it looked to be in really poor shape.

    After taking the machine completely apart, I cleaned all the connections and card edge fingers with Deoxit and rubbing alcohol. There was a fair amount of dust, but no larger debris, and not much corrosion to deal with. It looked almost ready to power up and test, but before I did I needed to attend to the power supply.

Fixing the power supply


    Unlike the rest of the machine, the power supply was most definitely not intended for the end user to open up and work on. There are dangerous voltages exposed inside these while they were operating, and really no parts that the end user would normally need to access.  Unfortunately, unlike the motherboard, these did contain capacitors that would fail over time and need replacing. Considering the age and possible water damage, I didn't dare even power this supply up without first opening and examining it.


    The copper traces on the backside of the power supply PCB are a work of art. Boards like this were laid out entirely by hand, with a hand-drawn mask being used to generate the pattern to etch the copper traces. There's not a straight line on this thing. You don't see this kind of almost artistic effect with modern PCBs that are laid out on a computer.

    The electrolytic capacitors in the supply looked undamaged, and there wasn't any significant corrosion, but I quickly spotted the one part that would need replacing.


    These RIFA filter capacitors go bad after a few decades. Moisture seeps in, causing the insulating materials to swell and break down The case cracks from the swelling, letting more moisture in, and the degraded insulation loses its insulating abilities. You can see from the crack across the housing that this one was pretty far gone. If I had plugged the power supply in while in this state, it would probably have shorted out and caught on fire.

    Fortunately, replacement filter capacitors are still available.


    One online order later and I had a new part to swap out for the damaged one. This should be good for another few decades.

Cleaning the case and keyboard


    The keyboard on this machine showed signs of heavy use. The outside was grimy, there were odd stains on several of the buttons and the surrounding case, and many of the buttons were sticky and didn't press easily, or were slow to return when pressed. Fortunately, most of this is easy to take apart and clean.


    The keys come off easily enough, allowing me to clean the keyboard mechanism beneath them. I managed to improve the action of the sticky keys a little, but I could see that completely cleaning them would require desoldering all the keys from the board underneath and actually disassembling the individual mechanisms. I wasn't confident that I could do this without damaging the keyboard worse in the process, so for now I'm just settling for exterior cleaning. I may return to these at a later point.


    The power light on the keyboard is actually a tiny incandescent light bulb, which was still intact and working. Some people replace these with a green LED, but since it was still working I decided to leave the original bulb in there for now.


    The keys themselves I soaked in soapy water for a while and then scrubbed and washed individually. This didn't help with the sticky key actions, but it at least made them look a bit better.


    The case also went in the sink for scrubbing and cleaning. I'm not going to go as far as retrobriting it yet, so there's still some yellowing, but at least I got the stains and grime off of it.

The floppy disk drive



    Though slightly battered and dirty, the floppy disk drive looked mechanically intact. I gave it a similar treatment to the computer, opening it up, cleaning and inspecting all the parts. There was no significant corrosion, everything moved freely, and all of the capacitors looked good. The weird spiral cam that moves the head had some hairline cracks at the end stop, but they didn't look like they would interfere with normal operation.

Testing and troubleshooting


    With everything cleaned and the bad power supply capacitor replaced, it was time to put it back together and actually test the machine. I hadn't been lucky enough to find an original Apple monitor with this machine, but we still had my wife's old Commodore monitor which I was able to convince to work with the slightly non-standard NTSC output of the IIe.


    At first, it looked great. The machine beeped, and the disk drive whirred and thumped. When I exited out of the normal looking-for-a-disk boot process, it went to a text prompt, and I could type in simple BASIC programs. The sticky keys on the keyboard made typing a slight nuisance, but I managed anyway.


    A glorious 16 colors. This may not look like much now, but at the time it was amazing, considering that many of the computers of the day were monochrome only, or used the really quite ugly and limited CGA color palette.

  A tip from a friend led me to the software archive at Ascii Express and its incredible collection of Apple II software. Their files are all saved as audio clips, intended to be played out of a computer's line out port into the cassette input port on the Apple II. With a little searching I found an audio patch cable, connected the IIe to my laptop, and was able to load and play some of those nostalgic games from grade school.


    Nearly 40 years later, and I still suck at this game.

    Unfortunately, after a few hours of testing, the IIe developed video glitches.


    White lines down the screen while in text mode, extending from the top of the screen downward before breaking up halfway down. These would creep up and down the screen as the computer warmed up, sometimes vanishing entirely. Switching to 80 column mode would not fix the problem, but the white lines would become twice as dense. In color mode, the white lines would go away, but instead there would be lines of shifted and changed colors, in vertical bars creeping up from the bottom of the screen.


    I wrote a quick test program to make horizontal bars of colors repeating across the screen. This should have shown solid horizontal bands of each color, but graphical glitches were present, creeping up from the bottom of the screen. The pattern was strange, with some colors being shifted to other colors, or going black entirely. This was also visible when playing games, with bars of shifted colors creeping up the screen. The effect was happening on every other pixel, although the nature of the color shift changed in a regular repeating pattern across the screen.

    My first thought was bad RAM, mostly because that's the most common failure on these old machines. The 64Kx1 DRAM chips used on these old Apple computers are known for having a high failure rate after after a few decades. But the Apple's self-test routine passed with no errors, indicating that the RAM and the major internal data paths were all intact.

    My second thought was to look at the video output circuit, and in particular the video ROM and its associated shift register.


    Each character used in text mode is a 7x8 pixel bitmap, which are stored in the video rom UF4. To display a character, 6 bits of data indicating which character to show are loaded from RAM, the lower 6 data bits going to address bits A3 to A8 on the video rom to select the character. Address bits A0-A2 are used to select which vertical line of the character is being displayed, and are generated from a counter in the IOU chip. The ROM provides 7 bits of pixel data on its outputs O0-O6 (O7 being unused in text mode) which go to the shift register at UF5. That shift register then hands those bits one at a time to the analog circuitry that drives the video output.

    In color mode, the system is run at a higher speed, and UF4 generates bit patterns for each pixel which the attached monitor interprets as color information. UF4 actually generates data for two pixels at a time, with the low bits O0-O3 being the first pixel and the upper bits O4-O7 being the second pixel. It could generate sixteen different bit patterns for each pixel, which accounted for the sixteen colors which this machine could generate.


    I could see from the screen that the video problem were always occurring on the same positions on each character. For each character, the last two bits - corresponding to O5 and O6 on the ROM - appears to be stuck on. In graphics mode, every other pixel had incorrect colors, which would also match a problem with those two pins, since outputs zero through three generate one pixel and four through seven the other in each pair.

    
    The problem could have been in either the video ROM, the LS166 shift register, or possibly even the pull-up resistor network, or maybe even a bad connection in the sockets. I removed both chips and cleaned their pins and those in the sockets, but this made no difference to the graphical glitches. The resistor network also checked out with proper resistances on all pins, so I was pretty sure this was a failure either of the outputs on the ROM, or the inputs on the shift register.

    Ideally, I would have stuck an oscilloscope probe on these two pins and looked at the signal. I don't have an oscilloscope at the moment in my home lab, so I had to make do without. Instead I checked the voltage on the output pins of the video ROM individually when displaying different modes and contents on the screen. I observed that when the screen was mostly black, the output pins O0-O4 on the ROM were at nearly 5V, as expected. (There's an inverter in the video output circuit, so a high on the output pin corresponds to black.). The voltages on the O5 and O6 pins on the other hand were drifting low, and that drifting corresponded with how far the white bars were extending down the screen. This suggested that the outputs on the ROM chip were failing. Although I couldn't completely rule out some kind of weird short on the input pins on the shift register loading down the ROM outputs, I was pretty sure it was a bad ROM chip causing my problems.

    Unfortunately, you can't easily buy just a replacement video ROM. I ended up buying the full Apple IIe Enhancement kit from Reactive Micro, consisting of replacements for all three ROMs and a new CPU. It even includes an "Enhanced" sticker for the keyboard.


    Swapping out these four chips was an easy job. Everything being socketed in this machine makes chip replacements easy. Other than the bad capacitor in the power supply, I haven't had to touch my soldering iron.


    The replacement ROMs and CPU completely fixed the problem, and now my IIe has been upgraded to the Enhanced version, which offers a handful of new kernel ROM features that I probably won't use.

Back to the floppy drive


    The software archive at Ascii Express includes not just games, but utility programs and disk management utilities. With the computer itself working well, I turned back to the idea of testing the disk drive. But first, I needed an actual disk. I have a whole bin of 3.5" floppies, but no 5.25" ones, and didn't know anyone who had any still on hand.

       A computer swap meet or retro computer show would have been a good place to ask, and I may do that next time I go to one. For now, I headed over to Greenbrook Electronics to check through their surplus area to see if they might have any. It was a long shot, and I spent a while digging through their old computer parts bin, before finally finding what had to have been the last floppy disk in the store.


    I wasn't highly confident in how well this would work, considering that this disk was literally buried under a pile of junk, but I really had no other options, and they only charged me a dollar for it.

    Using some of the software from Ascii Express, I was able to format most of the disk, but it would always fail with a disk error near the end of the process.


    I had some luck running the utility programs, and was able to read and write files from most of the disk, but again would run into failures with the later parts of the disk.


    Bad disk, or something wrong with the drive? I don't know. Given the suspicious state of the disk and that the drive seems to be intact and working otherwise, I suspect a bad disk, but I can't say for sure. I need to get my hands on some known good disks to test for sure. Honestly I'm not sure how much of a priority fixing the drive is, since most serious collectors will just stick a SDcard to Floppy adaptor on their machine anyway rather than try to find working floppies.

How about the printer?



    The other piece of equipment that I grabbed off the trash pile was this ancient Epsom FX-80 printer. I grabbed it mostly because it obviously went with the Apple IIe, and figured that I could possibly sell or at least donate it to a collector eventually. I didn't have much hope for being able to really test it, lacking the software needed to drive it, or the perforated paper or ink ribbons it needed. The most I could do was clean it up and make sure that everything looked right.


    Unlike the Apple IIe, the inside of the printer is filthy. Full of mouse droppings, and with severe corrosion on many of the circuit boards. Someday when I'm feeling very ambitious I'll completely tear this down to bare parts and deeply clean it, but for now it's going into storage.

Bonus: Making a joystick

    While playing through the archive of games available, I soon realized that most of the games for the IIe either required a joystick to play, or worked much better with a joystick than with a keyboard. The keyboard controller on the IIe only recognizes one key being held down at a time (other than special keys like shift and control) which isn't ideal for platformer games where you might need to jump and run sideways at the same time, for example.


    Rather than buy a vintage joystick on an auction site, I figured I should be able to make my own. I had a few spare joystick mechanisms lying around from other projects, and some nice pushbuttons. I'd just fire up Solidworks, design a case to hold them, print it out and wire it up. Easy, right?


    Unfortunately it's not as easy as just wiring a joystick to the inputs on the IIe's game port. While a modern game system would look for a variable voltage input and resolve it with an ADC, the Apple IIe uses a timed charge-discharge circuit to detect the joystick position. It actually uses a quad 555 chip to generate a square wave with the pulse width determined by a RC circuit involving the joystick potentiometers. This was specifically designed to work with a joystick that uses 150K potentiometers, while the ones I had on hand were 10K potentiometers.

    Blondihacks came to the rescue here, with a hack that let me use my existing 10K potentiometer joystick with the Apple. By adding some additional capacitors between the joystick analog pin and ground, it is possible to shift the RC constant enough for the 10K resistance to work.


    There was just enough room in the case near the pushbuttons to fit in several caps in parallel to give the 0.31uf capacitance needed to make the circuit work. I also decided to use illuminated pushbuttons powered by the 5V from the joystick port, mostly because they were what I had on hand, but also to look fancy.


    A purist would probably sneer at this, as it looks and feels nothing like the original Apple joysticks, but it works well enough for gaming, and is comfortable in my adult-sized hands.

What now?

    At this point I think I've done about all with this machine that I'm going to. The printer is probably not worth repairing, and the disk drive should be replaced with a SD card reader, but I'm probably just going to sell this machine to a collector now. My wife and I are actively trying to clean out our condo and get rid of anything that we don't use frequently, and I can't justify keeping a machine like this around when there are certainly dedicated collectors who will pay to have it. Though really, I'm just happy that I spotted it at all and that it didn't end up being destroyed or sent to a landfill.

Sunday, November 7, 2021

Data recovery on an Amiga 2000


    Earlier this year, I retrieved my wife's old Amiga 2000 and 4000T computers from storage and gave them a thorough cleaning and refurbishing, in preparation for eventually selling them. Those computers were in excellent shape and there wasn't much to do on them other than documenting their condition and swapping out the original batteries for modern lithium ones.

    After I posted about that task, an old friend asked me if I could take a look at his old Amiga 2000 and see if I could recover some files off of it for him. This computer had been sitting in a basement for several decades, and was in unknown condition other than that it wouldn't boot up any more. There were various personal files on the machine, which my friend wanted to recover, and he was hoping I could at least restore the machine to working shape long enough to transfer them off.

    I agreed to look at it, though I made no promises of results.



    This machine was in worse shape than the ones I had previously worked on, with scratches and dents, and one of the floppy drives had a broken ejection button. There were some minor traces of corrosion around the ports as well.

    Most importantly, when connected to a monitor and powered on, it showed a grey screen on the display and no other signs of life.


    The lack of any life at all suggested damage to the motherboard. The most common culprit is leakage from the clock/calendar battery causing corrosion to the PCB and nearby components. My friend had already removed the original battery, but it was possible that it had caused some damage before he had.

    I fully disassembled the machine, documenting and photographing everything as I did. There wasn't anything exotic installed in this machine, just a Great Valley Products combination hard disk and memory expansion card, and two floppy drives. The motherboard showed some corrosion around the battery, so I set that aside for cleaning and inspection.

    


    I couldn't find any damaged traces on the board, but the MC68000 CPU and its socket looked corroded. I pulled the CPU to inspect and clean it and its socket. While they were out I cleaned the entire area of the board near where the battery had been, getting rid of any traces of leakage from the batteries.

    The CPU itself seemed fine after being cleaned, but the socket had obvious damage. Pin one had actually broken apart internally, corrosion causing it to crack right through, and was no longer making connection to the pin on the CPU. This would certainly explain why the machine wouldn't start up.


    The proper thing to do here would be to desolder the old socket and replace it with a new one. I didn't have a replacement socket on hand, and was more interested in getting this machine for now than in any long-term restoration, so I went with the fast hack solution of soldering a wire directly from the CPU pin to a pad on the PCB nearby.


    In the long term, this temporary fix should be removed and the socket replaced properly.

    When the machine was reassembled and switched back on, instead of a grey screen, it actually booted up to the "looking for disk" screen, a definite improvement.


    This computer had a hard disk and should have been booting off that, so there was obviously still something wrong. It would successfully start up if a workbench disk was inserted into the right side floppy disk, but not the left. The left side disk had a broken ejection button. 


    That shouldn't have prevented the disk from working, but there was obviously more wrong with the floppy drive than just that. I did a quick inspection and didn't seem anything wrong. It might just need a good cleaning. I only needed one drive for the data recovery task, so I set that aside for now.

    The hard drive should have been starting up, and was not. I could hear that the drive was spinning, but the computer refused to acknowledge that it existed. I even tried swapping the drive onto one of the other Amigas to see if it was a problem with this machine, but the drive refused to respond.

    With no other options, I decided to try opening up the drive. Really at this point I was pretty sure that the drive was dead, and this was just going to be a forensic dissection to see what had happened.

 


    Fairly standard 105 megabyte Quantum hard drive.


    Opened up. Never do this with a drive you care about.

    While doing some research into possible failure modes, I learned that the most common problem on these old early 90's Quantum drives was the bumpers that limit the travel of the head mechanism. These bumpers are made from a soft rubber, which after a few decades breaks down and turns into a horribly sticky tar-like substance. The head mechanism gets stuck in place and can't move, which causes the drive to fail its own initialization and refuse to even identify itself as a drive to the computer.

    


    The part I needed to get at was sandwiched between two extremely strong magnets, with the movable voice coil located between them. I needed to remove the screws and pull the upper plate off, without touching the drive platters or allowing the magnet to come near them. I also needed to be careful of the bumpers, which had indeed turned into a vile tarry mess and couldn't be allowed to come into contact with any of the moving parts of the drive.



    With some care, I managed to get the upper plate off. The head mechanism was stuck to it, and it took a little force to pull it free.


    I cleaned the hideous glop off the mounting post. Some of it got onto the inner surface of the drive housing, but it doesn't really matter there as nothing touches that area.

    Now that I'd removed the old bumpers, I needed to replace them. You can't just leave nothing there, the bumpers are needed to keep the drive head from crashing into the spindle or falling off the platters. I found some nylon spacers in my junk box that were about right size and fit them in place of the original rubber bumpers.


    After making sure that the mechanism could move freely between its travel limits and wouldn't get stuck to either of the new bumpers, I very carefully reinstalled the upper magnet plate and then put the drive back together, hoping that I hadn't gotten too much dust on the platters in the process.

    I put the drive back in the machine, put the machine all back together, hooked the monitor, mouse and keyboard back up, and powered everything on. Much to my surprise, the computer recognized the hard drive and started booting up.

    It didn't get far before reporting a disk error.

    

    I clicked through that error, and about half a dozen more similar errors. Eventually, with much complaining, the machine made it to a desktop screen.

    


    All of the files that my friend was looking for were here. Now I just needed to transfer them off the computer.

    I had one working floppy drive, and a handful of blank floppies. I also had a spare 3.5 inch IDE floppy drive. I didn't have a computer that could talk to the floppy or use it to read Amiga formatted disks, but it turns out that there's a solution for that too. Robert Smith has provided the world with instructions on how to use an Arduino to connect an IDE floppy drive to a modern computer though a USB port, and software which will read Amiga formatted disks and save their contents into disk image files on a modern PC. I followed the instructions at https://amiga.robsmithdev.co.uk/ and soon had my own Amiga format disk reader setup working.

    With an afternoon of swapping floppies back and forth, I managed to get all of the old personal files that my friend was looking for transferred onto my laptop. The last step was to set up an amiga emulator program that duplicated his old hardware setup, and load all of the disk images onto the hard drive of that emulator. I made sure that he could easily access all his old files on the emulator, and then just packaged the entire software setup up and sent it to him.

    The Amiga itself is going to go up for sale, presumably for any collector who wants to put the work in to actually restore it. I spent a bit of time playing some old games on it, but I don't have the desire to keep it or put the work in for a proper restoration. I know there are people who are interested, so I'll be putting it up for sale on auction sites soon after posting this.