The explorer's Z80 disassembly of a Spectrum tape, snapshot or tape file writes a name in place of an address
operand when the address is one of those below: call LD_BYTES instead of call $0556,
ld a,(LAST_K) instead of ld a,($5C08). The decoder names every 16-bit operand that equals
a name, including the value in a load such as ld bc,$5C00, so a number that merely equals an address
can be named too. $0000 is left unnamed for that reason (ld hl,0 is common).
The names are those of the Logan and O'Hara Complete Spectrum ROM Disassembly as the SkoolKit project
publishes it at skoolkid.github.io/rom/maps/all.html.
A hyphen in a ROM name (LD-BYTES) is written as an underscore (LD_BYTES). The page was read
through a summarising fetch tool, not saved or compared with a ROM image, so the addresses are as that tool reported
them. Only the routines the listing titles are named; labels inside a routine (such as PRINT-A-2) are not.
The 174 ROM names are in the viewer's table; the entry points most often called from game code and loaders are below.
Memory map (48K)
| Range | Name | What is there |
|---|---|---|
$0000–$3FFF | ROM | The BASIC ROM (on the 128K machines one of two, chosen by port $7FFD bit 4). |
$4000–$57FF | Screen bitmap | 6144 bytes, see below. |
$5800–$5AFF | Screen attributes | 768 bytes, one per 8 by 8 cell. |
$5B00–$5BFF | Printer buffer | 256 bytes. |
$5C00–$5CB5 | System variables | The ROM's working storage, listed below. |
$5CB6–$FFFF | Channels, BASIC program, variables, free RAM | RAMTOP ($5CB2) marks the upper end of what BASIC uses. |
Screen layout
The display file at $4000 is 192 pixel rows of 32 bytes, one bit per pixel with bit 7 leftmost, but the rows are not in order.
A pixel row y written as the bits y7 y6 y5 y4 y3 y2 y1 y0 starts at
$4000 + (y7 y6) × $800 + (y2 y1 y0) × $100 + (y5 y4 y3) × $20: the screen is in three thirds, and inside a third the eight pixel rows of one character
come $100 apart. The attribute file at $5800 is 24 rows of 32 bytes: bits 0 to 2 ink, bits 3 to 5 paper, bit 6 bright, bit 7 flash.
The colours 0 to 7 are black, blue, red, magenta, green, cyan, yellow and white; bright brightens the seven colours and leaves black black.
The border colour is port $FE bits 0 to 2. The viewer draws the colours at levels 0 and 215 (255 when bright), the usual emulator values, not a measurement.
System variables
| Address | Name | Bytes |
|---|---|---|
$5C00 | KSTATE | 8 |
$5C08 | LAST_K | 1 |
$5C09 | REPDEL | 1 |
$5C0A | REPPER | 1 |
$5C0B | DEFADD | 2 |
$5C0D | K_DATA | 1 |
$5C0E | TVDATA | 2 |
$5C10 | STRMS | 38 |
$5C36 | CHARS | 2 |
$5C38 | RASP | 1 |
$5C39 | PIP | 1 |
$5C3A | ERR_NR | 1 |
$5C3B | FLAGS | 1 |
$5C3C | TV_FLAG | 1 |
$5C3D | ERR_SP | 2 |
$5C3F | LIST_SP | 2 |
$5C41 | MODE | 1 |
$5C42 | NEWPPC | 2 |
$5C44 | NSPPC | 1 |
$5C45 | PPC | 2 |
$5C47 | SUBPPC | 1 |
$5C48 | BORDCR | 1 |
$5C49 | E_PPC | 2 |
$5C4B | VARS | 2 |
$5C4D | DEST | 2 |
$5C4F | CHANS | 2 |
$5C51 | CURCHL | 2 |
$5C53 | PROG | 2 |
$5C55 | NXTLIN | 2 |
$5C57 | DATADD | 2 |
$5C59 | E_LINE | 2 |
$5C5B | K_CUR | 2 |
$5C5D | CH_ADD | 2 |
$5C5F | X_PTR | 2 |
$5C61 | WORKSP | 2 |
$5C63 | STKBOT | 2 |
$5C65 | STKEND | 2 |
$5C67 | BREG | 1 |
$5C68 | MEM | 2 |
$5C6A | FLAGS2 | 1 |
$5C6B | DF_SZ | 1 |
$5C6C | S_TOP | 2 |
$5C6E | OLDPPC | 2 |
$5C70 | OSPCC | 1 |
$5C71 | FLAGX | 1 |
$5C72 | STRLEN | 2 |
$5C74 | T_ADDR | 2 |
$5C76 | SEED | 2 |
$5C78 | FRAMES | 3 |
$5C7B | UDG | 2 |
$5C7D | COORDS | 2 |
$5C7F | P_POSN | 1 |
$5C80 | PR_CC | 2 |
$5C82 | ECHO_E | 2 |
$5C84 | DF_CC | 2 |
$5C86 | DF_CCL | 2 |
$5C88 | S_POSN | 2 |
$5C8A | S_POSNL | 2 |
$5C8C | SCR_CT | 1 |
$5C8D | ATTR_P | 1 |
$5C8E | MASK_P | 1 |
$5C8F | ATTR_T | 1 |
$5C90 | MASK_T | 1 |
$5C91 | P_FLAG | 1 |
$5C92 | MEMBOT | 30 |
$5CB0 | NMIADD | 2 |
$5CB2 | RAMTOP | 2 |
$5CB4 | P_RAMT | 2 |
Sizes are the gaps between the addresses on the source page. Only the first address of a multi-byte variable is named: FRAMES+1 is shown as a plain number.
ROM entry points
| Address | Name | Title in the ROM listing |
|---|---|---|
$0008 | ERROR_1 | The 'error' restart |
$0010 | PRINT_A_1 | The 'print a character' restart |
$0018 | GET_CHAR | The 'collect character' restart |
$0020 | NEXT_CHAR | The 'collect next character' restart |
$0028 | FP_CALC | The 'calculator' restart |
$0030 | BC_SPACES | The 'make BC spaces' restart |
$0038 | MASK_INT | The 'maskable interrupt' routine |
$0066 | RESET | The 'non-maskable interrupt' routine |
$028E | KEY_SCAN | The 'keyboard scanning' subroutine |
$03B5 | BEEPER | The 'beeper' subroutine |
$04C2 | SA_BYTES | The 'SA-BYTES' subroutine |
$0556 | LD_BYTES | The 'LD-BYTES' subroutine |
$0D6B | CLS | The 'CLS' command routine |
$0DAF | CL_ALL | The 'clearing the whole display area' subroutine |
$11B7 | NEW | The 'NEW' command routine |
$1601 | CHAN_OPEN | The 'CHAN-OPEN' subroutine |
$2294 | BORDER | The 'BORDER' command routine |
$22AA | PIXEL_ADDR | The 'pixel address' subroutine |
$22DC | PLOT | The 'PLOT' command routine |
$2D2B | STACK_BC | The 'STACK-BC' subroutine |
$3D00 | CHAR_SET | Character set (the 96 character patterns; CHARS holds this address minus 256) |
Not described
The labels inside routines, the ROM's data tables beyond the start addresses, the 128K and +3 ROMs, and what each routine takes and returns. The names were not compared with a ROM image.
Links
Reference
- ZX Spectrum ROM disassembly, all entries – SkoolKit's presentation of the Logan and O'Hara disassembly