-
Notifications
You must be signed in to change notification settings - Fork 8
BASIC LOAD Statement
TYPE: USB BASIC disk statement
FORMAT: LOAD filespec
Action: Loads tokenized BASIC program in CAQ format to memory.
- filespec is a string expression containing an optional path and the full file name.
- plusBASIC will attempt to auto-detect the program file format.
- If a CAQ header is detected, the program will be loaded accordingly.
- Bad file error will result if the CAQ header is invalid.
- If no CAQ header is found, load checks to see if the file is in TOK format.
- A TOK file contains the binary tokenized program minus the CAQ header and trailer.
- If neither of the above formats are detected, the file is assumed to be ASCII.
- If the file is not in ASCII format, the results will be unpredictable.
- The maximum length of any one line is 255 characters.
- Any blank lines (empty or all spaces) in the file will be ignored.
-
Undefined line number error will result if a line
- has no line number
- has a line number less than or equal to the previous line number
- is longer than 255 characters
- Input past end error will result if the file is empty (a size of 0 bytes)
- If a CAQ header is detected, the program will be loaded accordingly.
Examples:
LOAD "demo.baq"
Loads BASIC program file
demo.baq
in current directory into memory.
LOAD "/subdir/prog.baq"
Loads BASIC program file
prog.baq
in subdirectorysubdir
into memory.
LOAD "/main.baq"
Loads BASIC program file
main.baq
in root directory into memory.
LOAD "source.bas"
Tokenizes ASCII file
source.bas
in current directory into BASIC program in memory.
FORMAT: LOAD filespec , * arrayvar
Action: Loads CAQ formatted numeric array file into BASIC array.
- 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 may be a numeric array.
- The array must be explicitly declared with a DIM statement before loading into it.
- A numeric array contains binary data with a length of 4 times the total number of elements bytes.
- A file containing too much array data will be truncated to fit in the array.
- The array may be a numeric array.
-
?Bad file
results if file is not array data in CAQ format.
Examples:
DIM A(99)
LOAD "data.arry",*A
Loads contents of array file
data.arry
into numeric array A().
FORMAT: LOAD filespec , address
Action: Loads contents of binary file into memory.
- 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 loaded to.
- Error 50,
File not found
results if the file does not exist. (as of v0.17f)
Example:
LOAD "capture.scr",12288
Loads the file
capture.scr
into SCREEN RAM.
FORMAT: LOAD filespec , @page , address
Action: As above, but loads the file into paged memory.
- page is a number in the range 0 through 255 that specified the memory page to load the file into.
- address is a number in the range 0 through 16383 that specified the starting address in the page.
- The load rolls over to the next page(s) as needed.
- Error 5,
Illegal quantity
results if either page or address is not within it's respective range, or if the specified range is not RAM. - Error 6,
Overflow
results if the file overflows the end of page 20, 21, or 63. - Error 50,
File not found
results if the file does not exist. (as of v0.17f)
FORMAT: LOAD filespec , ^ stringvar
Action: Loads text file into a string variable.
- filespec is a string expression containing an optional path and the full file name.
- stringvar is a string variable name.
- Up to the first 255 characters will be loaded into the string.
Examples:
DIM G$(2,12)
LOAD "text.arry",*G$
Loads contents of array file
text.arry
into string array G$().
FORMAT: LOAD filespec , * arrayvar
Action: Loads binary string file into a string array.
- filespec is a string expression containing an optional path and the full file name.
-
arrayvar is a string array variable name with no subscripts.
- The array must be explicitly declared with a DIM statement before loading into it.
- A file containing too much array data will be truncated to fit in the array.
- The array will be padded with "" elements if the data does not fill the array.
Examples:
DIM G$(2,12)
LOAD "text.arry",*G$
Loads contents of array file
text.arry
into string array G$().
FORMAT: LOAD filespec , * arrayvar , ASC
Action: As above but loads an ASCII text file into the array.
- The file contents are loaded into the array starting at index 1.
- Index 0 will contain the number of lines read as a decimal string.
Examples:
DIM T$(20)
LOAD "text.txt",*T$
Loads up to 20 line of ASCII file
text.txt
into array T$.
FORMAT: LOAD BITMAP filespec
Action: Loads bitmap file into Video RAM.
- Error 49,
Bad file
results if the file is not a valid bitmap file. - Error 50,
File not found
results if the file does not exist.
See also: Bitmap Files.
To Search for pages in the wiki, press Pages above and type a search term in the "Find a page..." box. Results will update beneath automatically.
- Aquarius+ User Guide
- Quick Start
- Hardware
- Software
-
Other Development Resources