November 30, 2025

Pi on a potato, drama on a platter

LLVM-MOS – Clang LLVM fork targeting the 6502

Retro chips get a glow-up: C64 does pi, devs argue fork vs old-school

TLDR: llvm-mos brings modern C/C++ to the 6502 chip powering retro consoles, with demos like a Commodore 64 calculating pi. Fans cheer practicality while debates flare over why it’s a fork, whether it beats the old cc65 toolchain, and a Rust-on-C64 link adds hype.

The retro crowd is buzzing: llvm-mos, a fork of the popular LLVM compiler toolkit, brings modern C and C++ to ancient 6502 chips—the brains behind the NES and Commodore 64. One dev, mtklein, basically retired the “weird code” meme, saying they could “write pretty much normal C and have it work on the 6502.” Cue victory laps and people smashing the Godbolt link to watch a C64 crank out 100 digits of pi like it’s 1985 and the future at the same time.

But it’s not all high-fives. michalpleban lobbed the big question: how does this stack up against cc65, the classic toolchain? The performance showdown (code size! speed!) became the thread’s main popcorn moment, especially since the project claims it “tends to outperform” legacy compilers. Meanwhile, gregsadetsky sparked an “why fork?” debate—some shrug that upstreaming to LLVM’s main project is a marathon, not a sprint, and this crew wanted to ship now. cmrdporcupine confessed they once “gave up thinking it’d never be practical,” and now it’s real—and possibly coming for the beefier 65816 chip someday. Bonus meme fuel: self_awareness dropped a Rust-on-C64 link (rust-mos), setting off “Rust everywhere” jokes. The team’s Discord is open, and the vibe is: retro, but make it modern—and make it fast.

Key Points

  • llvm-mos is an open-source fork of LLVM/Clang adding a new backend and target support for MOS Technology 65xx microprocessors, including the 6502.
  • The compiler offers broad C99 and C++11 freestanding compatibility and leverages Clang’s error diagnostics.
  • It implements novel optimizations for 6502 code size and speed and is described as outperforming legacy 6502 compilers.
  • An open-source SDK provides target-specific code, a minimal C standard library, example programs, and supports over two dozen targets including a host-based simulator.
  • The project features complete ELF support for 6502, automated testing and benchmarking via GitHub runners, public development discussions on Discord, and is not affiliated with the LLVM Foundation.

Hottest takes

“write pretty much normal C and have it work on the 6502.” — mtklein
“gave up thinking it’d never be practical” — cmrdporcupine
“How does it compare to cc65 with regard to code size and speed?” — michalpleban
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.