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

Return to the regular view of this page.

SETLFS

Setup a logical file

Table of Contents

Function AddressDescription
SETLFS FFBASetup a logical file

This routine sets the logical file number, device address, and secondary address (command number) for other KERNAL routines.

The logical file number is used by the system as a key to the file table created by the OPEN file routine. Device addresses can range from 0 to 31. The following codes are used by the Commodore 64 to stand for the CBM devices listed below:

Address Device
0 Keyboard
1 Cassette / Datassette
2 RS232
3 Screen
4 Printer
8 Disk drive
9 Disk drive

Device numbers 4 or greater automatically refer to devices on the serial bus.

A command to the device is sent as a secondary address on the serial bus after the device number is sent during the serial attention handshaking sequence. If no secondary address is to be sent, the Y index register should be set to 255.

Example:
LDA#15Logical file number
LDX#8Device number, 8 = disk
LDY#15Secondary address
JSRSETLFSSetup logical file