Skip to content

milo-language/emulators

Repository files navigation

Milo emulators

Super Mario Bros. 3 running on the Milo NES emulator Sonic the Hedgehog running on the Milo Genesis emulator Super Mario World running on the Milo SNES emulator

NES, SNES, and Genesis emulators written in Milo — a memory-safe systems language with no GC and no lifetime annotations. Cycle-driven CPU cores, scanline PPU/VDP rendering, and audio, with SDL2 for video, sound, and input.

No unsafe. No garbage collector. Commercial games run at full speed.

Documentation · Download a release — SDL2 is statically linked, so nothing needs installing.

Install

P=$(uname -s | tr A-Z a-z)-$(uname -m | sed 's/x86_64/x64/;s/aarch64/arm64/')
curl -fsSL https://github.com/milo-language/emulators/releases/download/latest/milo-emulators-$P.tar.gz | tar xz
cd milo-emulators-$P
./nes path/to/rom.nes

Download through a browser instead and macOS quarantines the archive: the unsigned binary is killed on first run and moved to the Trash. Either install with curl as above, or clear the flag with xattr -dr com.apple.quarantine <dir> before running.

--version prints the commit the binary was built from. Releases roll on the latest tag, so re-running the install command is the update path.

Core Directory State
NES nes/ Games play with audio. APU incl. DMC, multiple mappers. See PROGRESS.md
Genesis genesis/ 68000 + Z80 + VDP. Sonic, Golden Axe, Aladdin play. See PROGRESS.md
SNES snes/ Super Mario World and Donkey Kong Country play; Star Fox boots (Super FX/GSU). See PROGRESS.md

Also here:

  • retro/ — a console front-end that builds all three cores and launches them from one menu
  • shared/ — SDL bindings, bitmap font, and menu core shared by the front-end
  • menu.milo — fullscreen SDL ROM browser, scans roms/{nes,genesis,snes}
  • arcade.sh — dispatches a ROM to the right core by file extension

Build

Requires the milo compiler and SDL2.

milo build nes/nes.milo -o nes --release
./nes path/to/rom.nes

SDL2 is linked via Milo's @link attribute — no manual -lSDL2 needed.

To build every core plus the front-end:

./retro/build.sh release

Correctness

The cores are checked against reference implementations rather than eyeballed:

  • NES traces are diffed against jsnes
  • Genesis and SNES CPU cores run the SingleStepTests Harte suites (harte.sh, harteSpc.sh)
  • Genesis is additionally diffed against Musashi

ROMs are not distributed here.

About

NES, SNES, and Genesis emulators written in Milo

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages