BASIC Commands | |
---|---|
LOAD | Retrieve a file from a device. |
SAVE | Store a file to a device. |
VERIFY | Verify that a file is written properly. |
OPEN | Open a communications channel. |
CLOSE | Close a communications channel. |
CMD | Redirect standard output to a channel. |
GET# | Get a byte of data from a channel. |
INPUT# | Get bytes from a channel. |
PRINT# | Write bytes to a channel. |
KERNAL Routines | |
---|---|
SETNAM | Set name of a file or channel. |
SETLFS | Device selection and options. |
LOAD | Retrieve or verify a file from a device. |
SAVE | Store a file to a device. |
OPEN | Open a channel. |
CLOSE | Close a channel. |
CLALL | Close all channels. |
CHKIN | Set a channel to input mode. |
CHKOUT | Set a channel to output mode. |
CHRIN | Get a byte from a channel. |
CHROUT | Write a byte to a channel. |
READST | Read I/O status. |
File Types |
---|
SEQ Sequential data |
PRG Program file |
Preparation | SETLFS, SETNAM | |
Send | .A | 0 for LOAD, 1 for VERIFY |
.X | Low byte of loading address (if opened w/relocation) | |
.Y | High byte of loading address (if opened w/relocation) | |
Stack usage | 0 | |
Address | $FFD5, 65493 | |
Returns | .A | undefined |
.X | Low byte of ending address | |
.Y | High byte of ending address |
Preparation | SETLFS, SETNAM | |
Send | .A | Zero-page location of Starting Address pointer |
.X | Low byte of Ending Address | |
.Y | High byte of Ending Address | |
Stack usage | 0 | |
Address | $FFD8, 65496 | |
Returns | .A | undefined |
.X | undefined | |
.Y | undefined |
Preparation | SETLFS, SETNAM | |
Send | .A | ignored |
.X | ignored | |
.Y | ignored | |
Stack usage | 0 | |
Address | $FFC0, 65472 | |
Returns | .A | undefined |
.X | undefined | |
.Y | undefined |
Preparation | none | |
Send | .A | Length of filename |
.X | Low byte of address of filename | |
.Y | High byte of address of filename | |
Stack usage | 2 | |
Address | $FFBD, 65469 | |
Returns | .A | preserved |
.X | preserved | |
.Y | preserved |
Preparation | none | |
Send | .A | File number |
.X | Device unit number | |
.Y | Secondary address or Command ($FF for no value) | |
Stack usage | 2 | |
Address | $FFBA, 65466 | |
Returns | .A | preserved |
.X | preserved | |
.Y | preserved |
Preparation | OPEN
| |
Send | .A | File number |
.X | ignored | |
.Y | ignored | |
Stack usage | 2 | |
Address | $FFC3, 65475 | |
Returns | .A | undefined |
.X | undefined | |
.Y | undefined |
Preparation | [OPEN] | |
Send | .A | ignored |
.X | ignored | |
.Y | ignored | |
Stack usage | 11 | |
Address | $FFE7, 65511 | |
Returns | .A | undefined |
.X | undefined | |
.Y | preserved |
Preparation | OPEN
| |
Send | .A | ignored |
.X | File number | |
.Y | ignored | |
Stack usage | 0 | |
Address | $FFC6, 65478 | |
Returns | .A | undefined |
.X | undefined | |
.Y | reserved |
Preparation | OPEN | |
Send | .A | ignored |
.X | File number | |
.Y | ignored | |
Stack usage | 4+ | |
Address | $FFC9, 65481 | |
Returns | .A | undefined |
.X | undefined | |
.Y | preserved |
Preparation | [OPEN, CHKIN] | |
Send | .A | ignored |
.X | ignored | |
.Y | ignored | |
Stack usage | 7+ | |
Address | $FFCF, 65487 | |
Returns | .A | Retrieved byte |
.X | undefined | |
.Y | preserved |
Preparation | [OPEN, CHKOUT] | |
Send | .A | Byte to send |
.X | ignored | |
.Y | ignored | |
Stack usage | 8+ | |
Address | $FFD2, 65490 | |
Returns | .A | undefined |
.X | preserved | |
.Y | preserved |
Preparation | none | |
Send | .A | ignored |
.X | ignored | |
.Y | ignored | |
Stack usage | 2 | |
Address | $FFB7, 65463 | |
Returns | .A | Status code |
.X | preserved | |
.Y | preserved |
A sequential file is simply a list of bytes. When a SEQ file is opened for reading, the bytes from beginning to end will be consecutively loaded into the computer with each GET# or INPUT# command. When it is opened for writing, the PRINT# command will tack its output bytes after each other sequentially in the file.
These files work exactly the same as sequential files, but the operating system looks at PRG files a little
differently. The first two bytes in the file give the address to load the program to, and the remaining bytes are the
program data to be loaded at that address. If the LOAD
command is used with the ,1
option,
this address is used to locate the loading point in memory. If it is omitted, the computer will load the file at the
start of BASIC memory, usually $0801 (2049). The advantage of using PRG files over plain SEQ is that you can store
the data as well as the address to be loaded to into the file, and ask the operating system to take care of the loading
and storing into right place in memory.
You can treat SEQ files as PRG files by adding ,S
to the end of the filename. For example,
SAVE"PRG1,S",8
will save a SEQ file which is laid out like a PRG file: with the address at the beginning of
the program. Likewise, LOAD"PRG1,S",8,1
will load the saved data back into its place in memory. Take care
not to load SEQ files that do not have an address header, or the data will load in an unexpected location, probably
crashing your computer.