Meteorite logoMeteorite
Back to videos

C vs Rust on the Commodore 64

Through the LLVM-MOS project it is now possible to target the MOS 6502 architecture as found in the Commodore 64, Apple II, and many other 1980s micro computers. Here's a comparison of a plasma effect programmed in C and Rust, respectively. - The Rust source code is available here: https://github.com/mlund/mos-hardware - The C source is available here: https://github.com/mlund/mega65-adventure/tree/main/llvm-c64 - In the initial dot "..." phase, a character set is being generated. When recording the video, Rust used a slower random number generator than C, which is why Rust is initially more sluggish. In the linked source, Rust and C used the same random number source, whereby the pre-calculation step is the same for C and Rust. - Both C and Rust uses LLVM-MOS for code generation. - The PRG files are around 1 kB; the C version slightly less than the Rust version. - For more about the algorithm, see this article on Medium: https://medium.com/@c64oldstories/plasma-on-the-commodore-64-anatomy-of-a-classic-demo-effect-a0a2ac21b05a

Suggested videos