This the multi-page printable view of this section.Click here to print.

Return to the regular view of this page.

LOAD

Load memory from a device

Table of Contents

Function AddressVectorDescription
LOAD FFD50330Load memory from a device

This routine LOADs data bytes from any input device directly into the memory. It can also be used for a verify operation, comparing data from a device with the data already in memory, while leaving the data stored in RAM unchanged.

To use, you first need to call SETLFS to set the device to save to. Then SETNAM must be called to set the filename.

The accumulator must be set to 0 for a load or 1 for a verify operation.

If the input device is opened with a secondary address of 0, the header information from the device is ignored. In this case the X & Y registers must contain the starting address for the load.

With a secondary address of 1 the data is loaded into memory starting at the location specified by the header.

This routine returns the highest address of the data loaded on exit.

You cannot load from devices 0 (keyboard), 2 (RS-232) or 3 (Screen).
Example:
fileNameEQUS"TESTCARD"Filename to load
fileNameEnd
loadFileLDA#8Logical File Number
LDX#8Device 8 = Disk
LDY#1Secondary address 1 = Use address stored in the file
LDA#fileNameEnd-fileNamelength of fileName
LDX#<fileNameAddress if fileName
LDY#>fileName
LDA#00=Load operation
JSRLOAD
STXendAddressOptional, save address after the loaded data
STYendAddress+1
RTS
endAddressEQUW0Address after our loaded data