← back to zentools

Recovering readable BASIC

Sinclair BASIC doesn't store a program as the text you typed — it stores a compressed, tokenised form, with keywords packed down to single bytes. zx basic converts between the two in either direction.

What it does

Point it at a tokenised BASIC program — pulled from a tape, a snapshot, wherever — and it hands back the readable listing: line numbers, keywords spelled out in full, numbers and strings exactly as they'd appear if you LISTed the program on a real machine. It covers both the 48K and 128K keyword sets, so newer BASIC programs decode correctly too, not just the original 48K vocabulary.

It works the other way as well: write plain-text BASIC source and tokenise it back into the exact form a real Spectrum expects, ready to load and run.

Why it matters

A huge amount of ZX Spectrum software — type-in listings from old magazines, utilities, simple games — exists only as BASIC, and only in its tokenised form. Being able to turn that back into something readable means you can actually look at what a program does, adapt it, or simply archive it as text instead of an opaque binary blob.