[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]

B-15. Function Name: LOAD

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:

  1. Call the SETLFS, and SETNAM routines. If a relocated load is desired, use the SETLFS routine to send a secondary address of 0.
  2. Set the A register to 0 for load, 1 for verify.
  3. If a relocated load is desired, the X and Y registers must be set to the start address for the load.
  4. Call the routine using the JSR instruction.

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   ;

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated December 16, 2002.