Minimalistic ZX Spectrum 48K emulator written in JavaScript.
It has screen, keyboard and sound, and can load snapshots in SNA format.
This emulator started as a personal project with the following goals:
- Learning Z80 assembly programming.
- Learning about the architecture of the ZX Spectrum.
It gradually evolved towards a fairly complete emulator, without adding too much code complication.
The project totals ~1200 lines of code*
(including lots of comments and empty lines), so it's great for learning how an emulator works. Its code is well structured, with separate classes for screen, keyboard, sound and core machine.
(*
excluding Z80.js
which emulates the Z80 CPU and has ~3400 lines of code).
Try it here. Keyboard required, not for mobile.
- ZX Spectrum 48K emulation with original ROM.
- Screen emulation with border, BRIGHT and FLASH attributes. Controls for scaling screen.
- Keyboard emulation, from DOM keydown/keyup events.
- Sound emulation with 4x supersampling for clear beeper tunes.
- SNA snapshot loading from local filesystem.
- Good compatibility with LOTS of supported games (48K SNA only).
- Quick snapshot saving / loading, for evil games like Jet Set Willy ;-)
- Good timing, counting processor cycles, using vertical interrupts, and a simplistic contended memory algorithm.
- Intra-frame border changes. Border is refreshed once per frame.
- Tape loading, only loading mechanism is through SNA snapshot.
- Some precise emulation details, such as contended ports, snow effect, and others.
- Molly Howell for her Z80 emulator in Javascript.
- Amstrad PLC for the ZX Spectrum ROM binaries liberated for emulation purposes.
- My uncle Pedro for introducing me to the ZX81 and the ZX Spectrum.