In the spring of 1983 a Spectrum owner could walk into a bookshop and buy the machine’s entire operating system, printed. The Complete Spectrum ROM Disassembly, by Dr Ian Logan and Dr Frank O’Hara, lists the 16K program in the Spectrum’s ROM as Z80 assembly language, one instruction per line, with a comment beside almost every one. It gives each routine a name, says what it expects in the registers and what it hands back, and shows how the routines call each other. Neither author worked for Sinclair. Logan was a family doctor in Lincolnshire, and the two of them had worked it all out from the bytes.
Personal Computer News opened its review in May 1983 with sympathy for anyone who had been attempting the same thing: “Just as you’re about to finish, all your friends rush round with a complete and newly published rendering of the heap of hexadecimal on your bedroom floor.”
Fast facts
- Authors: Ian Logan and Frank O’Hara
- Publisher: Melbourne House
- Published: 1983; the preface is dated January 1983
- Price: £9.95 (paperback, 236 pages)
- Covers: the whole ROM of the 16K and 48K ZX Spectrum, from
0000to3FFFhex
What is in it
The authors describe the ROM as a program “developed directly from the 4K program of the ZX 80”, with so many new features that “the differences outweigh the similarities”. They split it into ten parts, and the book follows them in order: the restart routines and tables, the keyboard, the loudspeaker, the cassette routines, screen and printer output, the “executive” routines that start the machine and run the main loop, the interpretation of BASIC lines and commands, expression evaluation, arithmetic, and the floating-point calculator. Appendices give BASIC versions of the series used for SIN, EXP, LN and ATN, and explain the algorithms behind DRAW and CIRCLE. An index lists every routine by address.
The first page shows the style. Address 0000, START, disables interrupts and jumps on to START/NEW, which sets the machine up. At 0038, MASK-INT, “the real time clock is incremented and the keyboard scanned whenever a maskable interrupt occurs”, which on a British machine is every 20 milliseconds. Restart 0028 jumps to 335B, where the calculator begins. The introduction explains that the calculator has “an internal ‘stack operating’ language” of its own: its operations are written as strings of data bytes, called literals, rather than Z80 instructions, and the book decodes those too.
The authors also said what they thought of the code. The PRINT-OUT routine is “rather slow” because it checks every possibility, including OVER and INVERSE, for each byte it puts on the screen. The cassette routines, a weak point of the ZX81, were now “one of the most successful features of the machine”, although the header-and-data-block format meant “it is not possible to produce programs with any ‘security’ whatsoever”. And the whole program was “written for ‘compactness’ rather than ‘speed’”, because its programmers “have always however been short of ‘room’”.
The ROM’s own bugs
The book did not treat the ROM as perfect. Its introduction says the arithmetic is “marred by two mistakes”: the division routine loses the 34th bit of its result, and the value −65536 is sometimes stored as a small integer and sometimes in floating-point form, which “leads to troubles”. At the division loop the book goes further. It explains that a jump goes to the wrong place, so that “important results like 1/10 and 1/1000 are not rounded up as they should be”, and names the fix: byte 3200 hex should read DA hex, not E1.
Five years later CRASH printed that same fix. In July 1988 its technical column listed ROM repairs for readers who had copied the ROM into the RAM of a Multiface interface, where it could be changed, among them POKE 12800,218, which puts DA hex into address 3200 hex. The column sent anyone who wanted to find more to “Ian Logan and Frank O’Hara’s ‘Complete Spectrum ROM Disassembly’ - a classic when it came out in 1983”.
Four ROM books
The Spectrum book finished a run that Logan had started on the ZX81, all published by Melbourne House:
| Book | Author | Price | What it covered |
|---|---|---|---|
| Understanding Your ZX81 ROM (1981) | Logan | £8.95 | How the ZX81’s ROM is organised, with a section on calling machine code from BASIC |
| ZX81 ROM Disassembly Part A (1982) | Logan | £7.00 | 0000H to 0F54H: everything except the floating-point calculator |
| ZX81 ROM Disassembly Part B (1982) | Logan and O’Hara | £8.00 | 0F55H to 1DFFH, including the floating-point calculator |
| The Complete Spectrum ROM Disassembly (1983) | Logan and O’Hara | £9.95 | The whole 16K Spectrum ROM |
The partnership began with Part B of the ZX81 disassembly. In between, Logan had also written Understanding Your Spectrum (1982), a general guide to the machine’s BASIC, machine code and ROM. Melbourne House’s advertisements of August and September 1982 called that book, not the disassembly, “sure to become the definitive book on the Spectrum”. In the disassembly’s preface the two authors thanked their publisher, Alfred Milgrom, and Philip Mitchell, the programmer of The Hobbit, “whose notes on the cassette format were most informative”. They wrote that “between us we have unravelled the ‘secrets of the Spectrum’”.
How it was received
Melbourne House sold it as “the book for the serious programmer who wants to get right to the heart of the Spectrum system”, one that “makes all functions and entry points available for use in your own programs”. Reviewers took it more coolly. Personal Computer News called it “basically a long commented source program” that could have done with more overview. It compared the book to the complete works of Thomas Hardy, “both in value and readability”, and called it “a useful and interesting book. Great — if you like that sort of thing.” The same review saw two uses: calling the ROM to do “the fiddly bits for you, such as floating-point calculations and circle drawing”, and studying a real BASIC interpreter. It also gave a warning. A program built on ROM routines could stop working if Sinclair ever changed the ROM. That August the magazine’s advice column went further. Having named “Dr Logan’s Complete Spectrum ROM disassembly”, it told a reader: “Don’t! Stay away from the Spectrum’s ROM. Sinclair rightly warns against using it.”
Readers used it all the same. In March 1984 Your Spectrum’s survey of machine-code books said the authors “explain exactly what’s inside every Spectrum ROM”, and that because every routine is listed, “the book is also a storehouse of programs and techniques”. Magazine type-ins credited it. A tape utility in Your Computer in May 1984 copied the ROM’s save and load routines almost directly and called the disassembly “invaluable during the development”. In January 1987 the same magazine said the Spectrum’s load routine was “explained expertly” in the book. When Melbourne House published a disassembly of the Interface 1’s shadow ROM, Your Spectrum noted in 1985 that it followed “the format of its forerunner”.
The book travelled too. The Italian magazine MC-microcomputer reviewed it in December 1983. It remarked that the work “does not come from Sinclair” and praised the care taken to show how the ROM’s functions work together. In 1988 a Brazilian electronics student, João Carlos Mendes Luis, published a cassette-loading system in Micro Sistemas and told readers who wanted to understand his machine-code routines to read the book; he owed the book, he wrote, all his knowledge “of the ROM of that marvellous computer, the Spectrum”.
Melbourne House still listed it in 1987, at £8.95. By 1992 readers were hunting for second-hand copies. A reader in Your Sinclair’s small ads that August offered to swap a pile of games for it or for Understanding Your Spectrum, or to pay £5 for each.
After print
The book reached the internet through the people who still used it. Readers of the Usenet newsgroup comp.sys.sinclair typed the whole text back in, and the transcription names eighteen of them, from Jonathan G Harston and Geoff Wearmouth to Matthew Westcott. The project’s own page says that the copyright belongs to the authors and that its organiser had not been able to contact them to ask permission.
That text became a standard reference for people writing Spectrum emulators and tools. The ESPectrum emulator, which runs a Spectrum on ESP32 microcontroller boards, thanks Logan and O’Hara for the book in its documentation. In 2016 Richard Dymond added the book’s annotations to his SkoolKit disassembly of the 48K ROM. That disassembly is published as web pages that can be browsed routine by routine, and its credits still read “© 1983 Dr Ian Logan & Dr Frank O’Hara”.
Sources
- Ian Logan and Frank O’Hara, The Complete Spectrum ROM Disassembly (Melbourne House, 1983): preface (January 1983; the ZX80 origins; thanks to Alfred Milgrom and Philip Mitchell); contents; introduction (the ten parts; PRINT-OUT; the cassette routines; the two arithmetic mistakes; the calculator’s “stack operating” language; “compactness” rather than “speed”); the restart routines at
0000,0028and0038; the division routine at31AFand the note on byte3200; appendix and index. - Sinclair User issue 12, March 1983, p. 8: Melbourne House advertisement (£9.95).
- Your Computer, March, April, May and July 1983: Melbourne House advertisements (“the book for the serious programmer”).
- Personal Computer News, 13 May 1983: review (£9.95, paperback, 236 pages).
- Personal Computer News issue 22, 4–10 August 1983: readers’ advice column (“Stay away from the Spectrum’s ROM”).
- Sinclair User issue 5, August 1982, and issue 6, September 1982, p. 4: Melbourne House advertisement (Understanding Your Spectrum “sure to become the definitive book on the Spectrum”).
- MC-microcomputer issue 25, December 1983, p. 38: book review (in Italian; quotation translated).
- Your Spectrum issue 2, March 1984, p. 77: machine-code books survey.
- Your Computer, May 1984: the Tapesys utility.
- Your Spectrum issue 18, September 1985: review of Melbourne House’s shadow ROM disassembly.
- Your Computer, January 1987: Spectrum-to-Amstrad file transfer programs.
- Your Sinclair issue 18, June 1987: “People and Prices” list (Melbourne House, £8.95).
- CRASH issue 54, July 1988, p. 71: ROM fixes, including
POKE 12800,218, and the recommendation of the book. - Micro Sistemas no. 77, 1988: João Carlos Mendes Luis’s cassette-loading routines (in Portuguese; quotation translated).
- Your Sinclair issue 80, August 1992: readers’ small advertisements.
- The Complete Spectrum ROM Disassembly, electronic transcription by readers of the comp.sys.sinclair newsgroup: title page (the eighteen transcribers).
- “The Complete Spectrum ROM Disassembly Project”, Grok Developments’ freestuff pages (web, secondary): the comp.sys.sinclair transcription and its copyright position. https://freestuff.grok.co.uk/rom-dis/
- ESPectrum emulator, README, “Thanks also to all this writters, hobbyists and documenters” (web, secondary). https://github.com/EremusOne/ESPectrum
- Richard Dymond, “Spectrum ROM: A disassembly of the Spectrum ROM”, SkoolKit, changelog entry 20160709 and credits (web, secondary). https://skoolkit.ca/disassemblies/rom/
See also
- Ian Logan
- Melbourne House
- Steven Vickers, who wrote most of the ROM the book describes
- ZX Spectrum ROM disassembly, the routines a program is most likely to call
- Sinclair BASIC
- Fuse
- Machine code for beginners
- Sinclair ZX Spectrum