Setting Up Classic Macintosh Hardware

, Classic Macintosh, Programming

I knew that at some point in my life I would like to own a classic Mac OS computer. It’s what I grew up. Buying a classic Macintosh is not getting any easier or cheaper, so I went on eBay and picked one out.

Apple Macintosh Quadra 650
Macintosh Quadra 650

The Quadra 650 has a Motorola 68040 processor running at 33 MHz. This puts it near the top of the line for M68K Macintosh computers. This machine has 32 MB of RAM, wich is a step up from the 8 MB which comes standard.

The 68040 is reportedly much faster than a 68030 processor.

Getting the Computer to Run

The eBay listing described the computer as “working”, but that doesn’t mean that it’s ready to use as soon as it arrives. Here’s how I got it into a usable state:

  1. Mac DB-15 to VGA adapter: Old Macs use a video standard which is different from VGA. Fortunately, all you need is a cheap passive adapter.
  2. ADB keyboard and mouse: Macs didn’t use USB until the original iMac, which came out in 1999. The easiest solution is to just buy an ADB keyboard and mouse.
  3. Wombat ADB-USB Input converter: A converter that lets you use USB keyboards and mice with ADB Macs. This lets you use a modern optical mouse with an old Mac. Requires an ADB cable. For me, the device worked when I put the jumpers in “USB” input mode, instead of “USB+PWR” or “ADB” mode.
  4. 3.6V 1/2AA battery: The battery in an old computer is a disaster waiting to happen—the battery will eventually leak and damage the computer. Remove it now; you can always install a new one later.

