Skip to content

Minimal ZX Spectrum 48K emulator in JavaScript, with easy to understand, well structured code.

License

Notifications You must be signed in to change notification settings

dcrespo3d/MinZX

Repository files navigation

MinZX

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.

MinZX

Features

  • 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.

Features not implemented

  • 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.

Thanks to

About

Minimal ZX Spectrum 48K emulator in JavaScript, with easy to understand, well structured code.

Resources

License

Stars

Watchers

Forks