Say Hello to Moira 68k
Moira is a Motorola 68k CPU emulator with high emulation accuracy, both functionally and temporally. It emulates the 680x0 family up to the 68040, including the EC and LC variants, as well as the 68881 and 68882 floating-point coprocessors that can be connected to the 68020 and 68030.
Moira is written in C++20, has no external dependencies, and is published under the terms of the MIT License. It is the CPU core of vAmiga, a high-precision emulator for the Commodore Amiga.
| Model | Cycle‑exact | Loop mode | I‑Cache | D‑Cache | FPU | MMU |
|---|---|---|---|---|---|---|
| 68000 | – | – | – | – | – | |
| 68010 | – | – | – | – | ||
| 68EC020 | – | – | – | 68881 / 68882 | – | |
| 68020 | – | – | – | 68881 / 68882 | – | |
| 68EC030 | – | – | 68881 / 68882 | – | ||
| 68030 | – | – | 68881 / 68882 | |||
| 68EC040 | – | – | – | – | – | – |
| 68LC040 | – | – | – | – | – | |
| 68040 | – | – | – | – | Built-in |
Moira was originally designed for Amiga emulation, which requires not only exact cycle counts, but also memory accesses at the proper DMA cycles. Address errors and bus errors produce the stack frames of the real CPU.
Instruction handlers are generated from C++ templates, one per opcode variant and CPU core. Moira outperforms Musashi, one of the fastest 68k emulators ever written.
The built-in disassembler covers all models and the FPU, in Motorola or MIT syntax. Additional styles reproduce the output of Musashi, UAE, and GNU binutils.
Breakpoints, watchpoints, catchpoints, software traps, single-stepping, and an instruction log are built right into the CPU.
Moira emulates the 68881, the 68882, and the FPU of the 68040, including the transcendental functions. All arithmetic runs on Moira's own 80-bit implementation, so results are identical on every host.
Save, restore, and clone the complete CPU state with a few lines of code. Snapshots are host-independent, and checksums compare two CPUs in an instant.
Already using Musashi? The adapter implements Musashi's C API on top of Moira. Relink your project and keep your code. Compatibility modes can mimic the behavior of Musashi, UAE, or MAME.
Your system connects through a small set of functions for memory accesses and events. Override them as virtual functions in a subclass, or define them directly to avoid the cost of virtual calls. A single option switches between the two.
Builds with Clang, GCC, and MSVC on macOS, Linux, and Windows. Moira compiles to WebAssembly, too, which makes it a first-class choice for emulators running in the browser.