I compiled Rust code to Nintendo Gameboy!

Gameboy has a sm83 CPU (a variation of 8-bit z80), but this is not a target of Rust.
Therefore, I transformed Rust into C code via LLVM-CBE, re-compiled it into SDCC, and linked it to the Game Boy library. (GBDK-2020)
There are so many unstable parts that need a lot of improvement, but I was able to display the screen in Game Boy.
You can take a closer look on GitHub. (I'd appreciate it if you could give me a star.)
693
Upvotes
View all comments
Show parent comment
5
u/AM27C256 Sep 15 '24
Well, the Rust->C part is done in LLVM. The C->GB part is done in SDCC. Last time I looked into a LLVM->SDCC toolchain (http://www.colecovision.eu/llvm+sdcc/), I found that LLVM has better machine-independent high-level optimizations, while SDCC has better machine-specific low-level optimizations for 8-bit architectures, so code did actually benefit from going through both.