; > SysVars
; System Variables

ALIGN				; Ensure evenly aligned address
; end of 'text' section
; +++++++++++++++++++++++
; start of 'data' section

; Host call vectors
.QuitV		EQUW UNIX_QUIT
.CLIV		EQUW UNIX_CLI
.BYTEV		EQUW UNIX_BYTE
.WORDV		EQUW UNIX_WORD
.WRCHV		EQUW UNIX_WRCH
.NEWLV		EQUW UNIX_NEWL
.RDCHV		EQUW UNIX_RDCH
.FILEV		EQUW UNIX_FILE
.ARGSV		EQUW UNIX_ARGS
.BGETV		EQUW UNIX_BGET
.BPUTV		EQUW UNIX_BPUT
.GBPBV		EQUW UNIX_GBPB
.FINDV		EQUW UNIX_FIND
.sys1V		EQUW UNIX_SYS1
.sys2V		EQUW UNIX_SYS2
.ERRV		EQUW UNIX_ERROR

; BBC fall-through vectors
.BBCQUITV	EQUW BBC_QUIT
.BBCCLIV	EQUW BBC_CLI
.BBCBYTEV	EQUW BBC_BYTE
.BBCWORDV	EQUW BBC_WORD
.BBCWRCHV	EQUW BBC_WRCH
.BBCNEWLV	EQUW BBC_NEWL
.BBCRDCHV	EQUW BBC_RDCH
.BBCFILEV	EQUW BBC_FILE
.BBCARGSV	EQUW BBC_ARGS
.BBCBGETV	EQUW BBC_BGET
.BBCBPUTV	EQUW BBC_BPUT
.BBCGBPBV	EQUW BBC_GBPB
.BBCFINDV	EQUW BBC_FIND
.BBCSYS1V	EQUW BBC_SYS1
.BBCSYS2V	EQUW BBC_SYS2
.BBCERRV	EQUW BBC_ERROR

.CodeEnd			; End of 'text/data' section
; end of 'data' section
; ++++++++++++++++++++++
; start of 'bss' section
BSS				; End of saved portion

; TTY settings
; ------------
.SV_OSTTY	EQUD 0		; Host's tty settings
		EQUW 0
.SV_OSIOCTL	EQUD 0		; Host's tty characters
		EQUW 0
.SV_MYTTY	EQUD 0		; My tty settings
		EQUW 0
.SV_MYIOCTL	EQUD 0		; My tty characters
		EQUW 0

; MOS buffer
; ----------
.MOS_BUF	equm 32
;
.ARGS_ADDR	equ MOS_BUF+0
;
.GBPB_CHANNEL	equ MOS_BUF+0
.GBPB_ADDR	equ MOS_BUF+1
.GBPB_NUM	equ MOS_BUF+5
.GBPB_PTR	equ MOS_BUF+9
;
.FILE_NAME	equ MOS_BUF+0
.FILE_LOAD	equ MOS_BUF+2
.FILE_EXEC	equ MOS_BUF+6
.FILE_LENGTH	equ MOS_BUF+10
.FILE_START	equ MOS_BUF+10
.FILE_ATTR	equ MOS_BUF+14
.FILE_END	equ MOS_BUF+14

; String buffers
; --------------
.SV_INPUT	equm 256	; Immediate command buffer, external error buffer
.SV_STRING	equm 256	; String accumulator, immediate input buffer, INPUT buffer

; Static variables and heap pointers
; ----------------------------------
.SV_VARS	equd &00000000	; @%
		equm 26*4	; A%-Z%
.SV_INT_O	equ SV_VARS+&3C	; O%
.SV_INT_P	equ SV_VARS+&40	; P%
.SV_VARPTR	equm 26*2	; A-Z pointers
.SV_PROCPTR	equw &0000	; [ -> PROC pointer
.SV_FNPTR	equw &0000	; \ -> FN pointer
.SV_STRPTR	equw &0000	; ] -> Unused strings pointer
		equw &0000	; ^ -> unused pointer
		equw &0000	; _ pointer
		equw &0000	; ` pointer
		equm 26*2	; a-z pointers
.SV_ENDPTR

; Memory structure
; ----------------
;.SV_BASE	equw &0000	; Absolute address of start of code - may not be needed
.SV_MEMBOT	equw &0000	; Bottom of available memory - may not be needed
.SV_PAGE	equw &0000	; PAGE - start of BASIC program
.SV_TOP 	equw &0000	; End of BASIC program
.SV_LOMEM	equw &0000	; Start of BASIC variable area
.SV_VAREND	equw &0000	; End of BASIC variable area
.SV_STACK	equw &0000	; Bottom of BASIC stack - may not be needed
.SV_HIMEM	equw &0000	; Top of BASIC stack/memory
.SV_MEMTOP	equw &0000	; Top of available memory - may not be needed

; Program lines
; -------------
.SV_LINE	equw &0000	; Current line number
.SV_TRACE	equw &0000	; TRACE line number
.SV_AUTO	equw &0000	; AUTO line number

; Program pointers
; ----------------
.SV_ONERR	equw &0000	; Points to after ON ERROR
.SV_FAULT	equw &0000	; Last error
.SV_DATA	equw &0000	; DATA pointer
.SV_ERL		equw &0000	; Line number error occured in
.SV_LPTR 	equw &0000	; Current byte being executed

; Misc.
; -----
.SV_RAND	equd &00000000	; RND seed
.SV_RAND4	equb &00	; Fifth byte of RND seed
.SV_ERR 	equb &00	; ERR
.SV_COUNT	equb &00	; COUNT
.SV_WIDTH	equb &00	; WIDTH
.SV_OPTIONS	equb &00	; LISTO and OPT options
.SV_STEP	equb &00	; AUTO step
.SV_ESCFLG	equb &00	; Escape flag
.SV_SYS		equb &00	; System flags, b0=ioctrl/stty, b1=BBC EMTs
; Four more bytes would align to multiple of 16
ALIGN

.BasicEnd			; End of 'uninitialised data' section
; end of 'bss' section
;.SV_SIZE	equ BasicEnd-SV_VARS
; Default PAGE
