Chris Collins

Tools · retro

ZX Spectrum emulator and Z80 IDE

A ZX Spectrum 48K and 128K and a Timex Sinclair TS2068 / TC2068 in your browser, with the original ROMs, a Z80 assembler and a debugger — assemble and run example programs (including Timex hi-res and hi-colour), set breakpoints, step through code, and inspect registers, memory, bank maps and screen addresses. Loads TAP, TZX, SNA, Z80 and DCK files.

Added · updated 17 October 2026

Works with

How to use it

The Spectrum switches on by itself the first time you run something (or press Power on). It boots its own ROM to the familiar © 1982 Sinclair Research Ltd (or the 128K menu, or the 2068’s © 1983 Timex Computer Corp). Click the screen to give it the keyboard.

Models

Choose the machine in the toolbar; it restarts with that ROM.

Spectrum 48K

The original: 3.5 MHz, 224 T-states × 312 lines, 50.08 Hz.

Spectrum 128K

3.5469 MHz, 228 × 311 lines; memory paging on port $7FFD and the AY-3-8912 sound chip.

Timex TS2068

The American Timex Sinclair 2068: 3.528 MHz, 224 × 262 lines — 60 Hz NTSC. The SCLD gives it extra screen modes (port $FF) and 8K memory paging (port $F4) to the 8K EXROM and the cartridge DOCK; an AY-3-8912 on ports $F5/$F6 whose I/O port reads two joysticks; and BASIC with six new keywords.

Timex TC2068

The Portuguese 2068: the same machine at 3.5 MHz, 224 × 312 lines, 50 Hz.

The 2068 ROM moved most of the Spectrum ROM’s routines (CHAN-OPEN is at $1230, not $1601), so much 48K software that calls the ROM doesn’t run on it, as on the real machine — use the 48K for Spectrum games.

Timex 2068 screen modes, banking and keywords

Bits 0–2 of port $FF (the DEC register) choose the screen:

0

Standard: bitmap $4000, attributes $5800

1

The second screen: bitmap $6000, attributes $7800

2

Hi-colour: bitmap $4000, and an attribute for every 8 × 1 cell from $6000 (the same offset as its bitmap byte) — no colour clash

6

Hi-res: 512 × 192 in two colours; each 16-pixel column takes its left 8 pixels from $4000 and its right 8 from $6000. Bits 3–5 choose the colour pair (0 black on white … 7 white on black, always BRIGHT) and the border takes the paper colour.

3, 4, 5, 7

The odd modes Fuse documents: hi-colour from the second screen, hi-res with attribute bytes as pixels, and the second screen doubled.

Bit 6 of $FF masks the frame interrupt, and bit 7 says where paged memory comes from: 0 the DOCK (a cartridge), 1 the EXROM. Bit n of port $F4 (the HSR) replaces 8K chunk n ($n×2000) of the HOME bank with that chunk of the DOCK or EXROM; $4000–$7FFF is contended whatever is there. The Debugger shows the DEC and HSR, the screen mode, and a map of what each 8K chunk holds now (HOME ROM, HOME RAM, EXROM, DOCK ROM/RAM or an empty DOCK) — and the paging on the 128K.

The 2068’s BASIC keywords are on the Keyboard tab: SOUND (E mode, SYMBOL SHIFT + G), STICK (+ S), FREE (+ A), ON ERR (+ F), RESET (+ P) — E mode is CAPS SHIFT and SYMBOL SHIFT together (Shift + Ctrl) — and DELETE, which is CAPS SHIFT + 0 at the start of a line. Try SOUND 7,62;8,15;0,165;1,1 and then SOUND 8,0. With Arrow keys: joystick 1 (or a gamepad) the arrows move joystick 1 for STICK(1,1).

Running programs

Drop a file on the screen, or use Open file…:

  • .TAP / .TZX — the tape goes in and LOAD "" is typed for you (on the 128K, the menu’s Tape Loader). With Fast load on, every block the ROM loader reads arrives instantly. Games with their own turbo loaders play in real time: turn on Warp to wait less.

  • .SNA / .Z80 — snapshots load straight into memory (48K and 128K; .Z80 also for the TS2068 and TC2068).

  • .DCK — a Timex cartridge (or a dump of DOCK, EXROM and HOME memory): it goes in the dock, the machine switches to the TS2068 if it isn’t a 2068 already, and restarts with it. The Tape tab shows what’s in the dock and ejects it.

  • .SCR — a screen: 6912 bytes, or a Timex hi-colour (12288) or hi-res (12289) screen, which also sets that mode.

Save .SNA writes the machine’s state as a snapshot you can load again. Save .SCR saves the screen in the same .SCR sizes, so a hi-res or hi-colour picture keeps its mode, and Screenshot saves a PNG — on a 2068 at 704 × 592, every hi-res pixel square. On the 2068 the fast loader traps LD-BYTES in the EXROM ($00FC), where its tape routines live.

Writing Z80 code

