A Comparision of Tape commands on Sinclair machines
Overview of Cassette Tape statements
The following list provides detailed explanations on cassette tape statement found on the ZX80, ZX81 and ZX Spectrum. The ZX80 as only two statements, SAVE & LOAD which respectively save or load a complete program and its variables (with no filename).
The ZX81 has the ability to save and load with a filename and also the option to auto-run from certain line number when SAVE is placed within a program. The ZX Spectrum improves on this by giving the option to save or load blocks of code, the display file and data arrays.
The QL is not mentioned in this section as it does not have cassette tape facilities.
LOAD
Function
Explanation
Comments
Load program from tape
LOAD (ZX80)
LOAD "" (ZX81 & ZX Spectrum)
Result: Load the first encountered program and its variables from tape into memory.
ZX80 does not allow or require a filename.
The ZX81 allows filenames of up to 127 characters, the ZX Spectrum only allows up to 10. No inverted characters are allowed in ZX81 filenames.
Load program f$ from tape
LOAD f$ (ZX81 & ZX Spectrum)
Result: Load program f$ and its variables from tape into memory. (ZX81 & ZX Spectrum)
The ZX81 allows filenames of up to 127 characters, the ZX Spectrum only allows up to 10. No inverted characters are allowed in ZX81 filenames.
Load code into memory from tape
i) LOAD f$ CODE m,n (ZX Spectrum only)
ii)LOAD f$ CODE m (ZX Spectrum only)
iii)LOAD f$ CODE (ZX Spectrum only)
iv)LOAD f SCREEN$ (ZX Spectrum only)
Result i) Load n bytes into memory starting at location m.
Result ii) Load code into memory starting at location m.
Result iii) Load code with filename f$ into memory. Code will be loaded into the memory location that it was saved to.
Result iv) Load 6912 bytes directly into screen memory starting at location 16384.
The ZX80 and ZX81 will always load a program with its variables and data.
Load array data from tape into memory
i) LOAD f$ DATA a() (ZX Spectrum only)
ii)LOAD f$ DATA a$() (ZX Spectrum only)
Result i) Load numeric array a with filename f$ from tape into memory deleting any array with the same name.
Result ii) Load character array a with filename f$ from tape into memory deleting any array with the same name.
Although the ZX80 & ZX81 micros cannot load individual arrays, by design they will load all variables that were saved with a program, including any arrays which may have been created.
MERGE
Function
Explanation
Comments
Merge programs
MERGE f$
Result: Merge program f$ with that already in memory overwriting duplicate program lines.
Only on the Spectrum.
Force auto-run to stop
MERGE "" : STOP
Result: Load first program encountered and abort automatic running (if present).
Only on the Spectrum. Must be executed after a system reset or NEW otherwise there may be unwanted results from the merging of any program which still resides in memory.
SAVE
Function
Explanation
Comments
Save program and variables to tape (ZX80)
Save program f$ and its variables to tape (ZX81 & ZX Spectrum)
i) SAVE (ZX80)
ii)SAVE f$ (ZX81 & ZX Spectrum)
Result i: Save program to tape. (ZX80)
Result ii: Save program with filename f$ to tape. (ZX81 & ZX Spectrum)
ZX80 does not allow filenames.
Save program f$ to tape to automatically run when reloaded from line m
i) 9998 SAVE "FILENAME" (ZX81) 9999 GOTO m
Start tape recording then:
RUN 9998
ii) SAVE f$ LINE m (ZX Spectrum)
Result i: Save program "FILENAME" (or filename of user's choosing) to tape to run from line m when reloaded. (ZX81)
Result ii: Save program f$ to tape to run from line m when reloaded. (ZX Spectrum)
On the ZX81, when saving a program to autostart, the SAVE statement must be placed within the program itself. A GOTO m statement must follow with m being the line number to run from when reloaded. After saving the last character of the filename will be changed to an inverted character.
Save code from memory to tape
i) SAVE f$ CODE m,n (ZX Spectrum only)
ii)SAVE f$ SCREEN$ (ZX Spectrum only)
Result i) Save n bytes into memory starting at location m.
Result ii: Save 6912 bytes directly from screen memory starting at location 16384.
The ZX80 and ZX81 will always save a program with its variables and data.
Save array data from to tape
i) SAVE f$ DATA a() (ZX Spectrum only)
ii)SAVE f$ DATA a$() (ZX Spectrum only)
Result i: Save numeric array a with filename f$ to tape.
Result ii) Save character array a$ with filename f$ to tape.
Although the ZX80 & ZX81 micros cannot save individual arrays, by design they will save all variables with a program, including any arrays which may have been created.
VERIFY
Function
Explanation
Comments
Verify saved program f$
VERIFY f$
Result: Compare saved program f$ and its variables with that in memory.
Error R (Tape loading error) if verify fails.
The ZX80 and ZX81 cannot verify saved programs.
Note: There is a published program for the ZX81 which allows saved programs and their variables to be verified. It was published in Your Computer magazine in May of 1983 under the headline 'SAVED!' and is 116 bytes long.
Verify code saved to tape
i) VERIFY f$ CODE m,n
ii)VERIFY f$ CODE m
iii)VERIFY f$ CODE
iv)VERIFY f SCREEN$*
Result i: Compare saved code of n bytes length with that in memory starting at location m.
Result ii: Compare saved code with that in memory starting at location m.
Result iii: Compare code with filename f$ with that in memory. Code will be verified with that in memory starting from the location which the first byte was saved.
Result iv: Compare saved screen image with the 6912 bytes in screen memory (display file) starting at location 16384. This will fail, see note below*.
In all cases Error R (Tape loading error) if verify fails.
*This command will be accepted by the Spectrum but taped SCREEN$ code will fail verification.
The ZX80 and ZX81 cannot verify code.
Verify saved array data
i) VERIFY f$ DATA a()
ii)VERIFY f$ DATA a$()
Result i: Compare saved numeric array a with filename f$ with that in memory.
Result ii: Compare character array a with filename f$ with that in memory.
In both cases Error R (Tape loading error) if verify fails.
ZX Spectrum only.
Nomenclature
This list uses the same letters to represent variables, expressions and sequences etc. as the ZX81 and ZX Spectrum BASIC manuals.
α,β represents a single letter
v represents a variable
x,y,z represents numerical expressions
m,n represents numerical expressions rounded to the nearest integer
b represents a 16 bit binary number
e represents an expression
f represents a string valued expression
s represents a sequence of statement separated by colons :
c represents a sequence of colour items, each terminated by commas , or semi-colons ; A color item has the form of a PAPER, INK, FLASH, BRIGHT, INVERSE or OVER statement.
References
Sinclair ZX81 BASIC Programming, Steven Vickers (author)
Sinclair ZX Spectrum BASIC Programming, Steven Vickers (author), Robin Bradbeer (editor)
"SAVED!", Your Computer, May 1983 p.65