
Everything so far has lived in the Einstein's memory, and memory forgets. OLD rescues you from a slip, but switch the machine off - or close MAME - and the program is gone for good.
The disc does not forget. This section puts your program on it, by name, and gets it back.
SAVE "FIRST"
writes the program in memory to the disc, in a file called FIRST. The name goes in double quotes. BBC BASIC says nothing - the > comes back when it has finished - and the program is still in memory, exactly as it was.
Saving again under the same name replaces the old file, without asking. That is what you want when you are saving your progress on the same program; it is not what you want if the name belonged to something else. Pick names you will recognise.
LOAD "FIRST"
reads the program back into memory, replacing whatever was there. Again, nothing is printed. LIST to see it, RUN to run it.
A name BBC BASIC cannot find on the disc gets File not found.
*DIR
lists your programs. The star at the front tells BBC BASIC this is a command for the disc rather than a line of BASIC. On the course disc, with FIRST saved, you see:
0: FIRST .BBC :*ANIMAL .BBC
The 0: is the drive. .BBC is added to every program's name when it is saved, so you never type it. A star in front of a name means the file is locked - it can be read, but not overwritten without a question first. ANIMAL, the 1984 game on the disc, is locked, and that is deliberate.
*DIR *.* lists everything on the disc, not just programs - BBC BASIC itself is there, as BBCBASIC.COM.
*REN FIRST TO SECOND
renames a program, and
*ERA SECOND
erases one. Neither says anything when it has worked. *ERA has no OLD: an erased program is gone.
10 PRINT "THIS PROGRAM WAS SAVED"
20 PRINT "AND LOADED BACK"
Type the two lines, then:
SAVE "FIRST"
NEW
LIST
LOAD "FIRST"
LIST
RUN
*DIR
Starting from
A fresh boot on the course disc.
What you should see
The first LIST shows nothing - NEW has cleared memory. The second shows the program again, loaded from the disc, and RUN runs it:
>RUN
THIS PROGRAM WAS SAVED
AND LOADED BACK
>*DIR
0: FIRST .BBC :*ANIMAL .BBC

Now restart the Einstein - close MAME and start it again, or switch off - start BBC BASIC, and type LOAD "FIRST" and RUN. It is still there.
LOAD "FRIST", with the letters swapped. What does BBC BASIC say?SAVE "FIRST" again, then NEW and LOAD "FIRST". Which version do you get back, and did BBC BASIC warn you?*DIR *.*. What is on the disc that *DIR did not show you?6.1 Save the same program under a second name, SECOND, and check with *DIR that both are there.
6.2 Rename SECOND to THIRD, and check.
6.3 Erase THIRD, and check.
Worked solutions are in Appendix II.
| Symptom | Cause |
|---|---|
File not found | The name is not on the disc - a typing slip, usually. *DIR shows what is. |
No such variable after SAVE | You left out the quotes. SAVE "FIRST", not SAVE FIRST. |
Bad command after *ERA | There is no file of that name to erase. |
File Lock, Drive 0: and Unlock(Y/N)? | You tried to save over a locked file - on the course disc, that means you typed SAVE "ANIMAL". Answer N: you drop out to 0:, but type BBCBASIC and then OLD and your program is back; save it under another name. Answering Y unlocks ANIMAL and overwrites it with your program, and the 1984 game is lost. |
Bad Data, Drive 0: and Try Again(Y/N)? | You are running from a .dsk image, which MAME will not write to (S2). N, then BBCBASIC and OLD, and restart with the course disc. |
| The program you loaded is not the one you were working on | LOAD replaces what is in memory. Save first. |
SAVE "NAME" puts the program on the disc and LOAD "NAME" brings it back, even after a restart. *DIR shows what is there, *REN renames and *ERA erases. Saving over a name replaces it without asking; a locked file asks, and the answer should be N.
S7, Sums - BBC BASIC as a calculator, and how it shows the numbers it works out.