It boots, and I can use it! Looks like the hard drive was never wiped, and this computer was last used some time in the year 2000. It takes over two minutes to boot up :-(

Macintosh Quadra 650 running
Quadra 650 Running

Making an Old Macintosh Usable

”Running” is not the same as “usable”. There are some extra steps.

Ethernet

Ethernet requires an AAUI 10BASET dongle. Back in the 1990s, it wasn’t settled whether we would use twisted-pair or coax for Ethernet. AUI is a system that lets you connect to different types of Ethernet by using different dongles, and AAUI is Apple’s variant with a different plug (standard AUI uses DB-25, but the Mac already uses DB-15 for video).

Network File Sharing

To share files, I installed Netatalk, the AFP server, on my Linux desktop. Netatalk version 3 does not support AppleTalk, but that’s okay, since the classic Macintosh supports TCP/IP. However, the Mac OS 8.1 does not support the modern AFP authentication mechanisms, and gave me this error:

Error dialog: This file server does not use a recognizable log on sequence.
Error with default Netatalk 3 configuration

To fix it, I changed the Netatalk configuration to add a legacy authentication module:

[Global]
uam list = uams_randnum.so uams_dhx.so uams_dhx2.so
passwd file = /etc/netatalk/afppasswd

[Share]
path = /home/depp/Misc/AFP

I created a password with the afppasswd tool.

Hard Drive Replacement

The 25-year-old SCSI hard drive in the Mac is probably the next component to fail, so I bought a SCSI2SD board, which lets me use an SD card as a hard drive. By default, it terminates the SCSI bus and uses an ID of 0. However, I inserted it into the middle of the SCSI chain, where the CD-ROM would go, and ID 0 was already in use by the hard drive. So I configured the SCSI2SD to disable SCSI termination and use ID 1.

The Macintosh disk formatting utility won’t recognize or let you format the SCSI2SD. Supposedly you can spoof the vendor and device identification to work around this, but instead, I decided to use Lido, which detected the SCSI2SD and let me format it.

Installing a Fresh OS

Ok, which version should I install? The Quadra originally shipped with Mac System 7.1, and that’s probably the minimum version it supports. Mac OS 8.1 is the last version to support the M68K architecture.

I did some research about the differences. It sounds like early versions of System 7 may have poor support for TCP/IP, but Mac OS 8 is a bit more memory-hungry and the UI takes up more space on the screen. Mac OS 8 introduced the “Platinum” appearance, with thick gray window borders, while System 7 had single-pixel borders and a flatter apperance:

Mac System 7 appearance
Mac System 7: Flat, Simple
Mac OS 8 appearance
Mac OS 8: Thick, Chunky

I’ll try Mac OS 7.6.

Fresh OS, Attempt #1

I create a second SCSI device on the SCSI2SD board, give it the “CD-ROM” type, and assign it a unique 700MB range on the SD card (just check “auto” for the start sector). After disconnecting and reconnecting the SCSI2SD card, the new range shows up as /dev/sdf, and I copy the Mac OS 7.6 CD over it:

$ sudo dd if='Apple Mac OS 7.6 CD.image' of=/dev/sdf status=progress

For some reason, the process would just hang if I set the block size using the bs= option. The operation crawled along, copying 245 MB in over fifteen minutes. And it didn’t work. I have no idea why.

Fresh OS, Attempt #2

I change the SCSI device back to a hard drive and set the block size to 512. The first block is an odd number, 4194303, so I round it up to 4194304 which is 222 or $400000. I like that better, and I believe that the mystical energies of round numbers will help my data move faster. Or something.

Now, where is the partition located on the SD card? I pick up an SD card reader (likely to be faster) and poke around…

$ dd if=/dev/sdf count=10 2>/dev/null | hexdump -C

It turns out that this is pretty easy to read. There are lots of ASCII strings around, and everything interesting is 4-byte aligned big endian integers. Sector 0 starts with ASCII ER ($4552), and the sectors that follow start with PM ($504D), which is for the Apple Partition Map. By plugging in the SCSI2SD sector offset I’m using for the second device, I can look at the partition table for my second device, and find the offsets for the partition I created:

$ dd if=/dev/sdf count=10 skip=$((0x400000)) 2>/dev/null | hexdump -C

At relative byte offset $600 (sector 3), I see my Apple_HFS partition, which has the name I gave it, start sector $60, and length of $15DFA0 sectors (just under 700 MiB). I take a peek at that location using dd:

$ dd if=/dev/sdf count=10 skip=$((0x400000+0x60)) 2>/dev/null | hexdump -C

At relative byte offset $400 (sector 2), I see the master directory block for an HFS volume, which starts with BD ($4244). I examine the CD-ROM image I am using for Mac OS 7.6, and it contains the same volume signature at the same relative offset. The image starts with an LK ($4C4B) signature at offset 0, which indicates the “boot block”.

Why go through all this trouble? I want to be confident that I am copying data to the correct location, and that my understanding of the disk structure is correct. I’m sure in the future, I’ll encounter image files of various types and it’s nice to be able to at least understand what type of filesystem they have by reading the hex.

Anyway, I copy over the image:

$ dd if='/path/to/image' of=/dev/sdf seek=$((0x400000+0x60)) status=progress conv=fsync

This works! I boot the Mac and run the Mac OS 7.6 installer from the local copy of the installation CD.

Macintosh with Mac OS 7.6 installer open

And of course, I repeat the process with Mac OS 7.6.1. The file I have ends with the .toast extension, but it turns out that this is just an ordinary disk image like the other.

AppleShare on Mac OS 7.6

Ack! It turns out that Mac OS 7.6 does not support connecting to AFP servers over TCP/IP. There’s just no button for it. I can either upgrade to Mac OS 8 or downgrade to Netatalk 2. I’m going to try Netatalk 2.

$ ./configure --prefix=/opt/netatalk --enable-ddp

A number of errors! I make a clone of the Netatalk source code at depp/Netatalk and fix the compile errors, but Netatalk isn’t running, and I’m not really in the mood to go any deeper to figure out why.

$ /opt/netatalk/sbin/afpd -d -F /opt/netatalk/etc/netatalk/afpd.conf
[Exit: 2]

Maybe it’s trying to log the error messages to a file or something.

Installing Mac OS 8.1

Before I start, I’m going to save a disk image of the Mac OS 7.6.1 device that I created. This way, I can quickly restore it to try it out. Easiest way to do that is just dd the whole 2GB range of the SD card used for SCSI ID 1 and compress it. The entire 2 GiB image is only 22 MiB compressed.

$ sudo dd if=/dev/sdf count=$((0x400000-1)) | zstd -10 > MacOS_7.6.1_HD.img.zst
4194303+0 records in
4194303+0 records out
2147483136 bytes (2.1 GB, 2.0 GiB) copied, 26.9686 s, 79.6 MB/s
$ ls -sh MacOS_7.6.1_HD.img.zst
22M MacOS_7.6.1_HD.img.zst

However, I’m not going to install Mac OS 8 over it… instead, I create\ a new device. The SD card is 32 GB and it makes no sense to make an effort to save space on it. The new device starts at sector 5627904. I wipe it.

$ sudo dd of=/dev/sdf if='Mac OS 8.1.toast' seek=$((0x400000+0x60)) skip=$((0x25)) count=$((0xb4475)) conv=sync
738421+0 records in
738421+0 records out
378071552 bytes (378 MB, 361 MiB) copied, 10.6052 s, 35.6 MB/s

Installation takes a while—the computer may have an SSD, but it’s still got a 33 MHz CPU.

It Works!

The system boots up just fine in Mac OS 8.1. I can connect to the AFP share, and I managed to install Stuffit Expander, Disk Copy, MPW, and Marathon.

Marathon running on a Macintosh Quadra 650
Bungie’s Marathon

It turns out that Marathon doesn’t run all that smoothly on an M68K machine. I guess I had forgotten about it… back in the 1990s, if I was playing Marathon, I was playing it on a Power Mac. Turning down the graphical settings improves things, but the game is still a bit rough (not like Doom… Doom is smooth).

Now that the system on my SCSI2SD was working, I pulled out the old hard drive, moved the SCSI2SD to the end of the chain, enabled SCSI termination, and set the SCSI ID to 0. The Mac is much quieter. It turns out that the hard drive was by far the loudest part of the machine!

Next, I’m going to try taking some of those classic Mac OS programs that I wrote and testing them out on real hardware.

A Note About Gamma Correction

It is quoted that the classic Mac OS used a gamma of 1.8, but I couldn’t figure out an easy way to apply color correction. Adding a PNG gAMA chunk with the Macintosh’s 1.8 value resulted in unreasonably bright images on various different systems. I’m leaving the colors in screenshots uncorrected.