Purpose: Load RAM from device
Call address: $FFD5 (hex) 65493 (decimal)
Communication registers:A, X, Y
Preparatory routines: SETLFS, SETNAM
Error returns: 0,4,5,8,9, READST
Stack requirements: None
Registers affected: A, X, Y
Description: This routine LOADs data bytes from any input device di- rectly into the memory of the Commodore 64. 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.
The accumulator (.A) must be set to 0 for a LOAD operation, or 1 for a verify, If the input device is OPENed with a secondary address (SA) of 0 the header information from the device is ignored. In this case, the X and Y registers must contain the starting address for the load. If the device is addressed with a secondary address of 1, then the data is loaded into memory starting at the location specified by the header. This routine returns the address of the highest RAM location loaded.
Before this routine can be called, the KERNAL SETLFS, and SETNAM routines must be called.
| NOTE: You can NOT LOAD from the keyboard (0), RS-232 (2), or the screen (3). |
How to Use:
EXAMPLE:
;LOAD A FILE FROM TAPE
LDA #DEVICE1 ;SET DEVICE NUMBER
LDX #FILENO ;SET LOGICAL FILE NUMBER
LDY CMD1 ;SET SECONDARY ADDRESS
JSR SETLFS
LDA #NAME1-NAME ;LOAD A WITH NUMBER OF
;CHARACTERS IN FILE NAME
LDX #<NAME ;LOAD X AND Y WITH ADDRESS OF
LDY #>NAME ;FILE NAME
JSR SETNAM
LDA #0 ;SET FLAG FOR A LOAD
LDX #$FF ;ALTERNATE START
LDY #$FF
JSR LOAD
STX VARTAB ;END OF LOAD
STY VARTA B+1
JMP START
NAME .BYT 'FILE NAME'
NAME1 ;