System Variables

System variables
Function AddressDescription
SWAP 5B00Paging subroutine
STOO 5B10Paging subroutine. Entered with interrupts disabled and AF, BC on the stack.
YOUNGER 5B21Paging subroutine
REGNUOY 5B2APaging subroutine
ONERR 5B3APaging subroutine
RAMRST 5B5DRST 8 instruction used by ROM 1 to report old errors to ROM 3
5B522OLDHLTemp store while switching roms
5B542OLDBCTemp store while switching roms
5B562OLDAFTemp store while switching roms
5B582TARGETSubroutine address in ROM 3
5B5A2RETADDRReturn address in ROM1
5B5C1BANKMCopy last byte output to Port 7FFD
5B5E1RAMERRError passed from ROM 1 to 3 via RAMRST. Also used by SAVE/LOAD as temp drive store
5B5F2BAUDRS232 bit period in T states/26. Set by FORMAT LINE
5B612SERFLSecond-character-received flag & data
5B631COLCurrent column from 1 to width
5B641WIDTHPaper column width80
5B651TVPARSNumber of inline parameters expected by RS232
5B661FLAGS3Various Flags
Bit 2 Set when tokens are expanded on printing
Bit 3 Set if print output is RS232
Bit 4 Set if a disk interface is present
Bit 5 Set if drive B: is present
5B671BANK678Copy of last byte output to port 1FFD
5B681XLOCHold X location when using the unexpanded COPY command
5B691YLOCHold Y location when using the unexpanded COPY command
5B6A2OLDSPOld SP (stack pointer) when TSTACK is in use.
5B6C2SYNRETReturn address for ONERR
5B6E5LASTTVLast value printed by calculator
5B732RCLINECurrent line being renumbered
5B752RCSTARTStarting line number for renumbering10
5B772RCSTEPIncremental value for renumbering10
A Drive A
B Drive B
M Ram Disk
T For tape
A Drive A
B Drive B
M Ram Disk
T For tape
5B7B1DUMPLFHolds 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.9
5B7C8STRIP1Stripe 1 bitmap
5B848STRIP2Strip2 2 bitmap. Extends to 5B8B
5BFF-115TSTACKTemp 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
5C008KSTATEUsed for reading keyboard
5C081LASTKStores newly pressed key
5C091REPDELTime in 1/50s before key repeats35
5C0A1REPPERDelay in 1/50s between key repeats5
5C0D1KDATAStores 2nd byte of colour controls entered from keyboard
5C0E2TVDATAStores bytes of colour, AT and TAB controls going to TV
5C1038STRMSAddresses of channels attached to streams
5C362CHARS256 less than address of character set starting with space and up to (C).
5C381RASPLength of warning buzz
5C391PIPLength of keyboard click
5C3A1ERRNR1 less than report code. Starts at 255 for -1
5C3B1FLAGSVarious flags for BASIC
5C3C1TVFLAGFlags associated with the TV
5C3D2ERRSPAddress of item on machine stack to be used as error return
5C3F2LISTSPAddress of return address from automatic listing
5C411MODESpecifies K, L, C, E or G cursor
5C422NEWPPCLine to be jumped to
5C441NSPPCStatement number in line to be jumped to. Poking first NEWPPC then NSPPC forces a jump to a specific statement in a line.
5C452PPCLine number of statement currently being executed
5C471SUBPPCNumber within line of statement currently being executed
5C481BORDCRBorder colour multiplied by 8; also contains attributes normally used for lower half of the screen
5C492EPPCNumber of current line (with program cursor)
5C4B2VARSAddress of variables
5C4D2DESTAddress of variable in assignment
5C4F2CHANSAddress of channel data
5C512CHURCHLAddress of information currently being used for IO
5C532PROGAddress of BASIC program
5C552NXTLINAddress of next line in program
5C572DATADDAddress of terminator of last DATA item
5C592ELINEAddress of command being typed in
5C5B2KCURAddress of cursor
5C5D2CHADDAddress of next character after the argument of PEEK or the NEWLINE at the end of a POKE statement.
5C5F2XPTRAddress of character after the [] marker
5C612WORKSPAddress of temporary workspace
5C632STKBOTAddress of bottom of calculator stack
5C652STKENDAddress of start of space space
5C671BREGCalculators B register
5C682MEMAddress of area used for calculators memory, usually MEMBOTMEMBOT
5C6A1FLAGS2More flags
Bit 3 Set when CAPS SHIFT or CAPS LOCK is on
5C6B1DFSZNumber of lines (including one blank) in lower part of the screen
5C6C2STOPNumber of the top program line in automatic listings
5C6E2OLDPPCLine number to which CONTINUE jumps
5C701OSPPCNumber within line of statement to which CONTINUE jumps
5C711FLAGXVarious flags
5C722STRLENLength of string type destination in assignment
5C742TADDRAddress of next item in syntax table
5C762SEEDThe seed for the RNG. Variable set using RANDOMIZE
5C783FRAMES3 byte (least significant first) frame counter incremented every 20ms
5C7B2UDGAddress of first user defined graphic
5C7D1COORDXX coordinate of last point plotted
5C7E1COORDYY coordinate of last point plotted
5C7F1PPOSN33 column number of printer position
5C802PRCCFull address of next position for LPRINT. Only used for ZX printer, not in 128K mode.
5C822ECHOE33 column number & 24 line number of end of input buffer
5C842DFCCAddress in display file of PRINT position
5C862DFCCLLike DFCC but for lower part of screen
5C882SPOSN33 col & 24 line number for PRINT position
5C8A2SPOSNLLike SPOSN but for lower part of screen
5C8C1SCRCTCounts scrolls, always 1 more than number of scrolls to perform before scroll.
5C8D1ATTRPPermanent current colours
5C8E1MASKPUsed for transparent colour. Any bit that is 1 shows bit taken from screen and not ATTRP
5C8F1ATTRTLike ATTRP but for temporary colours
5C901MASKTLike MASKP but for temporary colours
5C911PFLAGMore flags
5C9230MEMBOTCalculators memory area used to store numbers not convenient to store on the calculator stack
5CB02NMIADDAddress 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
5CB22RAMTOPAddress of last byte of BASIC system area
5CB42PRAMTAddress of last byte of physical RAM
5CB6SYSVARENDStart of Channel information, usually value in (CHANS)
5CC012RESERVED_MMAPMarked reserved in 48k memory map
5CCBBASE_AVAIL_MEMBase of available memory


  1. Variables between 5B00 and 5BFF are new to 128k & +3. On 48K it is the printer buffer & sometimes used for code but will break newer machines.
  2. Last variable is at 5CB4 so from 5CB6 up is free according to +3 docs but 48k docs don't show that
  3. 5CC0 to 5CCA is marked as reserved in some 48K docs
  4. 48K memory maps show 5CCB as start of memory

Last modified November 2, 2021: Add system variable definitions (31647b0)