Sinclair ZX Spectrum is an 8-bit computer that consists of a Central Processing Unit, a clock, some memory, and a custom Sinclair Uncommitted Logic Array (ULA) chip. The chip is responsible for I/O with peripherals such as the keyboard and for generating audio and video output. ULA also generates interrupts. When it needs to read pixel data from video memory, it can pause the clock when the CPU is accessing the same part of RAM (memory contention). Moreover, the raw address, data, and control lines of Z80 CPU (in SPECTRUSTY called “the BUS”) are being exposed to allow external devices to be attached.
SPECTRUSTY is a set of components designed in a way that mimics Spectrum’s hardware parts and peripherals. The components are structs and enums that are often having generic types in their definitions. Every such a generic stand-in needs to be substituted by the concrete sub-component. Functions of components are realized via Rust’s trait system.
Other notable traits for peripherals, such as printers, joysticks, serial ports, sound chipsets, microdrives e.t.c. are:
Both are best served with a RUSTUP utility. If you don’t like the language scoped version managers, some Linux distributions and 3rd party packaging systems also provide appropriate Rust and Cargo packages.
To check if you can continue, you should be able to run the
cargo utility by creating a new repository for your emulator program:
cargo new my-spectrum-emu
If you see a message:
Created binary (application) `my-spectrum-emu` package
then you are good to go.
This tutorial and example sources in this repository are free to use under the terms of the Blue Oak Model License 1.0.0. See: https://blueoakcouncil.org/license/1.0.0.