; 48K ROM Routines
$0		START		;System reset handler
$8		ERROR_1		;Error restart
$10		PRINT_A_1	;Print character
$18		GET_CHAR	;Collect character
$20		NEXT_CHAR	;Collect next character
$28		FP_CALC		;Calculator restart
$30		BC_SPACES	;Create free locations in work space
$38		MASK_INT	;Maskable Interrupt routine
$53		ERROR_2		;Continuation of error routine
$66		RESET		;Non-Maskable Interrupt (NMI) routine
$74		CH_ADD_1	;Fetch next character
$7D		SKIP_OVER	;Skip white space
$95,TT80,$170	TKN_TABLE	;BASIC Token tables
$205,B,$89	MAIN_KEYS	;Keyboard translation tables
$28E		KEY_SCAN	;Keyboard scanning routine
$2BF		KEYBOARD	;IM1 Keyboard Scanning Routine
$310		K_REPEAT	;Repeat key routine
$31E		K_TEST		;Test key value
$333		K_DECODE	;Keyboard decoding
$3B5		BEEPER		;Loudspeaker control
$3F8		BEEP		;Handle BEEP command
$46E,B,$54	SEMI_TONE	;Semi-tone table
$4C2		SA_BYTES	;Save header/data to tape
$53F		SA_LD_RET	;Reset border and check BREAK key after save/load
$556		LD_BYTES	;Load header/data from tape
$5E3		LD_EDGE_2	;Check for tape double edge
$5E7		LD_EDGE_1	;Check for tape edge
$605		SAVE_ETC	;Entry point for tape commands
$7CB		VR_CONTROL	;Handle VERIFY control
$802		LD_BLOCK	;Load a data block
$808		LD_CONTROL	;Handle LOAD control
$8B6		ME_CONTROL	;Handle MERGE control
$970		SA_CONTROL	;Handle SAVE control
$9A1,TT80,$50	TAPE_MSGS	;Canned cassette messages
$9F4		PRINT_OUT	;General PRINT routine
$A11		CTLCHRTAB	;Control character table
$A23		PO_BACK_1	;Cursor left routine
$A3D		PO_RIGHT	;Cursor right routine
$A4F		PO_ENTER	;Perform carriage return (CR)
$A5F		PO_COMMA	;Print comma
$A69		PO_QUEST	;Print question mark
$A6D		PO_TV_2		;Handle control characters with operands
$AD9		PO_ABLE		;Handle printable characters
$ADC		PO_STORE	;Store line, column and pixel address
$B03		PO_FETCH	;Fetch print position parameters
$B24		PO_ANY		;Print any character
$B7F		PR_ALL		;Print all characters
$BDB		PO_ATTR		;Set attribute
$C0A		PO_MSG		;Print message
$C3B		PO_SAVE		;Handle recursive printing
$C41		PO_SEARCH	;Search token table
$C55		PO_SCR		;Test for scroll
$CF8		SCRL_MSSG	;"Scroll?" message
$D4D		TEMPS		;Copy permanent colour items to temporary ones
$D6B		CLS		;Handle CLS command
$DAF		CL_ALL		;Clear entire display area
$DD9		CL_SET		;Set line and column numbers
$DFE		CL_SC_ALL	;Handle scrolling
$E44		CL_LINE		;Clear lines at bottom of display
$E88		CL_ATTR		;Handle attributes
$E9B		CL_ADDR		;Calc. screen address from char. line number in B reg
$EAC		COPY		;Handle COPY command
$ECD		COPY_BUFF	;Pass printer buffer to printer
$EF4		COPY_LINE	;Output line of 32 bytes to ZX printer
$F2C		EDITOR		;Editor routine for BASIC and INPUT
$F81		ADD_CHAR	;Add character to current line
$FA0		ED_KEYS_T	;Editing keys table
$FA9		ED_EDIT		;Handle EDIT key
$FF3		ED_DOWN		;Handle cursor down during editing
$1007		ED_LEFT		;Handle cursor left during editing
$100C		ED_RIGHT	;Handle cursor right during editing
$1015		ED_DELETE	;Handle DELETE during editing
$101E		ED_IGNORE	;Ignore next 2 codes from key-input routine
$1024		ED_ENTER	;Handle ENTER during editing
$1031		ED_EDGE		;Move cursor left when editing
$1059		ED_UP		;Cursor up editing
$1076		ED_SYMBOL	;Handle symbol or graphics codes during editing
$107F		ED_ERROR	;Editor error routine
$1097		CLEAR_SP	;Clear edit/work space
$10A8		KEY_INPUT	;Handle keyboard input
$111D		ED_COPY		;Copy line in edit area to lower screen
$1190		SET_HL		;Point to first/last locations of work space
$11A7		REMOVE_FP	;Remove floating-point numbers from line

