Skip to content

kassane/rust-mos-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-mos-examples

Rust examples targeting MOS 6502/65816 platforms via llvm-mos-sdk.

Requirements

Important

Both toolchains are LLVM 23 based to LTO.

Building

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)

NES NROM

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-hello

MEGA65

RUSTFLAGS="-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-mega65

C64

RUSTFLAGS="-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-c64

SNES LoROM

cargo build --target targets/mos-snes-none.json \
  -Zbuild-std -Zunstable-options -Zjson-target-spec \
  --release -p demo-snes --bin snes-hello

References

About

Using rust + llvm-mos-sdk on some examples

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Contributors