Skip to content

senormeow/macserust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust for the Mac SE

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.

Mac SE

How It Works

  1. Rust compiles to m68k ELF via the m68k-unknown-none-elf Tier 3 target (nightly)
  2. objcopy extracts a flat binary from the ELF
  3. elf2mac.py wraps the code in CODE 0 (jump table) + CODE 1 resources as MacBinary
  4. Rez (from Retro68) compiles ALRT/DITL dialog resources and merges with CODE
  5. hcopy places 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.

Build

Requires:

  • Rust nightly with rust-src component (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

Run

~/mac68k/minivmac ~/mac68k/System6_0_1.dsk ./MacSeRust.dsk

Project Structure

  • src/main.rs — Entry point and Ferris drawing logic in Rust
  • csrc/helpers.c — Toolbox, QuickDraw, window, and event-loop wrappers compiled with GCC
  • res/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

Goals

  • 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

About

A working Rust application that runs on a real Apple Macintosh SE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors