Monday, July 27, 2020

Refurb weekend: Mac mini G4

A year ago, I set up a Mac mini G4 as a network bridge running NetBSD (the "secret last generation" with a 1.5GHz G4 CPU), and it rapidly became one of the hardest working machines in my machine room. Last week, it abruptly ceased responding.

I went and looked at the console, and found it had thrown a couple ATA controller timeouts and then seized up completely. I restarted it and fsck started timing out on sectors all over the place. Hah! said I. The hard disk must have crapped out. It was still running an original hard disk, and those certainly fail with time, so that didn't seem at all strange to me. That means we're gonna have ... a Refurb Weekend!

Since I was expecting to replace the drive anyway, I figured I might as well make it an SSD and bought an inexpensive Kingston mSATA. The drive I was replacing was 80GB, and I could get 120GB nearly for the same price, so we'll call it an upgrade.

The G4 Mac mini only takes 2.5" PATA drives, thus requiring a laptop mSATA-PATA enclosure as well.

Let's get out the putty knife. Yes, that's really how you crack these older minis open ("crack" being, sometimes, the operative word). We jam the blade into the space between the base and the metal top case and work around the outside, freeing up the clips, until we can pull out the base.

The G4 mini comes apart basically in two halves, the motherboard sitting on the base (usually with the Bluetooth-WiFi module mounted on it, and/or the modem on older models) and then this drive cage/fan assembly that contains the optical drive, hard disk and main cooling fan. This unit has the infamous original Apple-rebadged Panasonic UJ-845-C slimline drive. These fail if you look at them crossways, and this one was already refusing to read burned CDs from certain manufacturers, but we're not here to replace that currently. The antennas on top are for the Bluetooth and WiFi, and sit under holes cut out for them in the metal of the top case. We unscrew and pull the drive cage from its logic board connector, making sure to unmount and thread through the antennae. There's a bit of Kapton tape securing these and the wires for the power button to the drive cage; make sure you peel those back too.

The drive cage is now separated from the logic board. Ugh, dusty. Blowers employed at this point on the fan blades, fan race, air intake, processor heatsink and logic board.

There are four screws holding the hard disk in the cage. The two on the exposed side are easy enough to see, but one is under the fan (the fan screws are rather tightly threaded, so they need a little bit of cranking to get out without stripping them), and the last one is only easily accessible with a shafted driver through an access hole provided for that purpose (covered, obnoxiously, also with Kapton tape).

