This crate contains hardware register tables and support functions for
8-bit retro computers like the Commodore 64, Commander X16, MEGA65 and others.
Please check the examples
directory to see how Rust can be used to generate simple demo effects.
~~~ rust use moshardware::{c64,vic2}; let oldbordercolor = (*c64::VIC).bordercolor.read(); (c64::VIC).border_color.write(vic2::LIGHT_RED); (c64::SID).potentiometer_x.write(3); // error: read-only register ~~~
...for example where the VIC-II chip accesses screen memory and character sets:
~~~ rust let bank = vic2::ScreenBank::AT2C00.bits() | vic2::CharsetBank::AT2000.bits(); (*c64::VIC).screenandcharset_bank.write(bank); ~~~
...for example to generate random numbers using noise from the C64's SID chip:
~~~ rust (*c64::SID).startrandomgenerator(); let random_number : u8 = rand8!(c64::SID); ~~~
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.
The easiest way is to use the provided .devcontainer.json
configuration for vscode:
The hardware registers are currently incomplete and the library may be subject to significant changes.
sid
vic2
cia
(partially)c64
memory map (particlly)vera
via
(partially)cx16
Memory map (partially)