ZAsm
Files for the ZAsm assembler
Table of Contents
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
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