The Assembler tab has examples — hello world with RST 16, border colours, plotting into screen memory, attribute colour cycling, reading the keyboard, a beeper tune, and a sprite moved with Q A O P — and four for the Timex 2068 (choosing one switches to the TS2068): hi-res (64-column text and lines in 512 × 192, stepping through the eight colour pairs), hi-colour (a colour for every pixel row of a character), SOUND (a scale on the AY through ports $F5/$F6, the registers BASIC’s SOUND writes) and joysticks (a cell moved with STICK’s port). On a 2068 the Spectrum examples that call the ROM use the 2068’s addresses. Screen 2 is where the 2068 keeps BASIC’s stack, channels and program, so the hi-res and hi-colour examples copy that memory away, move the stack, and put both back before returning. Assemble & run (Ctrl/⌘+Enter) pokes the code into memory and calls it from BASIC, as `RANDOMIZE USR would; RET comes back to BASIC. Build .TAP makes a tape with a BASIC loader (CLEAR, LOAD "" CODE, RANDOMIZE USR) that runs on a real Spectrum, and Load as tape loads it in the emulator the same way.

The assembler takes the usual syntax: labels (with or without a colon), local labels starting with ., ORG, EQU (or =), DEFB/DB, DEFW/DW, DEFS/DS, DEFM strings, $ for the current address, and expressions with + - * / % & | ^ ~ << >>, LOW() and HIGH(). Numbers can be $FF, 0xFF, FFh, %1010 or 'A'. Every undocumented instruction is accepted too (SLL, IXH, OUT ©,0). The program starts at the label start if there is one.

Debugging

The Code & debug tab is the debugger: beside the editor (below it on a phone) are the machine’s screen, the controls — Run/Continue (F5), Pause (F6), Step (F11), Step over (F10), Step out (Shift+F11), Run to cursor (Ctrl+F10) and Reset — the registers (type a new value to change one), the flags (click to flip), the code around PC, the stack, and watches (an address or a label from your program). As you step, ▶ follows the current line in the editor.

Click a line number beside the editor to set a breakpoint (a red ●); click it again to remove it. Right-click (or Alt-click) a line number to run to that line. Breakpoints set in the Debugger’s disassembly or typed as an address show in the editor too, every breakpoint is listed under the editor with its own × and Clear all, and they stay on their lines as you edit and re-assemble. When the program stops, an arrow and a highlight mark the line in the editor (scrolled into view) and the Debugger — or, if the CPU is inside the ROM, the IDE says so and the Debugger shows the ROM code. The Debugger shows the registers (with the alternate set, IX/IY, I and R, interrupt state and MEMPTR), the flags, the stack, a disassembly with your labels, and memory you can edit. Step (F7) runs one instruction, Step over (F8) runs a CALL or RST as one step, Step out runs to the end of the routine, and clicking an address runs to it. The timing line shows the T-state in the frame and the beam position. Point at the screen to see which screen and attribute bytes hold a pixel.

Software to load

The Software panel (on the Software tab) has two parts:

  • Library — programs this site can share: open-source and public-domain releases, freeware whose author allows it to be passed on, and this site’s own examples. Each shows its licence, why it may be shared, and where it came from; Copy link gives a link (?lib=<id>) that opens this page and loads it.

  • Open URL / archive.org — paste a link to a file, or an archive.org item (its URL or identifier). For an archive.org item the panel lists the files the Spectrum can open, with the item’s licence as the uploader set it. Sites that allow it load straight into the emulator; archive.org doesn’t let other sites read its files, so for those you get a download link and drop the file onto the emulator.

There are no links to "complete ROM set" archives: most are copies of commercial software that is still under copyright, whatever the upload’s licence field says. Files you own you can always load — drop them onto the emulator or paste a link.

How it works

The Z80 is emulated instruction by instruction with every undocumented flag and MEMPTR behaviour, and timed per machine cycle so the ULA’s memory and I/O contention delay the CPU exactly as on the real machine: it matches all 1,356 of the FUSE emulator’s Z80 test cases, including the timing of every memory access. The screen is drawn in 8-pixel steps in beam order, so border stripes and most multicolour effects show. The 128K adds memory paging and the AY-3-8912 sound chip. The Timex 2068 follows the Fuse emulator’s SCLD: its memory is HOME (16K ROM and 48K RAM), the 8K EXROM and the DOCK, paged in 8K chunks; the video draws 16 pixels per 4 T-states so hi-res is exact; the frame timings are libspectrum’s (timings.c).

Limits

  • The screen is drawn at 4-T-state resolution rather than per pixel; the AY is mono; the tape signal isn’t heard while loading; there’s no +2A/+3, disk or Interface 1.

  • Timex: no TC2048, no 2068 printer or Interface 2 port; .SNA snapshots are 48K-style (they don’t keep the DEC/HSR or a cartridge, while .Z80 does keep the DEC/HSR); the SCLD’s contention is modelled as the 48K’s pattern, as Fuse does; and the TS2068 is shown with the same 48-line border as a PAL Spectrum (its real top border is 24 lines).

Linking to an example

Add parameters to the page’s address to open it on a machine or an example:

?model=

48, 128, ts2068 or tc2068 — the machine (it’s remembered)

?example=

an example in the editor: hello, border, plot, attrs, keys, beep, sprite, or a Timex one: hires, hicolour, sound, stick (a Timex example picks the TS2068 unless ?model= says otherwise)

?lib=

a program from the Software library (its Copy link gives this)

Presets:

ROMs

The Sinclair ROMs are © Amstrad. Amstrad have kindly given their permission for the redistribution of their copyrighted material but retain that copyright (comp.sys.sinclair FAQ; Cliff Lawson’s statement for Amstrad). The ROM images come from the FUSE emulator. The Timex 2068 ROMs (Fuse’s tc2068-0.rom, the 16K HOME ROM, and tc2068-1.rom, the 8K EXROM) are, in Fuse’s words, "derived from Amstrad code, so the above statement applies. The modifications made by Timex are in the public domain" (roms/README.copyright). The emulator, assembler and examples are this site’s own code.

Runs entirely in your browser; nothing you type leaves this page.