Analysis updated 2026-07-17 · repo last pushed 2026-06-11
Mix Rust or Zig with existing C code when building for the MOS 6502
Learn which data types and struct layouts break across languages on 6502
Use a proven toolchain recipe for cross-language 6502 development
Write performance-critical routines in C while writing logic in a safer language
| kassane/mos-toolchains-research | 100/dotfiles | adams549659584/my-openwrt-actions | |
|---|---|---|---|
| Stars | 1 | 1 | 1 |
| Language | Shell | Shell | Shell |
| Last pushed | 2026-06-11 | 2016-11-18 | 2020-06-06 |
| Maintenance | Maintained | Dormant | Dormant |
| Setup difficulty | hard | easy | hard |
| Complexity | 5/5 | 1/5 | 3/5 |
| Audience | developer | developer | ops devops |
Figures from each repo's GitHub metadata at analysis time.
Requires pinned, unofficial LLVM-MOS toolchain forks for each language with no stability guarantees.
This repo answers a specific technical question: can programs written in five different programming languages (C, C++, Rust, D, and Zig) all work together in a single application that runs on the MOS 6502, the classic 8-bit processor that powered the original Nintendo, Apple II, and Commodore 64. Normally, mixing languages is hard enough on modern computers, on a 1970s-era chip with 8-bit registers and 16-bit memory addresses, it is much harder. The project runs a battery of automated experiments on a 6502 simulator to prove that these languages can actually call each other's functions, share data, and run together in one binary. The answer turns out to be yes, with a few caveats. All five languages share a common underlying foundation (the LLVM-MOS backend), which means they all produce compatible machine code. The experiments demonstrate that functions written in one language can call functions written in another, pass numbers and pointers back and forth, and use callbacks. The project also documents where things break: the int keyword means different sizes in different languages, and Zig's struct layout can corrupt data unless you force fields to align to one byte. The recommended fix is to pass complex data by pointer rather than by value, since there is no guarantee these unofficial toolchain ports will stay stable across versions. The audience here is narrow: people building software for retro or embedded 6502 systems who want to use a modern language like Rust or Zig alongside existing C code. For example, someone writing a game for a retro console might want to keep a performance-critical rendering routine in C while writing game logic in Zig, or use Rust's safety checks for memory management. This repo gives them a proven recipe for making that work, complete with specific toolchain versions and known pitfalls. What makes the project notable is its empirical approach. Rather than theorizing about whether cross-language calls should work, it runs 27 self-contained experiments on a simulator, each proving a specific claim with a pass or fail result. The toolchains themselves are all unofficial forks, not part of any language's mainstream release, so the project pins exact versions and warns that there are no stability guarantees.
An experimental project proving that C, C++, Rust, D, and Zig code can interoperate in one binary on the classic MOS 6502 8-bit processor via LLVM-MOS.
Mainly Shell. The stack also includes C, C++, Rust.
Maintained — commit in last 6 months (last push 2026-06-11).
Setup difficulty is rated hard, with roughly 1day+ to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.