Rust examples targeting MOS 6502/65816 platforms via llvm-mos-sdk.
- rust-mos — Rust toolchain with LLVM-MOS backend.
- llvm-mos-sdk v23.x
Important
Both toolchains are LLVM 23 based to LTO.
Cargo build with -Zbuild-std -Zunstable-options -Zjson-target-spec (RUSTC_BOOTSTRAP=1 required).
Output extensions are set per-platform via exe-suffix in the target JSON:
| Platform | Extension | Example output |
|---|---|---|
| NES | .nes |
target/mos-nes-nrom-none/release/nes-nrom-hello.nes |
| SNES | .sfc |
target/mos-snes-none/release/snes-hello.sfc |
| C64 | .prg |
target/mos-c64-none/release/hello.prg |
| MEGA65 | .prg |
target/mos-mega65-none/release/mega65-hello.prg |
| SIM | (none) | target/mos-sim-none/release/hello (host-format ELF) |
RUSTFLAGS="-Clink-arg=-flto -Clink-arg=-Wl,-u,main -Clink-arg=-Qunused-arguments -A linker_messages" cargo build \
--target targets/mos-nes-nrom-none.json \
-Zbuild-std -Zunstable-options -Zjson-target-spec \
--release -p demo-nes --bin nes-nrom-helloRUSTFLAGS="-Clink-arg=-flto -Clink-arg=-Wl,-u,main -Clink-arg=-Qunused-arguments -A linker_messages" cargo build \
--target targets/mos-mega65-none.json \
-Zbuild-std -Zunstable-options -Zjson-target-spec \
--release -p demo-mega65RUSTFLAGS="-Clink-arg=-flto -Clink-arg=-Wl,-u,main -Clink-arg=-Qunused-arguments -A linker_messages" cargo build \
--target targets/mos-c64-none.json \
-Zbuild-std -Zunstable-options -Zjson-target-spec \
--release -p demo-c64cargo build --target targets/mos-snes-none.json \
-Zbuild-std -Zunstable-options -Zjson-target-spec \
--release -p demo-snes --bin snes-hello- zig-mos-examples - examples based
- mrk-its/rust-mos v1.87 [old - no asm-inline support] - this project uses v1.98-dev!