The System Variables - Sinclair ZX81 User Manual

Hide thumbs Also See for ZX81:
Table of Contents

Advertisement

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
1
16384
X1
16385
X2
16386
2
16388
N1
16390
N2
16391
S1
16393
S2
16394
SX2
16396
S2
16398
SX2
16400
SN2
16402
SX2
16404
SX2
16406
S2
16408
SX2
16410
SX2
16412
SN1
16414
Name
Contents
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
127 gives a non-standard report, and 35
the display file.
FLAGS
Various flags to control the BASIC system.
ERR_SP
Address of first item on machine stack (after GOSUB returns).
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.
MODE
Specified K, L, F or G cursor.
PPC
Line number of statement currently being executed. Poking this has no
lasting efect except in the last line of the program.
VERSN
0 Identifies ZX81 BASIC in saved programs.
E_PPC
Number of current line (with program cursor).
D_FILE
See chapter 27.
DF_CC
Address of PRINT position in display file. Can be poked so that PRINT
output is sent elsewhere.
VARS
See capter 27.
DEST
Address of variable in assignment.
E_LINE
See chapter 27.
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.
X_PTR
Address of the character preceding the
STKBOT
See chapter 27.
STKEND
See chapter 27.
BERG
Calculator's b register.
n
14 gives one of the usual reports, 15
n
34 or 99
n
98 is liable to mess up
marker.
n

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents