in BASIC ROM:
|List of all BASIC keywords|
Typ: Statement General Programming-Syntax: SAVE ["<filename>"] [,<device number>] [,<secondary number>]
A written BASIC or computer code program, which exists in temporary RAM-memory, can be saved with the BASIC command SAVE permanently to a storage device such as a datasette, diskdrive or harddisk as a filetype program (PRG). The Command SAVE can also be used in BASIC programs.
For saving programs on diskdrive or harddisk, a filename must be entered; however, a filename isn't required for saving on datasette. For finding of files faster and easier on datasette, it is useful to use filenames when saving programs. Programs which are saved on datasette will be saved twice. This is used for VERIFYING (look VERIFY).
The device number specifies the attached storage device:
- datasette (device number 1)
- diskdrives (device numbers 8-11, optional first diskdrive 8, second diskdrive 9, etc.)
If a device number isn't provided, the default will be 1 (datasette).
The secondary number determines how the program is saved:
- 0 The program will be saved as BASIC program
- 1 The program will be saved absolute. Needed for computer code programs.
- 2 Is only needed with the datasette for writing the "end of tape" (EOT) marker.
If a secondary number isn't provided, the default will be 0.
If the filename already exists on disk, the save command will not work even though no error is indicated on screen. To do a "save and replace", prefix the filename with "@0:" (example below).
To ensure that the current program was correctly saved, use the VERIFY statement.
Examples[edit | edit source]
(anonymous writing as BASIC program on a datasette)
(save as BASIC program with filename on datasette)
(save as BASIC program with charstring FILE$ on datasette with marker "end of tape")
(save a program with filename on secondary diskdrive 9 absolute)
(save BASIC program as FILENAME to disk, replacing file if it already exists.)
10 REM tool at tape / cassette 20 SAVE "THISPROGRAMM",8: REM SAVING ON DISK 30 REM the program continued