Chapter 28 - The system variables
 
The bytes in memory from 16384 to 16508 are set aside for specific uses by the system. You can peek 
them to find out various things about the system, & some of them can be usefully poked. They are listed 
here with their uses.
 
    These are called system variables, & have names, but do not confuse them with the variables used by 
BASIC. The computer will not recognize the names as referring to system variables, & they are given 
solely as mnemonics for you humans.
 
    The abbreviations in column 1 have the following meanings:
 
X   The variable should not be poked because the system might crash.
 
N   Poking the variable will have no lasting effect.
 
S   The variable is saved by 
SAVE
.
 
    The number in column 1 is the number of bytes in the variable. For two bytes, the first one is the less 
significant byte - the reverse of what you might expect. So to poke a value v to a two-byte variable at 
address n, use
 
 
POKE
 n,v-256*
INT
 (v/256)
 
 
POKE
 n+1,
INT
 (v/256)
 
& to peek its value, use the expression
 
 
PEEK
 n + 256*
PEEK
 (n+1)
 
Notes     Address     Name          Contents
1 16384 ERR_NR 1 less than the report code. Starts off at 255 (for - 1), so 
PEEK
16384, if 
it works at all, gives 255. 
POKE
 16384,n can be used to force an error 
halt: 0   n   14 gives one of the usual reports, 15   n   34 or 99   n   
127 gives a non-standard report, and 35   n   98 is liable to mess up 
the display file.
X1 16385 FLAGS Various flags to control the BASIC system.
X2 16386 ERR_SP Address of first item on machine stack (after 
GOSUB
 returns).
2 16388 RAMTOP Address of first byte above BASIC system area. You can poke this to 
make NEW reserve space above that area (see chapter 26) or to fool 
CLS into setting up a minimal display file (chapter 27). Poking RAMTOP 
has no effect until one of these two is executed.
N1 16390 MODE Specified K, L, F or G cursor.
N2 16391 PPC Line number of statement currently being executed. Poking this has no 
lasting efect except in the last line of the program.
S1 16393 VERSN 0 Identifies ZX81 BASIC in saved programs.
S2 16394 E_PPC Number of current line (with program cursor).
SX2 16396 D_FILE See chapter 27.
S2 16398 DF_CC Address of 
PRINT
 position in display file. Can be poked so that 
PRINT
 
output is sent elsewhere.
SX2 16400 VARS See capter 27.
SN2 16402 DEST Address of variable in assignment.
SX2 16404 E_LINE See chapter 27.
SX2 16406 CH_ADD Address of the next character to be interpreted: the character after the 
argument of 
PEEK
, or the 
NEWLINE
 at the end of a 
POKE
 statement.
S2 16408 X_PTR Address of the character preceding the   marker.
SX2 16410 STKBOT See chapter 27.
SX2 16412 STKEND See chapter 27.
SN1 16414 BERG Calculator's b register.