ZXAS
Bug-Byte's ZX81 assembler, and the first rung of the ladder
A 5K Z80 assembler for the 16K ZX81, published by Bug-Byte in 1981. Source was typed into REM statements; output went straight into RAM. Sinclair User called using it 'the single biggest step to proficiency in machine code programming' — two years before the same publisher released Manic Miner.
ZXAS was a machine-code assembler for the 16K ZX81, published by Bug-Byte in 1981 and sold on cassette at £5.00. Its companion, ZXDB, was a disassembler and debugger at £6.50; the two could sit in memory together.
It matters because of what it was for. In 1981 the ZX81 was a machine most people
programmed in BASIC, and the accepted route to machine code was to POKE opcodes
into RAM one byte at a time from a BASIC loader. ZXAS replaced that with something
recognisable as a toolchain: you wrote mnemonics, it produced bytes, and it told
you where you had gone wrong.
How you used it
ZXAS was 5K of machine code driven by a handful of BASIC lines. On startup it
reset RAMTOP and loaded itself above it, so that assembler source could be
saved and loaded independently of the assembler.
The source format was the ZX81’s own editor turned to a purpose it was never
designed for. Instructions went into REM statements.
- Multiple instructions per line, separated by semicolons.
- Up to 256 labels, in the form
:L0through:L255. - Comments after a
*. - Full stops instead of commas —
LD A,Hwas typedLD A.H, which Sinclair User noted “makes typing instructions easier” on the ZX81’s keyboard. - Numbers in decimal or hex.
On assembly it prompted for a start address — the convention was to put a REM
at the top of the BASIC program and assemble into 16514, the first byte of it —
and then listed each line as source line number : address (hex) : opcode and
data (hex) : Z80 mnemonic. Errors stopped assembly with a code.
ZXDB
The disassembler occupied 4K from 16514 and worked entirely in hex. It carried
a step function, string search, block transfer and a hex loader, and with ZXAS
also resident it still left around 8K free on a 16K machine.
Two quirks are worth recording because they are the sort of thing only a user
finds. ZXDB could not print, but you could work around it by disassembling a
dozen lines to screen and then calling the Sinclair ROM’s own COPY subroutine
at 0869H to dump it. And some of the mnemonics it emitted were
Intel 8080 rather than Zilog Z80 — LD A,(HL) came out as LD A,M.
What the press made of it
Sinclair User ran a survey of ZX81 assemblers by Phil Garrett in July 1982. It is the best contemporary account of the field, and it is unambiguous about ZXAS: “a remarkable program and is excellent value at £5”. Garrett’s verdict on the category is the line worth keeping:
the use of either this program or ZXAS is the single biggest step to proficiency in machine code programming
He also names a bug, which is how you know he used it: SUB A,n did not
assemble, and had to be written as AND A; SBC A,n, which does the same thing.
The same survey maps the competition — ACS’s assembler at £5.50 and disassembler at £3.50, Picturesque’s ZX-MC monitor at £7.50, the Taurus Machine Code Monitor, Campbell Systems’ 4K disassembler, MicroGen’s Debug, and a 14K disassembler from the Aylesbury ZX Computer Club. It is a crowded page, and worth noticing: there was a real commercial market in development tools for a £70 computer, a year before the Spectrum had a games industry.
Garrett’s other observation is the honest one. Neither ZXAS nor its rivals set out to teach you anything: “Neither program sets out to teach assembler, so a book will also be needed.”
Why it matters here
Bug-Byte is remembered for Manic Miner. Two years before that, the same company was selling the tool you needed to write something like it — and the tool came first, which is the right way round and the way it usually happened. Assemblers, monitors and disassemblers were a product category on the ZX81 before games were an industry on the Spectrum.
That is also the shape of this project’s own ladder. The tooling is not scaffolding you put up once the interesting part is finished. It is the interesting part arriving first.
See also
- Bug-Byte — the publisher, and what it did next.
- ZX81
- Machine code for beginners — the books Garrett said you would also need.