5 releases (breaking)
0.16.0 | Mar 31, 2023 |
---|---|
0.15.0 | Oct 17, 2021 |
0.14.0 | Sep 1, 2021 |
0.13.0 | May 24, 2021 |
0.12.0 | May 16, 2021 |
#357 in Emulators
546 downloads per month
Used in 2 crates
240KB
5.5K
SLoC
RustZX
ZX Spectrum emulator written in Rust
- Watch this video showcase (
v0.9.x
) - Read CHANGELOG.md for info on the latest version changes
Features
- Written in pure rust
- Cross-platform
- Full ZX Spectrum 48K and 128K emulation
- Perfect emulation of Z80 core
- Highly precise AY chip emulation
- Beeper sound emulation
- Supported formats:
tap
- tapesna
- snapshot, both 48K and 128K versions supportedscr
- screenshot
- Fast loading of tap files with standard loader
- Precise timings
- Full border emulation
- Joystick emulation: Kempston, Sinclair
- Kempston mouse emulation
- Extended 128K keys emulation (arrows, backspace, caps lock)
- Quick save/load
- Compressed assets support (only
.gz
for now) - Separate
no_std
core library which can be used to port emulator almost anywhere.- Global allocator is still needed, but all dynamic allocations were minimized
- All resource-heavy features are configurable via cargo
features
- Obscure Z80 features emulation:
WZ/memptr
register (F3/F5
flags obscure behavior inBIT n, (HL)
)Q
register (F3/F5
flags obscure behavior inSCF
andCCF
)- Block instruction flags oddities (
LDxR
/CPxR
/INxR
/OTxR
)
Install
- Sure that you have C compiller and CMake to
build bundled
sdl2
- (Linux-specific) Install required development packages:
libasound2-dev
- Install it with cargo
cargo install rustzx
How to use
rustzx --help # Show help
rustzx test.tap # Autodetect file type and run in 48K mode
rustzx --ay test.tap # Run in 48K mode with AY sound chip
rustzx -m128 --tape test128.tap # Run in 128K mode with tape
rustzx --rom tester.rom -s3 # Run with custom rom and 3x screen scaling
rustzx --nofastload test.tap # Run without fast tape loading
rustzx --mouse test.tap # Run with Kempston mouse support
For loading tape in 48K mode, press j
then Ctrl+p
twice, as on real Spectrum.
You should see LOAD ""
on emulator's screen, then press Enter
(in 128K mode just press enter).
In --nofastload
mode, press Insert
to play the tape and Delete
to stop
If you have choppy audio, try --sound-latency
option with bigger values.
Default key bindings:
F1
- quick saveF2
- quick loadF3
- set normal emulation speedF4
- set 2x emulation speedF5
- max possible emulation speedF6
- enable frame trace infoF9
- enable kempston/sinclair joy keyboard layerInsert
- start tapeDelete
- stop tapeEnd
- break commandCaps Lock
- caps lock commandBackspace
- delete<Arrows>
- 128K arrow keysEsc
- unlock mouse (if--mouse
is used)
In joy keyboard layer mode (F9)
<Arrows>
- Kempston joy arrowsAlt
- Kempston fireWASD
- Siclair Joy 1 arrowsCaps Lock
- Sinclair Joy 1 fireIJKL
- Siclair Joy 2 arrowsEnter
- Sinclair Joy 2 fire
Screenshots
References
Many resources were used to find out, how to buildthis emulator. Huge thanks to the following resources which helped to figure out a lot of defails about ZX Spectrum.
- Of course z80.info
- Instruction table from ClrHome
- "Floating bus explained!" by Ramsoft
- 16K / 48K ZX Spectrum Reference
- 128K ZX Spectrum Reference
- Z80 hardware organization
- disassembler.io online disassembler
- Cool z80 assembler zasm
- Diagnostic ROM by Phill
- zx-modules.de - great resource, check it out!
- speccy.info
- Harlequin
- And many other great material, which helped me to make rustzx!
- FUSE emulator source for finding out correct timings
- YAZE test suite
- z80test test suite
- ROM routines
ROM's
Emulator contains ROMs, created by by Sinclair Research Ltd (now owned by Amstrad plc),
Amstrad has given
permission to distribute their ROM's in conjunction with emulators.
In RustZX these ROMs included in source of the core emulator library mod rustzx_core::zx::roms
. Embedded roms
can be opted-out from the core library by disabling feature embedded-roms
.
Dependencies
~0.9–1.6MB
~34K SLoC