With the screws out, a little prying (not too much, or you'll bend the card and/or the pins) with a nylon spudger will push the drive off the socket on the interposer board connecting both the optical drive and hard disk. I intended to do a little post-mortem on it, so I put it aside and picked up the new drive in its enclosure.

The main drive is actually suspended with a slight air gap between it and the optical drive; they are not flush. Wedging the spudger in between will make it easier to line up the screw holes.

With that done, I screwed back in the fan, threaded the antennae back through the drive cage on top, carefully made sure the interposer board was plugged back into the logic board, screwed down the drive cage, remounted the antennae on their mount points and replaced the top case. I got out my trusty iBook G4 to format and partition the drive, hooked the mini up to the iBook via FireWire and held down T as the mini started up ("bonnng!") to enter FireWire Target Disk Mode.

... nothing happened. The monitor stayed dark. Huh.

Well, sometimes the Mac's parameter RAM gets scrambled after a hardware change, so I reset PRAM with Command-Option-P-R. (Probably should have replaced the PRAM battery — a 3V 2032 or equivalent — while I was in there.) I held the keys down, made sure it bonged a few times, and let it try to boot whereupon it (expectedly) displayed the "No system folder" icon. The drive is of course blank so that seemed okay, so I popped in a CD I knew it would boot from, restarted the mini and tried to boot from it with the C key. Still nothing. Time to get to the Open Firmware prompt (Command-Option-O-F while starting it again) and figure out what was wrong.

A little known trick is that you can start FireWire Target Disk Mode from the Open Firmware ok prompt too (after all, holding down T is just a snag key shortcut). This is useful for showing a little more information about what's going on; it shows debugging messages while starting up and while the other system is connected. The magic incantation is dev /firewire-disk-mode and then target-mode.

Yikes! No drives are showing up! No wonder Target Disk Mode didn't do anything!

I powered down the mini and removed the top case to ensure the interposer board was mated to the motherboard. It was. This could only mean the controller died and/or the logic board was shot, and the hard drive wasn't actually the culprit. Well, that's why we keep spares around! I had a spare G4 mini of the same speed with the drive cage from my dad's old system (new OEM optical drive and 120GB hard disk, both of which I installed for him back in the day); let's put the SSD in that system instead.

Transplanting the SSD from the old drive cage to the new one on the right and blowing dust out of every orifice on this one as well. I also replaced the PRAM battery while I was at it, since the voltage was measuring a little low.

Before packing up the old system for the parts bin, I wanted my CD back, but with a shot board the mini couldn't command the drive to eject it through software and unfortunately these drives don't have an eject hole. Instead, to get a disc out of most Panasonic UJ-series laptop drives, it's a matter of removing the top shell screws and taking off the cover, and the CD can then simply be popped off the spindle. The drive is defective anyway so I didn't bother reassembling it since it'll just go to the recyclers'.

That's more like it! Notice that, having manually started Target Disk Mode from the Open Firmware prompt, we have a little debugging log on the left half of the screen. The iBook G4 was able to partition and format the drive successfully.

Finally starting NetBSD/macppc 9.0 from the CD, since we've now got a working optical drive "for free" and we might as well upgrade the OS since we're reinstalling it. The system is back up and running.

This was an unexpected fault, and while a logic board failure on a 15-year-old computer is certainly not unheard of I wouldn't ordinarily think the board would fail before a spinning disk would. It's probably just bad luck, but there is one thing I chose to do differently with it: for this unit, as an experiment in longevity, I was using the Intel Core 2 Duo mini's 110W power supply because it has the same connector and same voltages but requires less of its capacity than the G4's 85W stock supply. I don't know if doing so had anything to do with it or not, but now that its power usage is even lower than the 21W it typically pulled before (down to just 15W), I put the original 85W supply back in service.

Overall, I think it might have been better to call this endeavour a Replacement Weekend, since it's now got a replacement logic board, a new SSD and a new-ish optical drive. It's still good to have the system back up and running, but now I think I'd like to find another spare.

Saturday, July 25, 2020

AppleShare PC on MS-DOS and the Apple LocalTalk PC Card

One of the machines in my office is a non-descript Am5x86/133 (486 class, infamously claimed by AMD to be "Pentium 75 equivalent") in a generic tower case that exists purely to play MS-DOS games I like and run a few DOS-only applications. Its name is Alex, after Alex St. John, who was the evangelist for DirectX during his tenure at Microsoft (despite the fact this machine does not have any version of Windows on it).

Being a late 486-era system it has an ISA motherboard with a couple VESA Local Bus slots and not a scrap of PCI. Most of us of a certain age will remember how rickety lots of cards in a VLB/ISA system could be, though fortunately the (ISA) Sound Blaster ViBRA 16X and (VLB) S3 86C805-P cards work, so games work and that's what it's largely here for anyway. In fact, some games only work on this system that won't work with my AT&T Pentium 75. One thing I have never gotten working on it, however, is networking. I've tried several ISA network cards, even a Xircom parallel port adaptor, and nothing will talk to anything else on the network -- with the exception of AppleTalk using Apple's own ISA LocalTalk card.

The Apple LocalTalk ISA card was actually a fairly early release, appearing in 1987 just two years after LocalTalk debuted to allow Macintoshes to connect to the new LaserWriter printer, an integral part of the benighted Macintosh Office initiative. The fact that AppleShare for the Mac appeared the same year is notable, since PC support for LocalTalk networks must clearly not have been an afterthought at Apple. Although a company called Tangent Technologies was apparently first to the punch in 1985, it doesn't look their PC MacBridge product sold in any large numbers, and I've never seen one myself.

The card uses a standard 8-bit ISA slot and has its own 6502 CPU (a Rockwell R65C02) running at 3.6864MHz with an 8K 2764 ROM ("© APPLE '86") and an 8K 6264 RAM chip. Like Macintoshes, the RS-422 serial support is provided by a Zilog Z8530 Serial Communications Controller (here the second-source VLSI Technology VL8530). The "PCI" marking in this case means PC Interface, not actually PCI slot logic, provided by an MMI PAL16R4ACN programmed for the purpose. I don't know what the DIP switches do; my cards have switches 1, 3, 4 and 6 off and 2, 5, 7 and 8 on, so I assume those are the factory settings.

The sticker 630-5306 on top is covering the original Apple part number, 630-0113. I don't know why Apple used a different number, because I have a -0113 also, and they seem to be otherwise identical. Just to make things confusing, there is also a later 630-5306 card ("©1986/87" rather than "©1986") with that part number actually printed on the board that has a later ROM copyrighted 1989.

Here it is installed in the back of Alex. You'll note it does not have the more typical Mac 8-pin mini-DIN connector and instead has a more PC-like DE-9 serial port. That's actually because Macs of that generation didn't have mini-DINs either, so you had to get the Apple LocalTalk Locking Connector Kit DB-9 [sic] package, sold separately of course, to hook it all up. However, I have a Farallon PhoneNET connector plugged in here instead which they manufactured with a DE-9 port as well, and I then use a Dayna EtherPrint-T to bridge the LocalTalk segment to wired Ethernet. The EtherPrint-T doesn't do MacIP (that is, IP over LocalTalk) but it does do LocalTalk to EtherTalk bridging pretty much seamlessly and was less mucking around than with a GatorBox, so that's what we've got.

The software side was provided as a DOS Terminate and Stay Resident (TSR) program, sold as AppleShare PC. I have both AppleShare PC 2.0 (1987) and 2.0.1 "2.01" (1989), but unless you have very old machines on your network you really want 2.0.1 for proper support of AppleTalk Phase 2. Interestingly, the earlier version was on 3.5" floppies, but the later version I have is on 5.25". The TSR provides a "desk accessory" triggered by a hotkey combination (by default Ctrl-Alt-Esc) that pops up and lets you log on, mount and unmount network shares as DOS drive letters. Since I have two hard disks and a CD-ROM as C: through E:, the AppleShare volume invariably appears as F:.

Let's see how this works. I took these pictures transferring across yet another vain attempt to get the NIC working for useful purposes (it failed, of course, because this machine hates me). Rather than do screen captures I've chosen just to photograph it with my phone to give you the full 1990s PC CRT monitor experience.

Booting up. All the little submodules consume rather a lot of conventional memory to the point where many games won't run, so one of the first things I did after installing the software was set up a boot menu (it runs MS-DOS 6.22) with separate profiles for games and the LocalTalk card. With the 2.01 software loaded, and the sound and CD-ROM drivers, I have just 432K of conventional memory free despite loading 66K of everything else into the UMB. (I don't miss DOS memory management at all.)

