esc
Anthology / Yagnipedia / Spectrum BASIC

Spectrum BASIC

POKE Before Facebook, PEEK Before Privacy Died
Technology · First observed 1982 (Sinclair Research, Cambridge — a rubber-keyed computer that taught a generation to program by making them type on a calculator) · Severity: Foundational (the first language, the one that wired the brain)

Spectrum BASIC is the programming language built into the Sinclair ZX Spectrum — the rubber-keyed, 48K, cassette-loading computer that taught an entire generation of European children that computers do what you tell them, and if what you tell them is POKE 23659,0, the computer removes the bottom two lines of the screen and gives you two more lines of usable display. This was power. This was real power. Facebook would not invent its own POKE for another twenty-two years, and Facebook’s version would do nothing except notify someone that you exist.

Spectrum BASIC was riclib’s first programming language. The most frequently used statement was POKE. Not because riclib was modifying system variables (though he was). Because POKE was how you entered machine language.

“POKE wrote directly to memory addresses. PEEK read directly from memory addresses. In 1982 this was called programming. In 2024 this is called a security vulnerability.”
The Lizard, who remembers when memory was honest

POKE

POKE was the statement that wrote a value to a specific memory address. Not a variable. Not an object. Not a property of an abstracted hardware layer. A memory address. A number. You said POKE 16384,255 and the top-left corner of the screen filled with white pixels, because address 16384 was the first byte of the display file, and 255 was all eight bits set, and the Spectrum did not ask why, and the Spectrum did not validate, and the Spectrum did not throw an UnsupportedOperationException. The Spectrum wrote 255 to 16384 and the screen changed.

But POKE’s most important role — the reason it was riclib’s most frequently used statement — was as a machine language assembler. The last pages of the Spectrum manual listed the Z80 instruction set as decimal numbers. 201 was RET. riclib still remembers this, decades later, the way other people remember childhood phone numbers. To write assembly on the Spectrum, you did not use an assembler. There were no assemblers — not on the Spectrum riclib had, not for the first three years. You looked up the instruction in the back of the manual, found its decimal value, and POKEd it into memory. One byte at a time. One instruction at a time.

10 POKE 30000, 62    : REM LD A, n
20 POKE 30001, 255   : REM (load 255 into A)
30 POKE 30002, 201   : REM RET
40 RANDOMIZE USR 30000

This was how riclib wrote his first assembly program. Not with an assembler. With POKE and the back of the manual. One decimal number at a time, each one a Z80 opcode, each one memorised through repetition until the manual was no longer needed for the common instructions. 201 was RET. 195 was JP. 205 was CALL. 62 was LD A,n. The numbers became the language.

riclib saw his first actual assembler four years after getting the Spectrum — three years after writing his first assembly program. Three years of POKEing opcodes by hand, by number, from the back of the manual. The assembler, when it arrived, felt like a luxury. Mnemonics instead of numbers. Labels instead of calculated addresses. But the numbers were already in the fingers. The POKE method had wired the Z80 instruction set directly into muscle memory, bypassing the abstraction that assembler mnemonics provide. riclib did not learn Z80 assembly as LD, ADD, RET. riclib learned it as 62, 128, 201.

This was the first lesson: the computer is a machine. The machine has memory. The memory has addresses. You can write to the addresses. The thing you write appears on the screen, or changes the border colour, or modifies the system variables, or executes as machine code, or crashes the machine. All of these outcomes are the programmer’s responsibility. All of these outcomes are educational.

POKE taught riclib more about how computers actually work than any course that followed. When you POKE, there is no abstraction. There is no framework. There is no API between you and the hardware. There is a number, an address, and a consequence. Every programming language since has been, in some sense, an increasingly elaborate mechanism for preventing the programmer from typing POKE — for putting layers between the human and the memory address, each layer adding safety and removing understanding.

riclib’s most frequently used statement was POKE. Not PRINT. Not GOTO. Not INPUT. POKE. This says something about the kind of programmer that was being formed on the rubber keyboard: one who wanted to talk to the machine, not to the screen. And it says something about the era: the assembler was a tool that had to be acquired separately, and until it was acquired, POKE was the assembler.

The Migration

The Spectrum BASIC programmer who has exhausted POKE — who has written to every interesting memory address, who has changed every system variable, who has modified the display file byte by byte — arrives at the edge of what BASIC can do. BASIC is interpreted. BASIC is slow. BASIC cannot keep up with the ambitions that POKE created.

The next step was Z80 Assembly. The step from BASIC to assembly was not a leap — it was a POKE that went all the way down. If POKE let you write one byte to one address, assembly let you write every byte to every address, and the CPU executed them in sequence, and the machine did exactly what you said, at the speed of the hardware, with no interpreter between you and the Z80.

riclib moved on. The rubber keyboard stayed behind. The POKE stayed forever.

Measured Characteristics

See Also