S P E C T R U S T Y is a library for building emulators based on various ZX Spectrum computer models and clones.
Components of the library can also be used to implement chiptune players, format converters, and more.
Because of its vast scope, SPECTRUSTY has been split into several dependent crates and one extra crate with complementary utilities. The additional crates can be used separately or through this library.
spectrusty- this library.
- spectrusty-core - defines basic traits and structs.
- spectrusty-audio - tools for synthesizing and playing audio samples.
- spectrusty-formats - file formats and related utilities.
- spectrusty-peripherals - emulators of various peripheral devices.
- z80emu - Zilog's Z80 CPU family emulator, re-exported as
The separate crate spectrusty-utils, provides additional utilities, like TAPe organizers, tape ROM auto-loader, printer utilities, and keyboard helpers for various platforms.
Several features control which components will be included:
"audio"- includes spectrusty-audio which is re-exported as audio.
"formats"- includes spectrusty-formats which is re-exported as formats.
"peripherals"- includes spectrusty-peripherals which is re-exported as peripherals.
"snapshot"- enables serde serializers and deserializers, so custom snapshots can be created with ease in elastic formats.
"compression"- enables gzip compression/decompression of memory chunks stored in snapshots.
"boxed_frame_cache"- chipset implementations will have significantly reduced struct sizes by boxing their internal UlaFrameCache instances at the cost of a minimal performance penalty.
"sdl2"- enables audio implementation for SDL2 hardware abstraction layer.
"cpal"- enables audio implementation for cpal native audio library.
The default features are:
default = ["formats", "peripherals", "snapshot", "compression"]
Implemented by ZX Spectrum's core chipset emulators.
Responsible for code execution, keyboard input, video, and accessing peripheral devices:
|UlaCommon||A grouping trait that includes all of the traits listed below in this table|
|ControlUnit||Code execution, reset/nmi, access to BusDevice peripherals|
|FrameState||Provides access to the frame and T-state counters|
|MemoryAccess||Provides access to onboard memory ZxMemory and memory extensions MemoryExtension|
|Video||Rendering video frame into pixel buffer, border-color control|
|KeyboardInterface||Keyboard input control|
|EarIn||EAR line input access|
|MicOut||MIC line output access|
|UlaControl||Accessors for specialized ULA functionality|
|UlaAudioFrame||A grouping trait that includes all of the traits listed below in this table|
|AudioFrame||A helper trait for setting up Blep and ending audio frames|
|EarMicOutAudioFrame||Adds Blep steps from EAR/MIC output lines data|
|EarInAudioFrame||Adds Blep steps from EAR/MIC output lines data|
|AyAudioFrame||Renders Blep steps from AY-3-891x sound processor|
Emulated computer configurations:
|HostConfig||Defines CPU clock frequency and a video frame duration|
Associated traits implemented by special unit structs for driving audio and video rendering and memory contention:
|VideoFrame||Helps driving video rendering, provides arithmetic and conversion tools for VideoTs timestamps|
|MemoryContention||A trait that helps establish if an address is being contended|
|AmpLevels||Converts digital audio levels to sample amplitudes|
Implemented by other components:
|Cpu||Z80 CPU||Central processing unit|
|ZxMemory||System memory||An access to memory banks, pages, screens, attaching external ROM's|
|PagedMemory16k||Memory group||Groups memory implementations with 16k paging capability|
|PagedMemory8k||Memory group||Groups memory implementations with 8k paging capability|
|MemoryExtension||Memory extensions||Installs program counter traps to switch in and out external banks of memory|
|BusDevice||I/O peripheral devices||Establishes address and data BUS communication between CPU and peripherals|
|Blep||Bandwidth-Limited Pulse Buffer||An intermediate amplitude differences buffer for rendering square-waves|
These are the most commonly used:
|VideoTs||A video T-state timestamp, that consist of two components: a scan line number and a horizontal T-state|
|VFrameTs||A VideoFrame aware video T-state timestamp, for timestamp calculations|
|VFrameTsCounter||Counts T-states and handles the CPU clock contention|
|Ula||A chipset for emulating ZX Spectrum 16/48k PAL/NTSC|
|Ula128||A chipset for emulating ZX Spectrum 128k/+2|
|Ula3||A chipset for emulating ZX Spectrum +2A/+3|
|Scld||A chipset for emulating TC2048 / TC2068 / TS2068|
|UlaPlus||A wrapper chipset enhancer for emulating ULAplus graphic modes|
M: A system memory that implements ZxMemory trait.
B: A peripheral device that implements BusDevice.
X: A memory extension that implements MemoryExtension.
V: A unit struct that implements VideoFrame.
C: A unit struct that implements MemoryContention.
U: An underlying chipset implementing UlaPlusInner.
System bus device emulators to be used with ControlUnits.
Chipset emulation building blocks and implementations.
T-state timestamp types and counters.
Emulator components of various ZX Spectrum peripheral devices.