in BASIC ROM:
|List of all BASIC keywords|
Type: Command General programming syntax: LOAD ["<filename>"] [,<device number>] [,<secondary number>]
The BASIC command LOAD is used for loading program files (PRG) like BASIC or machine language programs from datasette or disk drive into RAM. This must happen before a stored program can be edited or started and executed with the BASIC command RUN.
The device number instructs the computer which storage device to access, using the following scheme:
- datasette - device number 1
- disk drives - device numbers 8-15, optional first disk drive 8, second disk drive 9, etc
If no device number is given, the computer defaults to device 1, i.e. datasette.
The filename parameter can be used to load a specific file. In this context certain characters (e.g. *, ? or $) have special meanings. Examples:
LOAD "*",8 loads the first file LOAD "A*",8 loads the first file whose name begins with A LOAD "A*C",8 loads the first file whose name begins with A and ends with C, with any or no included characters. LOAD "A?C",8 loads the first file whose name consist of the three letters, where the first letter is A and the last is C. The ? is a wildcard which matches any single char LOAD "$",8 loads the disk directory
The "secondary number" specifies how the data should be loaded:
,0 The program will be loaded to the start of BASIC memory (2049/$0801) ,1 The program will be loaded absolute, i.e. to its stored location defined by the first two bytes in the binary file. Needed for machine language programs.
If this is not specified, the default value 0 is used.
As the command LOAD is entered directly, all open files will be closed and the BASIC-Command CLR will be executed in the background. If LOAD is called from a BASIC program the stack is not deleted - after loading the file, the BASIC-command RUN will be executed in the background.
LOAD command executed in direct mode always changes SOV (start-of-variables) pointer. If ML program is loaded without relocation, SOV will point directly below it which will result in BASIC memory errors - to fix this, CLS and NEW commands should be executed after LOAD.
A user can easily load from a datasette by holding RAM after some delay. The delay can be skipped by pushing the key although the key is more frequently used. While loading a file from datasette the screen will be switched off so the VIC will not interfere with the data transfer which is processed directly by the CPU. The screen remains switched on while loading from other storage devices since transfers are handled by the CIA chips.while pushing . After that he can be push the button on the datasette and the first file will be searched. After a few seconds the name of the located file will be printed on screen with the message "FOUND filename", before being loaded into
If the BASIC error message "?FILE NOT FOUND" appears then the filename didn't exist or isn't a program file.
(loads a program from the first disk-drive 8)
(loads a program absolute from the second disk drive 9)
(loads a program with file name stored in the string FILE$ absolute from datasette)