A working Rust application that runs on a real Apple Macintosh SE (68000 CPU, System 6). It uses no_std bare-metal Rust for program structure and Ferris drawing, with a small GCC-compiled C shim for Mac Toolbox wrappers and event handling.
Currently opens a Macintosh document window and draws Ferris from Rust.
- Rust compiles to m68k ELF via the
m68k-unknown-none-elfTier 3 target (nightly) objcopyextracts a flat binary from the ELFelf2mac.pywraps the code in CODE 0 (jump table) + CODE 1 resources as MacBinaryRez(from Retro68) compiles ALRT/DITL dialog resources and merges with CODEhcopyplaces the final MacBinary onto an HFS floppy disk image
Toolbox and QuickDraw wrappers live in csrc/helpers.c, compiled with Retro68 GCC to avoid LLVM m68k backend bugs in the trap-heavy and loop-heavy paths.
Requires:
- Rust nightly with
rust-srccomponent (rustup component add rust-src --toolchain nightly) - Retro68 toolchain built at
~/git/Retro68-build/toolchain/ - hfsutils (
hmount,hcopy,humount)
make build # C helpers + Rust -> m68k ELF (fast after first core build)
make convert # ELF -> flat binary -> MacBinary with Rez resources
make disk # Create 1440K HFS floppy image with the application
make disasm # Disassemble ELF to verify 68000 instructions
~/mac68k/minivmac ~/mac68k/System6_0_1.dsk ./MacSeRust.dsk
src/main.rs— Entry point and Ferris drawing logic in Rustcsrc/helpers.c— Toolbox, QuickDraw, window, and event-loop wrappers compiled with GCCres/macserust.r— Rez resource definitions (ALRT, DITL)tools/elf2mac.py— Converts flat m68k binary to MacBinary with CODE resources.cargo/config.toml— Cross-compilation config for m68k-unknown-none-elf
- Get m68k-unknown-none-elf target with no_std
- Use inline assembly to call Mac Toolbox traps
- Use Rez resource compiler to create proper Mac application
- Draw Ferris in a real window on a real (emulated) Mac SE
- Eventually link with Coco or other libraries
