OS Calls
Unlike most manufacturers, the spectrum rom doesn't have many standard rom entry points with most of them undocumented. This meant that the addresses changed between the different machines.
For example, all 48K Spectrum's had the same ROM, so you were almost guaranteed to be able to use the same routine on different machines. However, the 128K introduced 2 roms so there had to be differences. With the +2A/+3 came 4 roms and to complicate things there exists an English and Spanish version of these roms with different addresses.
Unless otherwise specified, the entry points in this section will be for the 48K Spectrum as that has more documentation available.
The only common entry points (known so far) are the RST entry points, as these are also used by the
processor's RST
instruction.
Restart RST
Calculator | Enter the floating point calculator |
---|---|
Collect Character restarts | Collect Character and Collect Next Character restarts |
ERROR | Error restart |
Make BC Spaces | Creates BC free locations in the workspace |
Maskable Interrupt | The Maskable Interrupt Handler |
PRINT_A | Write A to current output channel |
START | Restart the machine |
Issues with RST instructions
Even this isn't standardised in documentation, with some calls referenced by different numbers.
For example, the calculator is referenced as RST 5
, RST 40
and RST $28
in different places even though they are identical instructions.
Address | OP Code | RST Instruction | Action | |||||
---|---|---|---|---|---|---|---|---|
48K | 128K | +2 | +2A/+3 | |||||
0000 | C7 | RST 0 | Reset machine | |||||
0008 | CF | RST 1 | RST 8 | Error handler | Unavailable | Error handler | ||
0010 | D7 | RST 2 | RST $10 | RST 16 | Print A | |||
0018 | DF | RST 3 | RST $18 | RST 24 | Get Character | |||
0020 | E7 | RST 4 | RST $20 | RST 32 | ||||
0028 | EF | RST 5 | RST $28 | RST 40 | Calculator | Call ROM1 | Call ROM3 | |
0030 | F7 | RST 6 | RST $30 | RST 48 | Reserve Workspace | Unavailable as used by RST 5 | ||
0038 | FF | RST 7 | RST $38 | RST 56 | Maskable Interrupt Handler |
A 128K machine running in 48K mode will have the RST instructions as the 48K machine.
Screen
Clear the screen | Clear the whole display area |
---|
OS Vector Table
On the 128K and +2 Spectrum's there is a vector table at 0x0100 to common routines.
Previously the ROM was just a single program and not an Operating System.
Address | Routine | |||||||
---|---|---|---|---|---|---|---|---|
128K | +2 | |||||||
0100 | BASIC interpreter parser | |||||||
0103 | Line Run entry point | |||||||
0106 | Transfer bytes to logical RAM bank 4 | |||||||
0109 | Transfer bytes from logical RAM bank 4 | |||||||
010C | 128K error routine | |||||||
010F | Error routine | |||||||
0112 | Return statement | |||||||
0115 | Next statement | |||||||
0118 | Scan Keyboard | |||||||
011B | Play music strings | |||||||
011E | MIDI byte output | |||||||
0121 | RS232 byte input | |||||||
0124 | RS232 text output | |||||||
0127 | RS232 byte output | |||||||
012A | COPY screen dump | |||||||
012D | RST 5 keypad scan routine in ROM 1 |