Sinclair ZX81 User Manual page 48

Hide thumbs Also See for ZX81:
Table of Contents

Advertisement

LOAD & SAVE can also be used in programs. With SAVE , the program will save itself in such a state
then when loaded it will immediately carry on executing from the line after the SAVE statement.
For example, type in
5 REM "USELESS"
10 PRINT "THIS IS ALL IT DOES"
20 STOP
100 SAVE "USELESS"
110 GOTO 10
Connect up the tape recorder, type
RUN 100 (without NEWLINE ),
start the tape recorder recording, & press NEWLINE . When the program has saved itself, it will continue
running. You will discover afterwards that the last S in USELESS in line 100 has changed to inverse video,
but this is nothing to worry about.
To load it, rewind the tape to somewhere before the beginning of the program, type
LOAD "USELESS" (without NEWLINE ),
start playing back the tape into the computer, & press NEWLINE . When it has loaded, it will carry on with
line 110 & execute itself without any effort on your part.
Note how putting the SAVE statement at the end of the program means that to run it without the SAVE
you just type RUN - you don't have to jump round the SAVE statement.
Don't SAVE from within a GOSUB routine - it won't work properly.
Don't put inverse video characters in a program name. Any part of the name after the inverse video
character gets lost.
The name should not contain more than 127 characters.
The name in a LOAD or SAVE does not have to be a string constant, it can be any string-valued
expression, like A$ or CHR$ 100.
Summary
Saving a program on tape
Loading a named program from tape
Loading the first available program from tape
Saving a program so that it will load & then run itself
Statements: SAVE , LOAD
Note
You cannot load programs that were saved from any other kinds of computer or from the ZX80 with its
own integer BASIC. Your saved programs cannot be loaded into other kinds of computer or the ZX80 with
integer BASIC. The ZX80 with ZX81 BASIC, on the other hand is compatible with the ZX81; saved
programs from either can be loaded to the other. After loading a ZX80 program, the ZX81 will be in fast
mode.
Exercises
1. Make a tape with loads of short programs, start playing it back into the computer, & type
LOAD "NOT THE NAME OF A PROGRAM"
You should easily be able to see the difference on the television between the empty stretches on the tape
(with a fairly unstructured black & white pattern) & the programs (with more definite lines). Both patterns
are different from what you see when you save. If you turn the volume down while a program is going past,
you can see the picture switching to the empty space pattern while the signal goes too quiet to look like
program.
2. Make a tape on which the first program, when loaded, prints a menu (a list of the other programs on the
tape), asks you to choose a program, & then loads it.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents