Rust
The rust-mos project is based on llvm-mos and llvm-mos-sdk and allows Rust programs to run on 6502. You may either build and install rust-mos from scratch by following the instructions here, or use a pre-build Docker image.
Getting started[edit | edit source]
Using Docker from Visual Studio Code[edit | edit source]
By providing a .devcontainer.json
file, VSC can automatically launch a container for your project. See Hello World, mos-hardware, or other examples at the bottom of this page for how to set this up.
Using Docker from the terminal[edit | edit source]
Install and run Docker desktop and start the image from a terminal:
docker pull mrkits/rust-mos
docker run -it --name myrustmos --entrypoint bash -v ${HOME}/Documents:/hostfiles mrkits/rust-mos
This will start up a new container where $HOME/Documents
is mounted in /hostfiles
on the virtual machine. This will work regardless of your local architecture, but will run slower on e.g. arm-based systems as the image is prepared for x86. You may replace mrkits/rust-mos
with mikaellund/rust-mos
for an arm-based build (see link below for building an image for arm64). If you have exited from the shell, you may return to the running container with:
docker container exec -it myrustmos /bin/bash
A stopped container can be started with:
docker container start -i myrustmos
Minimal Example[edit | edit source]
For a minimal example, see this github project. Here you will also find instructions of how to use the above Docker container from Visual Studio Code.
Other resources[edit | edit source]
- Atari 800XL utility crate.
- mos-alloc crate for heap allocation needed by e.g.
alloc::vec
andalloc::boxed
. - mos-test crate providing alternative test harness that lets you write and run tests on all llvm-mos platforms
- mos-hardware crate for Commodore targets like C64 and MEGA65 that allows named access to registers, raster interrupts etc. (examples). There's also a GitHub template for starting a new project.
- How to build rust-mos Docker image for arm64 (faster on Apple silicon)
- Example: Hello world.
- Example: Atari Ferris Demo. See also emulation in browser.
- Example: Advent of Code 2022 on Atari. 🎄