MOS-Hardware
This crate contains hardware register tables and support functions for
8-bit retro computers like the Commodore 64, MEGA65 and others.
Please check the examples/ directory to see how Rust can be
used to generate demo effects.
Aims
- Excellent support for Rust programming on CBM (inspired) 8-bit computers
- Labelled registers for expressive hardware programming
- Intuitive bitflags with type checks where possible
- Minimum resource impact
Examples
Read and write to labelled hardware registers
use ;
let old_border_color = .border_color.read;
.border_color.write;
.potentiometer_x.write; // error: read-only register
Use bitflags to safely control hardware behaviour
...for example where the VIC-II chip accesses screen memory and character sets:
let bank = AT_2C00.bits | AT_2000.bits;
.screen_and_charset_bank.write;
Convenience functions to perform hardware-specific tasks
...for example to generate random numbers using noise from the C64's SID chip:
.start_random_generator;
let random_number : u8 = rand8!;
Getting started
The project requires rust-mos and is setup to build for C64 by default. A docker image of rust-mos is available if you do not fancy compiling LLVM.
Docker and Visual Studio Code
The easiest way is to use provided devcontainer.json configuration for vscode:
- Configure Visual Studio Code with
Remote - Containersextension - Open this project inside devcontainer
- In vscode terminal do:
# build for mos-atari8-none target cargo build --target mos-mega65-none
Status
The hardware registers are currently incomplete and the library may be subject to significant changes.
-
sid -
vic2(partially) -
cia(partially) -
c64(particlly) -
mega65(partially) - Plasma-effect example
- Raster IRQ example