While this year is a sober one due to current events, I think a lot of people still appreciate what people are creating and sharing to keep spirits up, whether that be music or art or…impractical programming projects. 2: The qemu-i440fx mainboard has been ported to.It’s April 1, and that means it’s both April Fools’ Day and the anniversary of the founding of Apple Inc. Emulates either a Mac Classic (which runs MacOS 0.x thru 7.5) or a Mac II series machine (which runs MacOS 7.x, 8.0 and 8.1), depending on the ROM being used Color video display CD quality sound output5 on PowerPC system About QEMU, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9. Mac OS X (PowerPC and Intel) Windows NT/2000/XP BeOS R4 (PowerPC and Intel) AmigaOS 3.x Some features of Basilisk II.Its successor Mac OS X 5 also ran on PowerPC when it first launched it wasn’t until 10.4 that Apple began to switch to Intel processors instead, and 10.6 when PowerPC was finally dropped.Mac OS X was a huge step forward from Mac OS 9 in a number of ways, including preemptive multitasking so that you could actually run multiple things at once. 4 If a program crashed or overwrote memory it wasn’t supposed to, there was a good chance you’d have to restart the whole system.Mac OS 9 ran on PowerPC processors, which were also used in the GameCube, PS3, and Xbox 360 earlier versions of the OS had started on Motorola’s 68k CPU series. It also dates from the days when only one program could run at a time because of that, even the latest version uses cooperative multitasking to run multiple programs—that is, a program has to yield its time to let others run. 3 It was one of the first OSs to use a GUI at all, something that we pretty much take for granted these days. Twenty (!) years ago, before the macOS 2 we know today, there was another operating system known as “Mac OS”.
You basically just recompiled your app and added an extra annotation saying you were “Carbonized”. 6Carbon was a packaged-up version of the old Mac OS Toolbox APIs so that you could write Mac OS X apps the same way you always had. Think of it like Wine / CrossOver rather than VirtualBox / Parallels. But its life ended with the switch to Intel-powered Macs—Classic was built on running the instructions in the original apps directly, only having to provide compatibility shims for libraries. It really was quite effective, and actually survived longer than booting into Mac OS 9 (which never received support for newer PowerPC processors). Because the Classic environment was itself an app, all the programs that ran inside it were protected from interfering with other Mac OS X programs and vice versa. Intel ich8 family usb universal host controller driver windows 10I package it up as necessary for Mac OS 9.Is this useful? No! Absolutely not! But neither was ROSE-8, and yet I still learned a lot doing it.As you probably guessed, I managed to accomplish this, or I wouldn’t be writing this blog post. I compile it for PowerPC with (a version of) the Swift compiler. I write Swift source code that calls Carbon / Toolbox APIs. 8 What’s the goal?Since I learned to program on Classic Mac OS, and years later spent a good chunk of my career working on Swift, I’ve had the tantalizing thought that I’d like to write a program in Swift and run it on Mac OS 9. Apple never released a 64-bit version of Carbon, presumably to encourage developers to move to Cocoa, and with last year’s macOS Catalina, support for 32-bit apps was dropped entirely with very few exceptions. (h/t Marshall Elfstrand for the video link.)Classic ended with the switch to Intel processors back in the 2000s, but Carbon worked all the way up to last year, macOS Mojave. Powerpc 9 Emulator How To Do ItYou will also need the mpw emulator and a copy of the Macintosh Programmer’s Workshop tools. Everything is inlined away). Note that while I’ve put a built Swift.o in this toolchain, you’ll probably only have success with optimized code that doesn’t actually have any remaining links to the stdlib (i.e. You will also need the mpw emulator and a copy of the Macintosh Programmer’s Workshop tools 9 to build an actual app using modern macOS.If you want a prebuilt PPC-capable Swift toolchain, here’s one: ppc-swift-toolchain. (Check out that blazing fast 400MHz processor!)I assume a good number of people reading this would like to know how to do it too!If you want to build your own PPC-capable Swift compiler, check out the following repositories: git clone Make # quick start to build swiftc and the stripped-down stdlibNote the directory and branch names of the sub-repos, and note that they should be nested inside the ppc-swift-project repo. I didn’t think I’d be able to get the Swift compiler running on Classic, so I’d be shuttling object files back and forth between OSs to get anything done.Fortunately for me, I’m not the only one interested in building Classic apps on modern macOS. (Remember, no command line!) I could try to get some version of CodeWarrior running again, but that didn’t seem like the most convenient thing. Actually, calling that “building Classic Mac OS apps” was a stretch I was learning C and using CodeWarrior’s terminal I/O library to get a stdin/stdout interface that Classic Mac OS didn’t have natively. Gathering materialsThe last time I was building Classic Mac OS apps, I was using CodeWarrior. (And note that the SIZE and carb resources are required for any Carbon app, so you can’t just skip the Rez part if you actually want to run your app.)If you just want to try a built version of BitPaint, here’s one: BitPaint-swift.hqx.I’d like to hear about anything you make with these tools! Meanwhile, if you’d like to hear how I made this work, read on. The required flags for swiftc, PPCLink, and Rez can be a little finicky. Some stripped-down form of the Swift standard library and runtime (enough to read in and interact with Carbon headers, at least) A modified version of the Swift compiler that supports emitting MPW-compatible object files My idea was to take object files produced by a modern compiler and feed them to the PowerPC linker, which means I’ll additionally need: A bunch of object and binary inspection tools, which we don’t need for the finished product but which I made a lot of use of when trying to debug mystery misbehaviorThat’s pretty good as Troughton-Smith’s blog post shows, it’s enough to build an entire app that’ll run on Classic. It turns out it’s a format called XCOFF searching for modern documentation on this turned up an IBM reference doc. Clang uses the same LLVM infrastructure as the Swift compiler, so I figured I could deal with all the object format and workflow issues in Clang, and then move on to the Swift-specific parts.The first thing I did was try to figure out what the file format was for PowerPC object files. Modern compiler, classic linkerTo make things more manageable, I set an intermediate goal: build an app using Clang, the modern C compiler that ships with Xcode. My friend Nadine provided some testing on actual machines once things were working.And, well, that should be it! So, off we go. I have one, but not the charger for it, and so I did most of my testing using SheepShaver.
0 Comments
Leave a Reply. |
AuthorKrista ArchivesCategories |