The desk accessory immediately starts after load to let you mount a volume. Here I will mount Jonathan, my Power Mac 7300 with a Sonnet G4/800 running Mac OS 9.1. You don't need to know the other servers, spank you very much, but the software seems only to "like" "real" Macs: it will not log on properly to thule, my NetBSD Macintosh IIci running netatalk, despite it being a "real" Mac, and it obviously doesn't know how to do AFP-over-TCP so you're limited to hosts running Jaguar (10.2.8) and prior.

Logging on. Using function keys to proceed is not really intuitive. One wonders if Apple did that on purpose.

Jonathan has two drives, each an individual volume (HFS+ volumes work fine), so we will pick the main drive and mount it as F:. As a convenience you can automount drives on boot, just like a Mac could.

And here are the contents of the newly mounted network share. Files and folders that have a resource fork have an exclamation point prepended as a visual warning they are not PC files, and there are no LFNs (please, it's 1989), so filenames just spill into the extension (!System.Fol for System Folder). If names clash, a digit is used (!Games_t.hat versus !Games_t.ha0, using underscores to replace spaces within the filename and extension fields). Just two files show up without a "!", which are the ones I earlier FTPed over to the Power Mac 7300 and have only a data fork.

While network transfers are in progress, a little set of arrows appears at the upper left, almost sorta kinda like a Mac would do.

Files are copied (regular old DOS COPY), so let's log off. It still doesn't work, of course, and I'm pretty sure I have the right packet driver and everything else. I'm going to have to take this machine apart down to the slots to figure out why. Anyway!

AppleShare PC 2.01's "About" box, just for completeness. Interestingly, the PC driver is given as version 2.61, but everything else is 2.01. I don't know anything about the authors. Do you?

There are some odd things about this card but it could again just be something wacky about this system. One of the oddest is that the packet driver I tried to set up for the SMC EZ 1660 NIC it has in it now actually knocks the LocalTalk ISA card completely off line, as in it won't respond to commands anymore until I power down the system, let it sit a bit, and bring it back up.

LocalTalk was gradually displaced by EtherTalk as Ethernet became more commonplace, and the PC ISA card was relatively expensive and limited to environments where Macs and PCs co-existed, so Apple never observed strong sales and discontinued the package with the rest of their LocalTalk offerings around 1991. There were a surprising number of third-party versions, though. After Apple quit LocalTalk entirely and handed the market over to Farallon, Farallon produced their own version of the card, allegedly strongly based on Apple's, until 1993 or so and integrated the software into the Windows 3.x versions of Timbuktu. It was still DOS-based, however, and the two halves I'm told never fit together well; issues with Windows 95 seem to have limited its further evolution. Daystar reportedly bought out Tangent and produced additional cards branded as the Daystar LocalTalk PC Card, but I've never seen one of those either. Dayna and Centram Systems also apparently made their own versions too; a company called COPS bought out Dayna's and Daystar's products and continued to produce them for several more years. Some of these cards had proper DOS ODI and NDIS drivers, so it was eminently possible to use those under Windows 95 or 98 with Miramar MacLAN or Thursby TSSTalk. NT 4.x drivers also apparently existed for the Daystar card(s). Miramar MacLAN is particularly handy as it allowed peer-to-peer networking with other AppleTalk clients without needing Windows NT.

Other than ISA cards, there were parallel port ones, but these were apparently crummy. One company even made a prototype PCMCIA LocalTalk adapter but it was never released.

Besides regular EtherTalk, some DOS Internet suites provided packet drivers for the LocalTalk card, the analogous equivalent to MacIP on a "real" Mac. However, you need to set up a AppleTalk IP router for this, so I haven't tried this functionality and it would be just as slow as MacIP would be otherwise. Still, I guess it beats no networking at all. Overall the card is an interesting device, it worked out of the box and it's still working reliably years later, so if I end up only being able to transfer files this way there are worse first world problems to have.

Sunday, July 19, 2020

Carry on (the) Arithmometer

There are a number of devices that go by the name "Arithmometer," including the original one which went into production in 1851. They aren't computers, to be sure, and are best described as mechanical calculators, but I like them because they're fun to play with, they don't need a power source (other than a stylus and your fingers), and — as the manual for this Tasco Pocket Arithmometer says — if they're operated correctly the machine will always give you the correct answer immediately.

The Tasco Pocket Arithmometer here has an unusual lineage that appears to start in 1913 in Germany with the Trick Rechenmaschine (Trick Calculating Machine), though "trick" may not be the image you'd want in mind to suggest accurate accounting. The Trick itself is an evolution of the "slide adder," using rows of sliding numbers to calculate sums; its primary innovations were a semi-automatic carry feature and a sliding subtraction plate, making it probably the prototype of this class of "shepherd's crook" mechanical calculators. In the 1920s the design ended up Stateside and was manufactured by the Gray Arithmometer Company in Ithaca, NY. These early units had a dull nickel finish, and some are labeled Morse Chain Co., who were at one time the primary distributor. Somewhere around 1940 to 1945 manufacture of the product was taken over by Tasco, apparently unrelated to the modern manufacturer of crappy telescopes, who produced it in almost exactly the same form except for a new name plate and a chrome finish. They seem to have been manufactured at least through the 1950s, and came with a manual, a metal stylus that could poke out an eye and a little leatherette snap case.

The T-P-A does addition and (with the use of the sliding subtraction plate) subtraction. Since multiplication is merely repeated addition, it can do that too, and division via repeated subtraction with some additional effort, though these are plainly not its strong suits. I'll talk specifically about addition here, being the T-P-A's primary function.

Numbers are dialed in by pulling the top tab, which clears all the columns, and then by using a stylus in the provided holes. The metal between the holes is either white or red. When the colour above the number is white, we pull the stylus down; when it is red, we pull it up. In this animation, we demonstrate twelve plus five by dialing 2 and 10, and then pulling down 5 to yield 17:

The "hook" at the top (or at the bottom, when the subtraction plate is engaged by sliding it up) is the automatic carry system. When adding, the stylus gets pulled up and over the hook to add one to the next column. Here is 12 plus 9, dialing in 2 and 10, then pulling up and over the 9 to yield 21:

Although fascinating and intuitive when you know the trick, the manual assumes a lot of someone not already familiar with this style of calculator. In particular, while the automatic carry is innovative, it does not cascade. The reason for this can be seen when we try to dial in 999:

The left-most 9 (in the hundreds place) has a block in the right, but the stylus can still move into the hook. However, the other two nines in the tens and units places are "double blocked": two blocks completely prevent the stylus from advancing into the hook. What the manual doesn't make clear is that you have to cascade the carry yourself if you have multiple positions that are double blocked. Let's consider how to add 1 to 999.

  1. We attempt to add 1 to the rightmost column. This column is red, so we put the stylus in the one-slot and pull it all the way up (yielding zero), but this column is double blocked so we can't move into the hook to automatically transfer the carry.
  2. We thus attempt to add 1 to the next column as well, but it's double blocked also, so we end up zeroing that column too and continuing to move the carry to the next column to the left.
  3. This last column is single blocked, so now we can finally pull the one up and over the hook, setting it to zero and carrying the 1 automatically. There's nothing more to add, so we're done.

By cascading the carry over multiple columns, the machine reads 1-0-0-0, which is the answer.

Similarly, consider adding 11 to 999. This is nearly the same, except having added the 1 and propagated the carry left, we then just add 10. The columns now read 1-0-1-0, which is the answer.

Finally, let's consider the case of 999+999=1998.

  1. We attempt to add 9 to the rightmost column, but it is double blocked. Instead, we put the stylus in the nine-slot and pull it up, setting this column to 8, and carry the 1 to the left.
  2. We attempt to add 1 to the next column, but it is double blocked, so we put the stylus in the one-slot and pull it up, setting this column to zero, and carry the 1 to the left.
  3. We attempt to add 1 to the next column, and it is single blocked, so we put the stylus in the one-slot and pull it up and over the hook, setting this column to zero and carrying 1 to the left.

At this point the dials read 1-0-0-8, but you've probably figured out the next two steps already:

  1. We add 90 (1-0-9-8).
  2. We add 900 (1-9-9-8).

Demonstrated below:

This is the answer, correctly and immediately.