12 releases (6 breaking)
| new 0.15.0 | Dec 5, 2025 |
|---|---|
| 0.13.0 | Dec 5, 2025 |
| 0.1.2 | Nov 13, 2025 |
#1650 in Hardware support
Used in 2 crates
105KB
2K
SLoC
What if Rust, on GameTank?
What?
The GameTank is a retro-inspired game console running dual 6502 processors. It has 128x128 composite out, with up to 200 colors. It's kind of like if Pico8 were real hardware -- with real hardware limitations, and neat tricks!
Why?
I like Rust, I like GameTank. What if, both?
How?
Rust compiles via LLVM. There is LLVM-MOS, which can target the 6502. Throw all that together and create some linker scripts, we should have a stew.
GameTank SDK (Rust)
This SDK produces 2MB GameTank ROMs (.gtr) to be uploaded to physical cartridges, or to be played in the emulator.
Bundled with the SDK are development tools:
| tool | description |
|---|---|
gtld |
used to flash .gtr ROMs to cartridges, and to update the flasher firmware. |
gte |
the rusty gametank emulator. It's not quite as featureful as the C++ version, but it's easier to install, useful for basic debugging/testing |
gtrom |
converts the elf binary generated by cargo build into a .gtr. In the future might make a .gtr2, which would include metadata and debug info, which could be interpreted by gte or gtld. |
gtgo |
intended to be a "one-stop-shop" for development, this tui includes tools for building |
development is done in vscode (sry), and there's a .vscode/settings.json for the linked projects for rust analyzer.
Game development is handled in the sdk directory
Requirements
VSCode
Trust Me Bro, please use a VSCode derivative for this project, or if you're 1337 you can use *vim/emacs/
Windows
Please use WSL.
Windows (WSL)
powershell:
wsl.exe --install
turn it off an on again
wsl.exe --install Ubuntu-22.04
enter linux shell
sudo apt update sudo apt install podman build-essential libasound2-dev libudev-dev podman pull docker.io/dwbrite/rust-mos:gte curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh cargo install just cargo install gtsdk
wsl -d Ubuntu-22.04
Windows (Native)
don't, just fucking don't, just dooooooon't
mkdir sdk/rom/target mkdir sdk/rom/target/asm
➜ podman run -d --name gametank -v $(pwd):/workspace:z --replace rust-mos:gte sleep infinity ➜ podman exec -it -w /workspace gametank /bin/zsh
➜ find . -name "*.asm" -exec bash -c 'filename=$(basename "{}" .asm); echo "Assembling $filename..."; llvm-mc --filetype=obj -triple=mos -mcpu=mosw65c02 "{}" -o "target/asm/$filename.o"' ;
➜ bash -c 'llvm-ar rcs target/asm/libasm.a target/asm/.o && rm target/asm/.o'
➜ llvm-objdump -s target/mos-unknown-none/release/main
➜ cargo +mos build --release -Z build-std=core --target mos-unknown-none
IMPORTANT
After just/cargo build-ing, use gtrom to pack elf into a raw binary
Dependencies
~4.5MB
~69K SLoC