reference
Table of Contents
1 - API by Address
API by Address
Function |
Address | Description |
RST_0 |
0000 | Start the computer |
RST_1 |
0008 | Report an error |
RST_2 |
0010 | Print A to the output stream |
RST_3 |
0018 | Collect character |
RST_4 |
0020 | Collect Next character |
RST_5 |
0028 | FP Calculator |
RST_6 |
0030 | FP Calculator |
RST_7 |
0038 | Maskable Interrupt Handler |
DOS_INITIALISE |
0100 | Initialise +3DOS |
DOS_VERSION |
0103 | Return DOS issue and version numbers |
DOS_OPEN |
0106 | Open and/or Create a file |
DOS_CLOSE |
0109 | Close a file |
DOS_ABANDON |
010C | Abandon a file |
DOS_REF_HEAD |
010F | Point to header data for this file |
DOS_READ |
0112 | Read bytes from a file into memory |
DOS_WRITE |
0115 | Write bytes from memory into a file |
DOS_READ_BYTE |
0118 | Read byte from a file, check for soft-EOF |
DOS_WRITE_BYTE |
011B | Write byte to a file |
DOS_CATALOG |
011E | Get the disk catalog |
DOS_FREE_SPACE |
0121 | Get free space on drive |
DOS_DELETE |
0124 | Delete a file |
DOS_RENAME |
0127 | Get free space on drive |
DOS_BOOT |
012A | Boot from disk |
DOS_SET_DRIVE |
012D | Set the default drive |
DOS_SET_USER |
0130 | Set the default user |
DOS_GET_POSITION |
0133 | Get the file pointer |
DOS_SET_POSITION |
0136 | Set the file pointer |
DOS_GET_EOF |
0139 | Get the end of file (EOF) position |
DOS_GET_1346 |
013C | Set current cache/ramdisk location |
DOS_SET_1346 |
013F | Rebuild the sector cache and RAM disk |
DOS_FLUSH |
0142 | Write any pending data to this drive |
DOS_SET_ACCESS |
0145 | Change access mode of an open file |
DOS_SET_ATTRIBUTES |
0148 | Set a files attributes |
DOS_OPEN_DRIVE |
014B | Open drive as a single file |
DOS_SET_MESSAGE |
014E | Enable/disable disk error messages |
DOS_REF_XDPB |
0151 | Point at XDPB for this drive |
DOS_MAP_A |
0154 | Map drive B to unit 0 or 1 |
DD_INTERFACE |
0157 | Check for the disk drive interface |
DD_INIT |
015A | Initialise the disk driver |
DD_SETUP |
015D | Setup disk parameters |
DD_SET_RETRY |
0160 | Set try/retry count |
DD_READ_SECTOR |
0163 | Read a sector |
DD_WRITE_SECTOR |
0166 | Write a sector |
DD_CHECK_SECTOR |
0169 | Check a sector |
DD_FORMAT |
016C | Format a track |
DD_READ_ID |
016F | Read a sector identifier |
DD_TEST_UNSUITABLE |
0172 | Check disk is suitable to write to |
DD_LOGIN |
0175 | Login a new disk |
DD_SEL_FORMAT |
0178 | Select a standard format |
DD_ASK_1 |
017B | Check to see if unit 1 is present |
DD_DRIVE_STATUS |
017E | Check drive status |
DD_EQUIPMENT |
0181 | Ask what type of drive |
DD_ENCODE |
0184 | Set copy protection encode routine |
DD_L_XDPB |
0187 | Initialise XDPB for a given format |
DD_L_DPB |
018A | Initialise DPB for a given format |
DD_L_SEEK |
018D | Seek to required track |
DD_L_READ |
0190 | Low level uPD765A read command |
DD_L_WRITE |
0193 | Low level uPD765A write command |
DD_L_ON_MOTOR |
0196 | Turn on motor |
DD_L_T_OFF_MOTOR |
0199 | Start motor off timeout |
DD_L_OFF_MOTOR |
019C | Turn off motor |
CL_ALL |
0DAF | Clear the screen |
SWAP |
5B00 | Paging subroutine |
STOO |
5B10 | Paging subroutine. Entered with interrupts disabled and AF, BC on the stack. |
YOUNGER |
5B21 | Paging subroutine |
REGNUOY |
5B2A | Paging subroutine |
ONERR |
5B3A | Paging subroutine |
RAMRST |
5B5D | RST 8 instruction used by ROM 1 to report old errors to ROM 3 |
2 - API by Name
API by Name
Function |
Address | Description |
CL_ALL |
0DAF | Clear the screen |
DD_ASK_1 |
017B | Check to see if unit 1 is present |
DD_CHECK_SECTOR |
0169 | Check a sector |
DD_DRIVE_STATUS |
017E | Check drive status |
DD_ENCODE |
0184 | Set copy protection encode routine |
DD_EQUIPMENT |
0181 | Ask what type of drive |
DD_FORMAT |
016C | Format a track |
DD_INIT |
015A | Initialise the disk driver |
DD_INTERFACE |
0157 | Check for the disk drive interface |
DD_L_DPB |
018A | Initialise DPB for a given format |
DD_L_OFF_MOTOR |
019C | Turn off motor |
DD_L_ON_MOTOR |
0196 | Turn on motor |
DD_L_READ |
0190 | Low level uPD765A read command |
DD_L_SEEK |
018D | Seek to required track |
DD_L_T_OFF_MOTOR |
0199 | Start motor off timeout |
DD_L_WRITE |
0193 | Low level uPD765A write command |
DD_L_XDPB |
0187 | Initialise XDPB for a given format |
DD_LOGIN |
0175 | Login a new disk |
DD_READ_ID |
016F | Read a sector identifier |
DD_READ_SECTOR |
0163 | Read a sector |
DD_SEL_FORMAT |
0178 | Select a standard format |
DD_SET_RETRY |
0160 | Set try/retry count |
DD_SETUP |
015D | Setup disk parameters |
DD_TEST_UNSUITABLE |
0172 | Check disk is suitable to write to |
DD_WRITE_SECTOR |
0166 | Write a sector |
DOS_ABANDON |
010C | Abandon a file |
DOS_BOOT |
012A | Boot from disk |
DOS_CATALOG |
011E | Get the disk catalog |
DOS_CLOSE |
0109 | Close a file |
DOS_DELETE |
0124 | Delete a file |
DOS_FLUSH |
0142 | Write any pending data to this drive |
DOS_FREE_SPACE |
0121 | Get free space on drive |
DOS_GET_1346 |
013C | Set current cache/ramdisk location |
DOS_GET_EOF |
0139 | Get the end of file (EOF) position |
DOS_GET_POSITION |
0133 | Get the file pointer |
DOS_INITIALISE |
0100 | Initialise +3DOS |
DOS_MAP_A |
0154 | Map drive B to unit 0 or 1 |
DOS_OPEN |
0106 | Open and/or Create a file |
DOS_OPEN_DRIVE |
014B | Open drive as a single file |
DOS_READ |
0112 | Read bytes from a file into memory |
DOS_READ_BYTE |
0118 | Read byte from a file, check for soft-EOF |
DOS_REF_HEAD |
010F | Point to header data for this file |
DOS_REF_XDPB |
0151 | Point at XDPB for this drive |
DOS_RENAME |
0127 | Get free space on drive |
DOS_SET_1346 |
013F | Rebuild the sector cache and RAM disk |
DOS_SET_ACCESS |
0145 | Change access mode of an open file |
DOS_SET_ATTRIBUTES |
0148 | Set a files attributes |
DOS_SET_DRIVE |
012D | Set the default drive |
DOS_SET_MESSAGE |
014E | Enable/disable disk error messages |
DOS_SET_POSITION |
0136 | Set the file pointer |
DOS_SET_USER |
0130 | Set the default user |
DOS_VERSION |
0103 | Return DOS issue and version numbers |
DOS_WRITE |
0115 | Write bytes from memory into a file |
DOS_WRITE_BYTE |
011B | Write byte to a file |
ONERR |
5B3A | Paging subroutine |
RAMRST |
5B5D | RST 8 instruction used by ROM 1 to report old errors to ROM 3 |
REGNUOY |
5B2A | Paging subroutine |
RST_0 |
0000 | Start the computer |
RST_1 |
0008 | Report an error |
RST_2 |
0010 | Print A to the output stream |
RST_3 |
0018 | Collect character |
RST_4 |
0020 | Collect Next character |
RST_5 |
0028 | FP Calculator |
RST_6 |
0030 | FP Calculator |
RST_7 |
0038 | Maskable Interrupt Handler |
STOO |
5B10 | Paging subroutine. Entered with interrupts disabled and AF, BC on the stack. |
SWAP |
5B00 | Paging subroutine |
YOUNGER |
5B21 | Paging subroutine |
3 - include
3.1 - BeebASM
Files for the BeebASM assembler
3.1.1 - api
Generated file for beebasm
; ***************************************************************************
; API for Sinclair ZX Spectrum OS
; Notes about the Sinclair ZX Spectrum operating system & memory
; Author: Peter Mount, Area51.dev & Contributors
;
; URL: https://area51.dev/sinclair/spectrum/
;
; Modified: Sun, 23 Jan 2022 17:05:58 UTC
;
; Current version: https://area51.dev/sinclair/spectrum/reference/include/beebasm/api.asm
; ***************************************************************************
DOS_FLUSH = &142 ; Write any pending data to this drive
DOS_GET_1346 = &13C ; Set current cache/ramdisk location
DOS_GET_EOF = &139 ; Get the end of file (EOF) position
DOS_GET_POSITION = &133 ; Get the file pointer
DOS_MAP_A = &154 ; Map drive B to unit 0 or 1
DOS_OPEN_DRIVE = &14B ; Open drive as a single file
DOS_REF_XDPB = &151 ; Point at XDPB for this drive
DOS_SET_1346 = &13F ; Rebuild the sector cache and RAM disk
DOS_SET_ACCESS = &145 ; Change access mode of an open file
DOS_SET_ATTRIBUTES = &148 ; Set a files attributes
DOS_SET_MESSAGE = &14E ; Enable/disable disk error messages
DOS_SET_POSITION = &136 ; Set the file pointer
DOS_ABANDON = &10C ; Abandon a file
DOS_BOOT = &12A ; Boot from disk
DOS_CATALOG = &11E ; Get the disk catalog
DOS_CLOSE = &109 ; Close a file
DOS_DELETE = &124 ; Delete a file
DOS_FREE_SPACE = &121 ; Get free space on drive
DOS_INITIALISE = &100 ; Initialise +3DOS
DOS_OPEN = &106 ; Open and/or Create a file
DOS_READ = &112 ; Read bytes from a file into memory
DOS_READ_BYTE = &118 ; Read byte from a file, check for soft-EOF
DOS_REF_HEAD = &10F ; Point to header data for this file
DOS_RENAME = &127 ; Get free space on drive
DOS_SET_DRIVE = &12D ; Set the default drive
DOS_SET_USER = &130 ; Set the default user
DOS_VERSION = &103 ; Return DOS issue and version numbers
DOS_WRITE = &115 ; Write bytes from memory into a file
DOS_WRITE_BYTE = &11B ; Write byte to a file
DD_ASK_1 = &17B ; Check to see if unit 1 is present
DD_CHECK_SECTOR = &169 ; Check a sector
DD_DRIVE_STATUS = &17E ; Check drive status
DD_ENCODE = &184 ; Set copy protection encode routine
DD_EQUIPMENT = &181 ; Ask what type of drive
DD_FORMAT = &16C ; Format a track
DD_INIT = &15A ; Initialise the disk driver
DD_INTERFACE = &157 ; Check for the disk drive interface
DD_L_DPB = &18A ; Initialise DPB for a given format
DD_L_OFF_MOTOR = &19C ; Turn off motor
DD_L_ON_MOTOR = &196 ; Turn on motor
DD_L_READ = &190 ; Low level uPD765A read command
DD_L_SEEK = &18D ; Seek to required track
DD_L_T_OFF_MOTOR = &199 ; Start motor off timeout
DD_L_WRITE = &193 ; Low level uPD765A write command
DD_L_XDPB = &187 ; Initialise XDPB for a given format
DD_LOGIN = &175 ; Login a new disk
DD_READ_ID = &16F ; Read a sector identifier
DD_READ_SECTOR = &163 ; Read a sector
DD_SEL_FORMAT = &178 ; Select a standard format
DD_SET_RETRY = &160 ; Set try/retry count
DD_SETUP = &15D ; Setup disk parameters
DD_TEST_UNSUITABLE = &172 ; Check disk is suitable to write to
DD_WRITE_SECTOR = &166 ; Write a sector
RST_6 = &30 ; FP Calculator
RST_5 = &28 ; FP Calculator
CL_ALL = &DAF ; Clear the screen
RST_3 = &18 ; Collect character
RST_4 = &20 ; Collect Next character
RST_1 = &8 ; Report an error
RST_7 = &38 ; Maskable Interrupt Handler
RST_2 = &10 ; Print A to the output stream
RST_0 = &0 ; Start the computer
SWAP = &5B00 ; Paging subroutine
STOO = &5B10 ; Paging subroutine. Entered with interrupts disabled and AF, BC on the stack.
YOUNGER = &5B21 ; Paging subroutine
REGNUOY = &5B2A ; Paging subroutine
ONERR = &5B3A ; Paging subroutine
RAMRST = &5B5D ; RST 8 instruction used by ROM 1 to report old errors to ROM 3
3.1.2 - headers
Generated file for beebasm
; ***************************************************************************
; Headers for Sinclair ZX Spectrum OS
; Notes about the Sinclair ZX Spectrum operating system & memory
; Author: Peter Mount, Area51.dev & Contributors
;
; URL: https://area51.dev/sinclair/spectrum/
;
; Modified: Sun, 23 Jan 2022 17:05:58 UTC
;
; Current version: https://area51.dev/sinclair/spectrum/reference/include/beebasm/headers.asm
; ***************************************************************************
; Tokens used to store BASIC programs in memory
BAS_CODE = &AF ; CODE
BAS_CLEAR = &FD ; CLEAR statement
BAS_LOAD = &EF ; LOAD statement
BAS_PRINT = &F5 ; PRINT statement
BAS_RANDOMIZE = &F9 ; RANDOMIZE statement
BAS_USR = &C0 ; USR function
; The display attributes specifying colour information
DISPLAYATTR = &5800 ; The display attributes holding colour information
; The display pixel format
DISPLAYFILE = &4000 ; The start of the standard Spectrum's standard screen
; System variables
OLDHL = &5B52 ; Temp store while switching roms
OLDBC = &5B54 ; Temp store while switching roms
OLDAF = &5B56 ; Temp store while switching roms
TARGET = &5B58 ; Subroutine address in ROM 3
RETADDR = &5B5A ; Return address in ROM1
BANKM = &5B5C ; Copy last byte output to Port 7FFD
RAMERR = &5B5E ; Error passed from ROM 1 to 3 via RAMRST. Also used by SAVE/LOAD as temp drive store
BAUD = &5B5F ; RS232 bit period in T states/26. Set by FORMAT LINE
SERFL = &5B61 ; Second-character-received flag & data
COL = &5B63 ; Current column from 1 to width
WIDTH = &5B64 ; Paper column width
TVPARS = &5B65 ; Number of inline parameters expected by RS232
FLAGS3 = &5B66 ; Various Flags
BANK678 = &5B67 ; Copy of last byte output to port 1FFD
XLOC = &5B68 ; Hold X location when using the unexpanded COPY command
YLOC = &5B69 ; Hold Y location when using the unexpanded COPY command
OLDSP = &5B6A ; Old SP (stack pointer) when TSTACK is in use.
SYNRET = &5B6C ; Return address for ONERR
LASTTV = &5B6E ; Last value printed by calculator
RCLINE = &5B73 ; Current line being renumbered
RCSTART = &5B75 ; Starting line number for renumbering
RCSTEP = &5B77 ; Incremental value for renumbering
LODDRV = &5B79 ; Drive for LOAD VERIFY or MERGE
SAVDRV = &5B7A ; Drive for SAVE
DUMPLF = &5B7B ; Holds the number of 1/216ths user for line feeds in 'COPY EXP'. If a dump cannot fit A4 set to 8 to reduce size of dump.
STRIP1 = &5B7C ; Stripe 1 bitmap
STRIP2 = &5B84 ; Strip2 2 bitmap. Extends to 5B8B
TSTACK = &5BFF ; Temp stack (Grows DOWN from here). Used when Page 7 is switched in at top of memory while editing or using +3DOS. It can grow down to STRIP1 safely giving 115 bytes
KSTATE = &5C00 ; Used for reading keyboard
LASTK = &5C08 ; Stores newly pressed key
REPDEL = &5C09 ; Time in 1/50s before key repeats
REPPER = &5C0A ; Delay in 1/50s between key repeats
KDATA = &5C0D ; Stores 2nd byte of colour controls entered from keyboard
TVDATA = &5C0E ; Stores bytes of colour, AT and TAB controls going to TV
STRMS = &5C10 ; Addresses of channels attached to streams
CHARS = &5C36 ; 256 less than address of character set starting with space and up to (C).
RASP = &5C38 ; Length of warning buzz
PIP = &5C39 ; Length of keyboard click
ERRNR = &5C3A ; 1 less than report code. Starts at 255 for -1
FLAGS = &5C3B ; Various flags for BASIC
TVFLAG = &5C3C ; Flags associated with the TV
ERRSP = &5C3D ; Address of item on machine stack to be used as error return
LISTSP = &5C3F ; Address of return address from automatic listing
MODE = &5C41 ; Specifies K, L, C, E or G cursor
NEWPPC = &5C42 ; Line to be jumped to
NSPPC = &5C44 ; Statement number in line to be jumped to. Poking first NEWPPC then NSPPC forces a jump to a specific statement in a line.
PPC = &5C45 ; Line number of statement currently being executed
SUBPPC = &5C47 ; Number within line of statement currently being executed
BORDCR = &5C48 ; Border colour multiplied by 8; also contains attributes normally used for lower half of the screen
EPPC = &5C49 ; Number of current line (with program cursor)
VARS = &5C4B ; Address of variables
DEST = &5C4D ; Address of variable in assignment
CHANS = &5C4F ; Address of channel data
CHURCHL = &5C51 ; Address of information currently being used for IO
PROG = &5C53 ; Address of BASIC program
NXTLIN = &5C55 ; Address of next line in program
DATADD = &5C57 ; Address of terminator of last DATA item
ELINE = &5C59 ; Address of command being typed in
KCUR = &5C5B ; Address of cursor
CHADD = &5C5D ; Address of next character after the argument of PEEK or the NEWLINE at the end of a POKE statement.
XPTR = &5C5F ; Address of character after the [] marker
WORKSP = &5C61 ; Address of temporary workspace
STKBOT = &5C63 ; Address of bottom of calculator stack
STKEND = &5C65 ; Address of start of space space
BREG = &5C67 ; Calculators B register
MEM = &5C68 ; Address of area used for calculators memory, usually MEMBOT
FLAGS2 = &5C6A ; More flags
DFSZ = &5C6B ; Number of lines (including one blank) in lower part of the screen
STOP = &5C6C ; Number of the top program line in automatic listings
OLDPPC = &5C6E ; Line number to which CONTINUE jumps
OSPPC = &5C70 ; Number within line of statement to which CONTINUE jumps
FLAGX = &5C71 ; Various flags
STRLEN = &5C72 ; Length of string type destination in assignment
TADDR = &5C74 ; Address of next item in syntax table
SEED = &5C76 ; The seed for the RNG. Variable set using RANDOMIZE
FRAMES = &5C78 ; 3 byte (least significant first) frame counter incremented every 20ms
UDG = &5C7B ; Address of first user defined graphic
COORDX = &5C7D ; X coordinate of last point plotted
COORDY = &5C7E ; Y coordinate of last point plotted
PPOSN = &5C7F ; 33 column number of printer position
PRCC = &5C80 ; Full address of next position for LPRINT. Only used for ZX printer, not in 128K mode.
ECHOE = &5C82 ; 33 column number & 24 line number of end of input buffer
DFCC = &5C84 ; Address in display file of PRINT position
DFCCL = &5C86 ; Like DFCC but for lower part of screen
SPOSN = &5C88 ; 33 col & 24 line number for PRINT position
SPOSNL = &5C8A ; Like SPOSN but for lower part of screen
SCRCT = &5C8C ; Counts scrolls, always 1 more than number of scrolls to perform before scroll.
ATTRP = &5C8D ; Permanent current colours
MASKP = &5C8E ; Used for transparent colour. Any bit that is 1 shows bit taken from screen and not ATTRP
ATTRT = &5C8F ; Like ATTRP but for temporary colours
MASKT = &5C90 ; Like MASKP but for temporary colours
PFLAG = &5C91 ; More flags
MEMBOT = &5C92 ; Calculators memory area used to store numbers not convenient to store on the calculator stack
NMIADD = &5CB0 ; Address of users NMI routine. Older machines NMI didn't work well so was marked as UNUSED so can cause issues on +3 if user code uses this
RAMTOP = &5CB2 ; Address of last byte of BASIC system area
PRAMT = &5CB4 ; Address of last byte of physical RAM
SYSVAREND = &5CB6 ; Start of Channel information, usually value in (CHANS)
RESERVED_MMAP = &5CC0 ; Marked reserved in 48k memory map
BASE_AVAIL_MEM = &5CCB ; Base of available memory
3.2 - ZAsm
Files for the ZAsm assembler
3.2.1 - api
Generated file for zasm
; ***************************************************************************
; API for Sinclair ZX Spectrum OS
; Notes about the Sinclair ZX Spectrum operating system & memory
; Author: Peter Mount, Area51.dev & Contributors
;
; URL: https://area51.dev/sinclair/spectrum/
;
; Modified: Sun, 23 Jan 2022 17:05:58 UTC
;
; Current version: https://area51.dev/sinclair/spectrum/reference/include/zasm/api.z80
; ***************************************************************************
DOS_FLUSH equ &142 ; Write any pending data to this drive
DOS_GET_1346 equ &13C ; Set current cache/ramdisk location
DOS_GET_EOF equ &139 ; Get the end of file (EOF) position
DOS_GET_POSITION equ &133 ; Get the file pointer
DOS_MAP_A equ &154 ; Map drive B to unit 0 or 1
DOS_OPEN_DRIVE equ &14B ; Open drive as a single file
DOS_REF_XDPB equ &151 ; Point at XDPB for this drive
DOS_SET_1346 equ &13F ; Rebuild the sector cache and RAM disk
DOS_SET_ACCESS equ &145 ; Change access mode of an open file
DOS_SET_ATTRIBUTES equ &148 ; Set a files attributes
DOS_SET_MESSAGE equ &14E ; Enable/disable disk error messages
DOS_SET_POSITION equ &136 ; Set the file pointer
DOS_ABANDON equ &10C ; Abandon a file
DOS_BOOT equ &12A ; Boot from disk
DOS_CATALOG equ &11E ; Get the disk catalog
DOS_CLOSE equ &109 ; Close a file
DOS_DELETE equ &124 ; Delete a file
DOS_FREE_SPACE equ &121 ; Get free space on drive
DOS_INITIALISE equ &100 ; Initialise +3DOS
DOS_OPEN equ &106 ; Open and/or Create a file
DOS_READ equ &112 ; Read bytes from a file into memory
DOS_READ_BYTE equ &118 ; Read byte from a file, check for soft-EOF
DOS_REF_HEAD equ &10F ; Point to header data for this file
DOS_RENAME equ &127 ; Get free space on drive
DOS_SET_DRIVE equ &12D ; Set the default drive
DOS_SET_USER equ &130 ; Set the default user
DOS_VERSION equ &103 ; Return DOS issue and version numbers
DOS_WRITE equ &115 ; Write bytes from memory into a file
DOS_WRITE_BYTE equ &11B ; Write byte to a file
DD_ASK_1 equ &17B ; Check to see if unit 1 is present
DD_CHECK_SECTOR equ &169 ; Check a sector
DD_DRIVE_STATUS equ &17E ; Check drive status
DD_ENCODE equ &184 ; Set copy protection encode routine
DD_EQUIPMENT equ &181 ; Ask what type of drive
DD_FORMAT equ &16C ; Format a track
DD_INIT equ &15A ; Initialise the disk driver
DD_INTERFACE equ &157 ; Check for the disk drive interface
DD_L_DPB equ &18A ; Initialise DPB for a given format
DD_L_OFF_MOTOR equ &19C ; Turn off motor
DD_L_ON_MOTOR equ &196 ; Turn on motor
DD_L_READ equ &190 ; Low level uPD765A read command
DD_L_SEEK equ &18D ; Seek to required track
DD_L_T_OFF_MOTOR equ &199 ; Start motor off timeout
DD_L_WRITE equ &193 ; Low level uPD765A write command
DD_L_XDPB equ &187 ; Initialise XDPB for a given format
DD_LOGIN equ &175 ; Login a new disk
DD_READ_ID equ &16F ; Read a sector identifier
DD_READ_SECTOR equ &163 ; Read a sector
DD_SEL_FORMAT equ &178 ; Select a standard format
DD_SET_RETRY equ &160 ; Set try/retry count
DD_SETUP equ &15D ; Setup disk parameters
DD_TEST_UNSUITABLE equ &172 ; Check disk is suitable to write to
DD_WRITE_SECTOR equ &166 ; Write a sector
RST_6 equ &30 ; FP Calculator
RST_5 equ &28 ; FP Calculator
CL_ALL equ &DAF ; Clear the screen
RST_3 equ &18 ; Collect character
RST_4 equ &20 ; Collect Next character
RST_1 equ &8 ; Report an error
RST_7 equ &38 ; Maskable Interrupt Handler
RST_2 equ &10 ; Print A to the output stream
RST_0 equ &0 ; Start the computer
SWAP equ &5B00 ; Paging subroutine
STOO equ &5B10 ; Paging subroutine. Entered with interrupts disabled and AF, BC on the stack.
YOUNGER equ &5B21 ; Paging subroutine
REGNUOY equ &5B2A ; Paging subroutine
ONERR equ &5B3A ; Paging subroutine
RAMRST equ &5B5D ; RST 8 instruction used by ROM 1 to report old errors to ROM 3
3.2.2 - headers
Generated file for zasm
; ***************************************************************************
; Headers for Sinclair ZX Spectrum OS
; Notes about the Sinclair ZX Spectrum operating system & memory
; Author: Peter Mount, Area51.dev & Contributors
;
; URL: https://area51.dev/sinclair/spectrum/
;
; Modified: Sun, 23 Jan 2022 17:05:58 UTC
;
; Current version: https://area51.dev/sinclair/spectrum/reference/include/zasm/headers.z80
; ***************************************************************************
; Tokens used to store BASIC programs in memory
BAS_CODE equ &AF ; CODE
BAS_CLEAR equ &FD ; CLEAR statement
BAS_LOAD equ &EF ; LOAD statement
BAS_PRINT equ &F5 ; PRINT statement
BAS_RANDOMIZE equ &F9 ; RANDOMIZE statement
BAS_USR equ &C0 ; USR function
; The display attributes specifying colour information
DISPLAYATTR equ &5800 ; The display attributes holding colour information
; The display pixel format
DISPLAYFILE equ &4000 ; The start of the standard Spectrum's standard screen
; System variables
OLDHL equ &5B52 ; Temp store while switching roms
OLDBC equ &5B54 ; Temp store while switching roms
OLDAF equ &5B56 ; Temp store while switching roms
TARGET equ &5B58 ; Subroutine address in ROM 3
RETADDR equ &5B5A ; Return address in ROM1
BANKM equ &5B5C ; Copy last byte output to Port 7FFD
RAMERR equ &5B5E ; Error passed from ROM 1 to 3 via RAMRST. Also used by SAVE/LOAD as temp drive store
BAUD equ &5B5F ; RS232 bit period in T states/26. Set by FORMAT LINE
SERFL equ &5B61 ; Second-character-received flag & data
COL equ &5B63 ; Current column from 1 to width
WIDTH equ &5B64 ; Paper column width
TVPARS equ &5B65 ; Number of inline parameters expected by RS232
FLAGS3 equ &5B66 ; Various Flags
BANK678 equ &5B67 ; Copy of last byte output to port 1FFD
XLOC equ &5B68 ; Hold X location when using the unexpanded COPY command
YLOC equ &5B69 ; Hold Y location when using the unexpanded COPY command
OLDSP equ &5B6A ; Old SP (stack pointer) when TSTACK is in use.
SYNRET equ &5B6C ; Return address for ONERR
LASTTV equ &5B6E ; Last value printed by calculator
RCLINE equ &5B73 ; Current line being renumbered
RCSTART equ &5B75 ; Starting line number for renumbering
RCSTEP equ &5B77 ; Incremental value for renumbering
LODDRV equ &5B79 ; Drive for LOAD VERIFY or MERGE
SAVDRV equ &5B7A ; Drive for SAVE
DUMPLF equ &5B7B ; Holds the number of 1/216ths user for line feeds in 'COPY EXP'. If a dump cannot fit A4 set to 8 to reduce size of dump.
STRIP1 equ &5B7C ; Stripe 1 bitmap
STRIP2 equ &5B84 ; Strip2 2 bitmap. Extends to 5B8B
TSTACK equ &5BFF ; Temp stack (Grows DOWN from here). Used when Page 7 is switched in at top of memory while editing or using +3DOS. It can grow down to STRIP1 safely giving 115 bytes
KSTATE equ &5C00 ; Used for reading keyboard
LASTK equ &5C08 ; Stores newly pressed key
REPDEL equ &5C09 ; Time in 1/50s before key repeats
REPPER equ &5C0A ; Delay in 1/50s between key repeats
KDATA equ &5C0D ; Stores 2nd byte of colour controls entered from keyboard
TVDATA equ &5C0E ; Stores bytes of colour, AT and TAB controls going to TV
STRMS equ &5C10 ; Addresses of channels attached to streams
CHARS equ &5C36 ; 256 less than address of character set starting with space and up to (C).
RASP equ &5C38 ; Length of warning buzz
PIP equ &5C39 ; Length of keyboard click
ERRNR equ &5C3A ; 1 less than report code. Starts at 255 for -1
FLAGS equ &5C3B ; Various flags for BASIC
TVFLAG equ &5C3C ; Flags associated with the TV
ERRSP equ &5C3D ; Address of item on machine stack to be used as error return
LISTSP equ &5C3F ; Address of return address from automatic listing
MODE equ &5C41 ; Specifies K, L, C, E or G cursor
NEWPPC equ &5C42 ; Line to be jumped to
NSPPC equ &5C44 ; Statement number in line to be jumped to. Poking first NEWPPC then NSPPC forces a jump to a specific statement in a line.
PPC equ &5C45 ; Line number of statement currently being executed
SUBPPC equ &5C47 ; Number within line of statement currently being executed
BORDCR equ &5C48 ; Border colour multiplied by 8; also contains attributes normally used for lower half of the screen
EPPC equ &5C49 ; Number of current line (with program cursor)
VARS equ &5C4B ; Address of variables
DEST equ &5C4D ; Address of variable in assignment
CHANS equ &5C4F ; Address of channel data
CHURCHL equ &5C51 ; Address of information currently being used for IO
PROG equ &5C53 ; Address of BASIC program
NXTLIN equ &5C55 ; Address of next line in program
DATADD equ &5C57 ; Address of terminator of last DATA item
ELINE equ &5C59 ; Address of command being typed in
KCUR equ &5C5B ; Address of cursor
CHADD equ &5C5D ; Address of next character after the argument of PEEK or the NEWLINE at the end of a POKE statement.
XPTR equ &5C5F ; Address of character after the [] marker
WORKSP equ &5C61 ; Address of temporary workspace
STKBOT equ &5C63 ; Address of bottom of calculator stack
STKEND equ &5C65 ; Address of start of space space
BREG equ &5C67 ; Calculators B register
MEM equ &5C68 ; Address of area used for calculators memory, usually MEMBOT
FLAGS2 equ &5C6A ; More flags
DFSZ equ &5C6B ; Number of lines (including one blank) in lower part of the screen
STOP equ &5C6C ; Number of the top program line in automatic listings
OLDPPC equ &5C6E ; Line number to which CONTINUE jumps
OSPPC equ &5C70 ; Number within line of statement to which CONTINUE jumps
FLAGX equ &5C71 ; Various flags
STRLEN equ &5C72 ; Length of string type destination in assignment
TADDR equ &5C74 ; Address of next item in syntax table
SEED equ &5C76 ; The seed for the RNG. Variable set using RANDOMIZE
FRAMES equ &5C78 ; 3 byte (least significant first) frame counter incremented every 20ms
UDG equ &5C7B ; Address of first user defined graphic
COORDX equ &5C7D ; X coordinate of last point plotted
COORDY equ &5C7E ; Y coordinate of last point plotted
PPOSN equ &5C7F ; 33 column number of printer position
PRCC equ &5C80 ; Full address of next position for LPRINT. Only used for ZX printer, not in 128K mode.
ECHOE equ &5C82 ; 33 column number & 24 line number of end of input buffer
DFCC equ &5C84 ; Address in display file of PRINT position
DFCCL equ &5C86 ; Like DFCC but for lower part of screen
SPOSN equ &5C88 ; 33 col & 24 line number for PRINT position
SPOSNL equ &5C8A ; Like SPOSN but for lower part of screen
SCRCT equ &5C8C ; Counts scrolls, always 1 more than number of scrolls to perform before scroll.
ATTRP equ &5C8D ; Permanent current colours
MASKP equ &5C8E ; Used for transparent colour. Any bit that is 1 shows bit taken from screen and not ATTRP
ATTRT equ &5C8F ; Like ATTRP but for temporary colours
MASKT equ &5C90 ; Like MASKP but for temporary colours
PFLAG equ &5C91 ; More flags
MEMBOT equ &5C92 ; Calculators memory area used to store numbers not convenient to store on the calculator stack
NMIADD equ &5CB0 ; Address of users NMI routine. Older machines NMI didn't work well so was marked as UNUSED so can cause issues on +3 if user code uses this
RAMTOP equ &5CB2 ; Address of last byte of BASIC system area
PRAMT equ &5CB4 ; Address of last byte of physical RAM
SYSVAREND equ &5CB6 ; Start of Channel information, usually value in (CHANS)
RESERVED_MMAP equ &5CC0 ; Marked reserved in 48k memory map
BASE_AVAIL_MEM equ &5CCB ; Base of available memory