ZX Spectrum#

ZX Spectrum Specifications#

Lifespan

1982-1992

Media

Cassette tape, ROM cartridge (Interface 2), floppy disk (ZX Microdrive)

CPU

Zilog Z80A @ 3.5 MHz

Memory

16K ROM, 48K RAM (16K on original model)

Display

256x192 pixels, 15 colors (with attribute clashes), 24x32 text

Sound

1-bit beeper (via the ULA)

Input

Keyboard (49 keys), joystick (via Kempston/Interface 2)

Best-selling game

Jet Set Willy, Manic Miner

ZX Spectrum (by Bill Bertram, CC BY-SA 2.5)

History#

The ZX Spectrum was released by Sinclair Research in 1982, following the success of the ZX80 and ZX81. It was designed by Rick Dickinson (industrial design) and Richard Altwasser (electronics), and was an immediate success in the UK market, where it became the best-selling computer of its generation.

The Spectrum was notable for its affordability and its huge software library. Its simple but capable graphics and sound, combined with the popularity of Sinclair BASIC, made it the platform of choice for a generation of British programmers and bedroom coders.

The original 16K model was quickly followed by the 48K model. Later models included the ZX Spectrum +, the 128K model (with AY-3-8912 sound), the +2, the +3, and the +2A. The 8bitworkshop IDE targets the 48K model.

Hardware#

The ZX Spectrum is a simple, minimal design based on the Z80 CPU and a custom ULA (Uncommitted Logic Array) chip that generates video timing and handles keyboard scanning and cassette I/O:

  • CPU : Zilog Z80A @ 3.5 MHz

  • Video : Ferranti ULA

  • Sound : 1-bit beeper

  • ROM : 16 KB (Sinclair BASIC)

  • RAM : 48 KB (16 KB model original)

Video#

The video system generates a 256x192 pixel display at 50 fps (PAL). The screen is divided into 8x8 pixel character cells, each of which can have:

  • 1 of 8 colors for the “ink” (foreground)

  • 1 of 8 colors for the “paper” (background)

  • Bright and flash attributes

Because the attribute grid is coarser than the pixel grid, two colors in the same 8x8 cell will produce the infamous “attribute clash” effect - a defining feature of Spectrum graphics.

The screen memory layout is intentionally interleaved so that the display can be refreshed directly from RAM. The screen occupies 6,912 bytes at $4000-$57FF, with the attribute map at $5800-$5AFF.

The 15 colors are black, blue, red, magenta, green, cyan, yellow, and white, each in normal and bright variants (bright black is dark gray).

Sound#

The standard 48K Spectrum has a single 1-bit beeper, controlled through bit 4 of the ULA I/O port $FE. The beeper can generate square-wave tones and simple sound effects, but requires the CPU to toggle the bit - it cannot run in the background. The later 128K models added an AY-3-8912 sound chip.

Memory Map#

Address Range

Description

$0000-$3FFF

ROM (Sinclair BASIC, 16K)

$4000-$57FF

Screen bitmap (6,144 bytes)

$5800-$5AFF

Color attributes (768 bytes)

$5B00-$5BFF

Printer buffer / system area

$5C00-$5CBF

System variables

$5CCB-$7FFF

User RAM

$8000-$FFFF

User RAM (48K models)

I/O Ports#

The Spectrum has a famously minimal I/O map - the Z80’s 16-bit port address space is decoded by just a few bits:

Port

Function

$FE

ULA: keyboard matrix scan, beeper, border color, cassette output

$FF

ULA: cassette input

$1F

Kempston joystick (read)

$7FFD

Memory paging (128K models)

The keyboard is scanned through the ULA port: writing a half-row select to bits 0-4 of port $FE and reading back the keys.

Programming#

The 8bitworkshop IDE supports ZX Spectrum development in Z80 assembly language (with the ZMAC assembler) and C (using the Z88DK compiler).

BIOS Routines#

The ZX Spectrum ROM provides a set of standard routines that can be called from machine code, including:

  • $09F4 - Open a channel

  • $0DAF - Print a string (via the print routine)

  • $0F81 - Print a character

  • $15F1 - Scan the keyboard

  • $03B5 - Beeper routine (with DE=time, HL=length)

C programs can access these routines through the Z88DK library’s zx_* functions.

Comments