APPLE SILICON

Apple Silicon & Rosetta

To run as fast as possible on your Mac, sixtyforce uses an advanced technique called just-in-time compilation. Unfortunately, this means that sixtyforce needs to be specifically designed for the architecture of your Mac. Apple just started transitioning to Macs that use a completely new architecture, and sixtyforce is being updated to run as fast a possible on these machines. In the meantime, sixtyforce will work on these new Apple Silicon Macs, but won't run at its best speed. This page will be updated with more information as I work on the new version.


Latest Update

September 1

• About 50% of the DSP instructions are now working on ARM-based Macs. (Every non-vector instruction.)
• Basic DSP code is now running.

August 20

• About 20% of the DSP instructions are now working on ARM-based Macs.
• There are two cores in sixtyforce: The DSP core and the CPU core. So overall about 10% of instructions have been converted.

August 6

• The first ARM-based code generated by sixtyforce is running on an Apple Silicon Mac!
• Now working on the just-in-time compiler core that executes the emulated instructions.



Why is it so hard?

sixtyforce contains not one, but two just-in-time compilers. One for the N64's main cpu and one for the dsp that processes graphics and sound. Between those two chips there are over 400 unique instructions that need to be emulated. This requires fully understanding not just how each of the original MIPS instructions work, but also how the instructions for the CPU in your Mac work so the everything can be translated efficiently. That's two different sets of instructions! (Most development today doesn't require understanding how any cpu instructions work.)

On top of that, there are a lot of other internal features that need to be emulated. Things like graphics commands, audio commands, memory maps, how the hardware talks to controllers and memory cards, etc. The list goes on and on.

While much of that hard work has been done, when Apple changes the Mac's architecture, updating those roughly 400 instructions is slow. Each one has to be rewritten, debugged and tested. Updating 400 of anything takes time.

A Little History (if you're interested)

sixtyforce was originally written for 32-bit PowerPC-based Macs. It was written as a dynamic recompiler (aka. just-in-time compiler or binary translator) because there literally wasn't any other way to get good performance on those Macs. It was a huge amount of work to get that first version of sixtyforce working... it took about 2 years of work on the dynamic recompilers before the first version of sixtyforce was released, and there were still plenty of compatibility problems.

In 2006, Apple introduced Intel-based Macs and sixtyforce had to be completely rewritten to run natively. This was also an incredibly slow process for a couple reasons: First, simply updating the compilers to write Intel instructions is difficult... but second, PowerPC-based Macs were big-endian and Intel-based Macs were little-endian. The MIPS chips that sixtyforce emulates are all big-endian, so this meant the new Intel version had to do a lot of memory swapping tricks to emulate them correctly. (Luckily the transition to ARM-based Macs doesn't require an endian change.)

In 2012, sixtyforce's just-in-time compilers were updated again to support 64-bit Intel Macs. This went much faster (the changes weren't as complicated), but nearly all of the cpu and dsp instructions needed to be updated.

Now today, in 2020, sixtyforce is again being rewritten to compile the 64-bit ARM instructions used by Apple's new Macs.