; 128K System Variables
23296		SWAP		;Paging subroutine (128K)/256-byte ZX Printer buffer (48K)
23312		STOO		;Paging subroutine - Enter with ints disabled, AF, BC on stack
23329		YOUNGER		;Paging subroutine
23338		REGNUOY		;Paging subroutine
23354		ONERR		;Paging subroutine
23378,W		OLDHL		;Temp register store while paging
23380,W		OLDBC		;Temp register store while paging
23382,W		OLDAF		;Temp register store while paging
23384,W		TARGET		;Subroutine addr. in ROM3
23386,W		RETADDR		;Return addr. in ROM1
23388,B		BANKM		;Last byte output to $7FFD
23389,B		RAMRST		;RST 8 instruction
23390,B		RAMERR		;Error number for RAMRST
23391,W		BAUD		;RS232 bit period in Ts/26
23393,B,2	SERFL		;RS232 flags/data
23395,W		COL		;Current column from 1 to WIDTH
23396,B		WIDTH		;Paper column width
23397,B		TVPARS		;Number of inline params for RS232
23398,B		FLAGS3		;Various flags
23399,B		BANK678		;Last byte output to $1FFD
23400,B		XLOC		;X location for COPY
23401,B		YLOC		;Y location for COPY
23402,W		OLDSP		;Old SP when TSTACK is in use
23404,W		SYNRET		;Return addr. for ONERR
23406,B,5	LASTV		;Last calculator value
23411,W		RCLINE		;Line being renumbered
23413,W		RCSTART		;Number of first line to renumber
23415,W		RCSTEP		;Renumber step
23417,B		LODDRV		;Load/Verify/Merge drive letter - "A", "B", "M" or "T"
23418,B		SAVDRV		;Save drive letter - "A", "B", "M" or "T"
23419,B		DUMPLF		;1/216ths user for LFs in COPY EXP
23420,B,8	STRIP1		;Stripe1 bitmap
23428,B,8	STRIP2		;Stripe2 bitmap
23436,B,115	TSPACE		;Temporary stack space
23551,B		TSTACK		;Temporary stack grows down from here

; 48K/128K System Variables
23552,B,8	KSTATE		;Used in reading the keyboard
23560,B		LASTK		;Stores newly pressed key
23561,B		REPDEL		;Initial key repeat delay
23562,B		REPPER		;Successive key repeat delay
23563,W		DEFADD		;Address of args. of user def function or 0
23565,B		K_DATA		;2nd byte of colour codes entered from keyboard
23566,B,2	TVDATA		;Colour/control code bytes for TV
23568,B,38	STRMS		;Address of channels attached to streams
23606,W		CHARS		;256 less than address of character set
23608,B		RASP		;Length of warning buzz
23609,B		PIP		;Length of keyboard click
23610,B		ERRNR		;IY Base in sys vars for BASIC / 1 less than error report code
23611,B		FLAGS		;Various BASIC system flags
23612,B		TVFLAG		;Flags associated with the TV
23613,W		ERRSP		;Address of SP to be used as error return
23615,W		LISTSP		;Address of return address from auto listing
23617,B		MODE		;Specifies "K", "L", "C", "E" or "G" cursor
23618,W		NEWPPC		;Line to be jumped to
23620,B		NSPPC		;Statement number in line to jump to
23621,W		PPC		;Line number of statement currently executing
23623,B		SUBPPC		;Number within line of statement being executed
23624,B		BORDCR		;Border colour*8 / Lower screen Attributes
23625,W		E_PPC		;Number of line with program cursor
23627,W		VARS		;Address of variables
23629,W		DEST		;Address of variable in assignment
23631,W		CHANS		;Address of channel data
23633,W		CURCHL		;Address of info being used for I/O
23635,W		PROG		;Address of BASIC program
23637,W		NXTLIN		;Address of next line in BASIC program
23639,W		DATADD		;Address of terminator of last DATA item
23641,W		E_LINE		;Address of command being typed in
23643,W		K_CUR		;Address of cursor
23645,W		CH_ADD		;Address of next char. to be interpreted
23647,W		X_PTR		;Address of character after the ? marker
23649,W		WORKSP		;Address of temporary work space
23651,W		STKBOT		;Address of bottom of calculator stack
23653,W		STKEND		;Address of start of spare space
23655,B		BREG		;Calculator's B register
23656,W		MEM		;Address of area used for calculator's memory
23658,B		FLAGS2		;Flags (Bit3 = Caps Lock)
23659,B		DF_SZ		;Number of lines in lower screen
23660,W		S_TOP		;Number of top line in auto listings
23662,W		OLDPPC		;Line to which CONTINUE jumps
23664,W		OSPPC		;Number of statement to which CONTINUE jumps
23665,B		FLAGX		;Various flags
23666,W		STRLEN		;Length of string type destination in assignment
23668,W		T_ADDR		;Address of next item in syntax table
23670,W		SEED		;Seed for RND. Set by RANDOMIZE
23672,B,3	FRAMES		;3 Byte (LSB first) frame counter, incremented 20ms
23675,W		UDG		;Address of first User Defined Graphic
23677,B		COORDS		;X-Coordinate of last point plotted
23678,B		COORDSY		;Y-Coordinate of last point plotted
23679,B		P_POSN		;33-column no. of printer position
23680,W		PRCC		;Address of next position for LPRINT to print at
23682,B		ECHO_E		;33-Column no. of end of input buffer
23683,B		ECHO_EY		;24-line no. of end of input buffer
23684,W		DF_CC		;Address in display file of PRINT position
23686,W		DF_CCL		;Address in display file of lower screen PRINT pos.
23688,B		S_POSN		;33-column no. for PRINT pos.
23689,B		S_POSNY		;24-line no. for PRINT pos.
23690,B		S_POSNL		;33-column no. for lower screen PRINT pos.
23691,B		S_POSNLY	;24-line no. for lower screen PRINT pos.
23692,B		SCR_CT		;1 more than no. of lines remaining before "scroll?"
23693,B		ATTR_P		;Permanent current colours etc.
23694,B		MASK_P		;Used for transparent colours
23695,B		ATTR_T		;Temporary current colours etc.
23696,B		MASK_T		;Temporary transparent colours
23697,B		P_FLAG		;Flags
23698,B,30	MEMBOT		;Calculator's memory area
23728,W		NMIADD		;Address of NMI service routine (+3 or Greater)
23730,W		RAMTOP		;Address of last byte of BASIC system area
23732,W		P_RAMT		;Address of last byte of physical RAM