ZX Dream - online emulator ZX Spectrum in JavaScript
ZX Spectrum is an 8-bit home computer developed by British company Sinclair Research in 1982.
Thanks to various factors, among of which are implementation simpicity, low cost, the ability to connect to a TV-set and to load programs and games from tape,
the computer became widespread in subsequent years, both the original implementation and numerous clones and modifications,
which often had additional hardware and software features such as extended emmory, loading programs from diskettes, program sound generator and many others.
Thousands of programs and games have been written for ZX Spectrum, and a great library of musical and graphical works has been created, which is still being replenished.
ZX Dream emulates a set of devices of the original ZX Spectrum and its modifications.
Thanks to it, you can open numerios programs and execute them right in a browser, using a standard keyboard, mouse, display and speakers.
Also, it is possible to load programs from plenty formats of diskette and tape images, as well as snapshots.
Next hardware has been implemented:
Z80 CPU (including most of undocumented features)
ROM with page switching 48/Turbo/128/TR-DOS
512 Kb RAM, implemented by Pentagon scheme (via the port #7FFD)
Tape player (TZX, TAP and similar formats)
Beta Disk interface
Display with the feature of projecting 5 or 7 memory page (via the port #7FFD)
40-key keyboard
Kempston mouse (virtual + capture on the display click)
Kempston joystick (gamepad connection feature)
Programmable sound generator AY-3-891x/YM2149 (+ Beeper, + Turbo Sound) (Requires high performance system. Edge or Chrome are recommended.)
Other features:
loading TZX (including most of non-standard loaders) and TAP (and similar) tape formats
loading and saving disk images TRD, FDI, SCL, TD0, UDI (you can use the emulator as an disk image converter.)
loading images right from zip archives
loading SNA, Z80 snapshots
saveing SNA snapshots
video rendering with different methods ( putImageData, drawImage, WebGL ) and scaling
audio rendering with different methods ( ScriptProcessorNode, WorkletNode )
option to run emulation in the dedicated thread
virtual display and keyboard location are adjustable
Control
Virtual keyboard
A 40-key virtual keybord located in the workspace provides control over the emulator similar to a real ZX Spectrum keyboard.
The left mouse button click over a virtual key makes it pressed. With the help of the mouse wheel a virtual key can be held in the pressed state,
either till any next virtual key is pressed (wheel up) or till the explicit repeated press on the same pushed key (wheel down).
The virtual keyboard itself (as like as display though) can be draged to any location in the workspace.
Every key (as well as the original one) serves several purposes. The current one depends as on the mode the emulator shell in,
as the extra keys Caps Shift (CS) and Sysmbol Shift (SS) pushed at the moment:
In the keyword entering mode (K) a press on a key adds one of the key words specified under the main symbol.
In the literal entering mode (L) a press adds the main symbol. Caps Shift gives the control under the case of the entering symbols here.
A press on Symbol Shift in any of the aforementioned modes let you enter special symbols as well as some key words showed to the right of the main symbol.
Simultanious press of Symbol Shift and Caps Shift turns on the "edit" mode (E).
In the edit mode a press on a key (except digits) provides entering key words displayed above keys with the green color.
In the edit mode a press on a key simultaniously with any Shift key let enter symbols and red key words, which can be seen under keys.
Above the digit keys you can see commands which are performed by pressing the corresponding digit key with Caps Shift.
The control described earlier usually is used in the standard system shell only. The most of programs and games keyboard keywords and modes don't have any meaning.
The table shows the frequently used keys and their typical actions in games:
Command/Action
Typical key
Up
Q, K, CS + 7
Down
A, M, CS + 6
Left
O, Z, CS + 5
Right
P, X, CS + 8
Fire
M, BR, CS + 0
IBM PC Keyboard
Everything which has been said before can be applied to the physical IBM PC keyboard. Press on the physical key triggers
press on one or a few virtual keys (they can be seen by highlight).
The most of IBM PC keys correspond eponymous ZX Spectrum virtual keys. The following table displays the full key mapping:
IBM PC key
ZX Spectrum keys
0 ... 9
0 ... 9
A ... Z
A ... Z
Space
Break
Left Ctrl, Right Shift
Symbol Shift
Left Shift, Right Ctrl
Caps Shift
Caps Lock
Caps Shift + 2
Left arrow
Caps Shift + 5
Down arrow
Caps Shift + 6
Up arrow
Caps Shift + 7
Right arrow
Caps Shift + 8
Backspace
Caps Shift + 0
,
Sysmbol Shift + N
, with right shift
Sysmbol Shift + R
.
Symbol Shift + M
. with right shift
Symbol Shift + T
/
Symbol Shift + V
/ with right shift
Symbol Shift + C
:
Symbol Shift + O
: with right shift
Symbol Shift + Z
'
Symbol Shift + 7
' with right shift
Symbol Shift + P
-
Symbol Shift + J
- with right shift
Symbol Shift + 0
=
Symbol Shift + L
= with right shift
Symbol Shift + K
Virtual Kempston mouse
A ball and three buttons over it, placed to the right of the virtual keyboard, represent virtaul Kempston mouse (or trackball?).
The ball can be pulled with the left PC mouse button at the different directions, sending the corresponsing commands to the emulator.
The purpose of the buttons is obvious. A short PC mouse button click on the ball emulates a virtual mouse button click as well.
IBM PC mouse
If your browser supports Pointer Lock API, it's possible to click on the virtual display by the left mouse button in order to
control virtual pointer inside the emulator by moving the IBM PC mouse. It is worth to remeber, however, that each virtual coordinate
is stored as byte. Therefore, fast pointer movements (especially with high DPI) can lead to impossibility of programs to detect valid
virtual pointer offset. The virtual pointer will jump over the screen.
To exit the pointer lock mode you should usually press Escape button on the keyboard.
Gamepads
Connected gamepads (joysticks) can be mapped to Kempston-joystick interface, as well as to popular key sets often used in ZX Spectrum soft:
Sinclair, Cursor, QAOPM, QAOPSpace. The mapping of an already connected controller can be changed in the Properties dialog box.
Where to begin?
Insert the disk of your choice in the virtual drive A. Using arrows, select TR-DOS menu item and press Enter. Next, press R key (RUN command will appear) and then press Enter. Good luck! ;)