Skip to content

BASIC SAVE and APPEND Statements

Curtis F Kaylor edited this page Jan 20, 2025 · 2 revisions

SAVE and APPEND

TYPE: plusBASIC disk statement


FORMAT: SAVE filespec

Action: Saves tokenized BASIC program in BAQ format to SD card.

  • filespec is a string expression containing an optional path and the full file name.

Examples:

SAVE "demo.baq"

Saves BASIC program file demo.baq from memory into current directory.

SAVE "/subdir/prog.baq"

Saves BASIC program file prog.baq from memory into subdirectory subdir.

SAVE "/main.baq"

Saves BASIC program file main.baq from memory into root directory.


FORMAT: SAVE filespec , ASC

Action: As above, but saves untokenized BASIC program to ASCII text file.

Examples

SAVE "source.bas",ASC

De-tokenizes BASIC program from memory and saves to ASCII file source.bas in current directory.


FORMAT: SAVE filespec , CAQ

Action: As above, but saves program in BAQ format even if SET SAVE ASCII ON is active.

  • The program in memory will save to a text file containing a human-readable BASIC program in ASCII format.

Examples

SAVE "source.baq",CAQ


FORMAT: SAVE filespec , TOK

Action: As above, but saves program as tokenized file without CAQ header.

Examples

SAVE "source.bas",TOK


FORMAT: SAVE filespec , * arrayvar

Action: Saves a BASIC array to a file on the SD card.

  • filespec is a string expression containing an optional path and the full file name.
  • arrayvar is the array variable name with no subscripts.
    • The array must be explicitly declared with a DIM statement before saving it.
    • A numeric array contains binary data with a length of 4 times the total number of elements bytes.
    • A string array is saved as a series of one byte string lengths each followed by the string text (if any).

Examples:

DIM A(99)
SAVE "data.arry",*A

Saves contents of numeric array A() from memory to file data.arry to SD card.

DIM G$(2,12)
SAVE "text.arry",*G$

Saves contents of string array G$() from memory to file text.arry to SD card.


FORMAT: SAVE filespec , * arrayvar, ASC

Action: As above but saves a string array as an ASCII file.

  • Type mismatch error results if arrayvar is not a string array.
  • The lines in the file are delimited with carriage return followed by line feed.

FORMAT: SAVE filespec , ^ stringvar

Action: Writes the contents of the specified string variable to a file.

  • filespec is a string expression containing an optional path and the full file name.
  • stringvar is the string variable name.

FORMAT: APPEND filespec , ^ stringvar

Action: As above but appends the contents of the string variable to the end of the file.


FORMAT: SAVE filespec , address, length

Action: Saves contents of memory to a binary file.

  • filespec is a string expression containing an optional path and the full file name.
  • address is the starting location in memory that the file will be saved from.
  • length is the number of bytes to save.

Example: SAVE"capture.scr",12288, 2048

Saves the SCREEN/COLOR RAM to a file named capture.scr on the SD card.


FORMAT: APPEND filespec , address, length

Action: As above, but appends the contents of memory to the end of the binary file.


FORMAT: SAVE filespec , @page , address, length

Action: As above, but saves paged memory to a file.

  • page is a number in the range 0 through 255 that specified the memory page to save the file from.
  • address is a number in the range 0 through 16383 that specified the starting address in the page.
  • length is the number of bytes to save.

FORMAT: SAVE filespec , !ext_addr

Action: As above, but saves paged memory to a file.

  • ext_addr is a number in the range 0 through 524288 that specified the starting address in paged memory.
  • length is the number of bytes to save.

SAVE SCREEN

TYPE: plusBASIC disk statement


FORMAT: SAVE SCREEN filespec

Action: As above, but saves the current text screen to a file.

  • In 40 column mode, the 1024 bytes each of screen RAM and color RAM are saved to the file.
  • In 80 column mode, the 2048 bytes each of screen RAM and color RAM are saved to the file.
  • Palette 0 and the border flag are also saved to the file.
Clone this wiki locally