Appendix C - The ZX81 for those that understand BASIC
General
If you already know BASIC then you should not have much trouble using the ZX81; but it has one or two
idiosyncrasies.
(i) Words are not spelled out, but have keys of their own - this is dealt with in chapter 2 (for keywords &
shifted keys) & chapter 5 (for function names). In the text, these words are printed in
BOLD TYPE
.
(ii) ZX81 BASIC lacks READ, DATA & RESTORE (but see exercise 3 of chapter 22 concerning this),
user-defined functions (FN & DEF; but
VAL
can sometimes be used), & multi-statement lines.
(iii) The string handling facilities are comprehensive but non-standard - see chapter 21, & also chapter
22 (for string arrays).
(iv) The ZX81 character set is completely its own.
(v) The television display is not in general memory-mapped.
(vi) If you are accustomed to using
PEEK
&
POKE
on a different machine, remember that all the
addresses will be different on the ZX81.
Speed
The machine works at two speeds, called compute & display mode
, & fast mode.
In compute & display, the television picture is generated continuously & computing is done during the
blank parts at the top & bottom.
In fast mode, the television picture is turned off during computing, & is only displayed at the end of the
program, while waiting for
INPUT
data, or during a pause (see
PAUSE
).
Fast mode runs about four times as fast, & should be used for programs with a lot of computing as
opposed to output, or when typing in long programs.
Switching between speeds is done with the
FAST
&
SLOW
statements (q.v.).
The keyboard
ZX81 characters comprise not only the single symbols (letters, digits, etc.), but also the compound tokens
(keywords, function names, etc.; these are printed here in
BOLD TYPE
) & all these are entered from the
keyboard rather than being spelled out. To fit this in, some keys have up to five distinct meanings, given
partly by shifting the keys (i.e. pressing the
SHIFT
key at the same time as the required one) & partly by
having the machine in different modes.
The mode is indicated by the cursor, an inverse video letter that shows where the next character from
the keyboard will be inserted.
mode (for keywords) occurs automatically when the machine is expecting a command or program line
(rather than
INPUT
data), & from its position on the line it knows it should expect a line number or a
keyword. This is at the beginning of the line, or just after some digits at the beginning of the line, or just
after
THEN
. If unshifted, the next key will be interpreted as either a keyword (these are mostly written
above
the keys), or a digit.
mode (for letters) normally occurs at all other times. If unshifted, the next key will be interpreted as the
main symbol on that key.
In both & modes, shifted keys will be interpreted as the subsidiary red character in the top right-
hand corner of the key.
mode (for functions) occurs after
FUNCTION
(shifted
NEWLINE
) is pressed, & lasts for one key
depression only. That key will be interpreted as a function name, these appearing under
the keys.
mode for graphics occurs after
GRAPHICS
(shifted 9) is pressed, and lasts until it is pressed again. An
unshifted key will give the inverse video of its mode interpretation; a shifted key will as well, provided
that it is a symbol, but if the shifted key would normally give a token, in graphics mode it gives the graphics
symbol that appears in the bottom right hand corner of the key.
The screen
This has 24 lines, each 32 characters long, and is divided into two parts. The top part is at most 22 lines,
and displays either a listing or program output. The bottom part, at least two lines, is used for inputting
commands, program lines and
INPUT
data, and also for displaying reports.
Keyboard input: this appears in the bottom half of the screen as it is typed, each character (single