I recently discovered Infinite Mac, a web site that lets you emulate, within your web browser, old Macintosh systems. It does so by porting to WebAssembly some popular Mac emulators, including SheepShaver for Power Macintosh emulation.
With it, I was able to set up the software I used when I started programming in 1997. The setup (software and hardware) isn't identical to what I used on a Power Macintosh 6100, but it's close enough.
First, the compiler. For a long while, the "Macintosh Programmer's Workshop ("MPW") was the "reference" compiler. It wasn't free (though I couldn't find any reference to how much it cost), and because Pascal was the preferred language of the Macintosh, C language support was limited. Years later it became free, but by that time there were much better compilers, with better PowerPC support, to the point that even programmers at Apple stopped using MPW.
I was recommended Metrowerk's CodeWarrior Pro, versions Pro 1 to Pro 3. Luckily, there is a copy of CodeWarrior Pro 4 on archive.org. It can run directly from the CD-ROM, so it works perfectly in Infinite Mac.
The reference CD also came with some "introduction to programming" books. I used them to be introduced to C and C++, skipping entirely learning Pascal, because from I saw nobody else was using Pascal outside of Macintosh development.
Second, the references to the Macintosh APIs. The only official reference was the "Inside Macintosh" books. It was only available as expensive physical books, until 1995, when it was published on CD-ROM. There is a copy of Inside Macintosh CD on archive.org, which also works in Infinite Mac. The CD doesn't use PDF, using it's own "reader" software, and the figures are of very low quality, so if you want to read it, you should instead refer to the Inside Macintosh PDF files on vintageapple.org.
So, you can look at the full environment on this PowerMac G3 virtual machine, with all the CD-ROMs I mentioned inserted in it.
Still, something important is missing: Being able to press on the "Programmer's Key" to launch MacsBug. Every Macintosh until the end of the PowerMac G3 line had two hidden buttons on the back or on their side. The most commonly known one was the reset key, which was convenient considering how often you had to reboot Macs after a crash (and somehow the "Restart" button in the system error alert didn't work). The other button, the programmer's key, was often pressed by accident (when trying to reach out for the reset button) or by curiosity, which typically resulted in the user unfriendly MicroBug to be displayed. The proper way to exit that prompt is either with the
G command, or by executing
SM 0 A9F4 followed by
G 0. Without any "help" command most users would panic and use the reset key anyway. Notice how a function can be executed by setting a value at memory position 0 and resuming execution there, which was possible due to the Macintosh (before Mac OS X) complete lack of virtual, protected memory.
Installing and running SheepShaver, especially on Windows, wasn't a great experience. Not only you have to find Macintosh ROMs, but the emulation wasn't particularly stable, crashing more often than a real Mac. So, I looked to see if there was any other alternative. I then discovered that QEMU added support for PowerPC emulation that worked with Mac OS. I followed the instructions from Emaculation.com, and I was pleasantly surprised to see that everything worked right away (no ROM needed). This includes automatic networking support, so you can even use Netscape Communicator to transfer files from and to the host using FTP, or access TLS-less sites like theoldnet.com. Its support is more limited than SheepShaver (QEMU is using IDE drives for that, instead of SCSI, so you're limited to 1 or 2 CDs at a time), but it's still possible to eject and swap the CD-ROM.
But, more importantly I found in the Emaculation.com forums that MacsBug was supported with the
nmi command. Technically, the programmer's key made the Mac motherboard execute a Non-maskable interrupt, or "NMI". So, when running QEMU, you can switch to the monitor screen using control-alt-2, enter the
nmi command, and go back to the computer's screen with control-alt-1 to see MicroBug, or MacsBug it its extension was installed.
To explain how powerful MacsBug was, it's the equivalent of pausing a virtual machine and inspecting or changing anything in the machine's physical memory, in addition to the CPU state. Because Macintosh didn't use any kind of preemptive multitasking or separation between user and kernel space, executing a non-maskable interrupt effectively "paused" the entire computer, instantly. Not only this was great for debugging, but also it allowed me to pretty much reverse engineer any running software, and more importantly cheat in some video games.
In a way, knowing how to make use of the programmer's key and MacsBug was a "rite of passage" that made you a proper Mac programmer. In retrospect, this wasn't quite useful, since a few years later "classic Macintosh" was completely replaced by MacOS X, a full UNIX-like system, and even myself I would dual-boot the PowerMac into Yellow Dog Linux or use Sun Solaris at my university. The days of pressing a hidden button on the computer to enter some "hacking mode" was quickly over.
Published on September 6, 2023 at 21:00 EDT
Older post: Teletext, or The Ghost Between the Frames