Purpose: Open logical file
Call address: $FFC0 (hex) 65472 (decimal)
Registers: none Memory: system map Flags: none Calls: SETLFS, SETNAM, SETBNKResults:
Registers: .A = error code (if any) .X used .Y used Memory: setup for I/O STATUS, RSSTAT updated Flags: .C = 1 -> error
Description: OPEN prepares a logical file for I/O operations.
It creates a unique entry in the Kernal logical file tables LAT ($362), FAT ($36C) and
SAT ($376) using its index LDTND ($98) and data supplied by the user via SETLFS.
There can be up to then logical files OPENed simultaneously. OPEN performs device-specific
opening tasks for serial, cassette and RS-232 devices, including clearing the previous
status and transmitting any given filename or command string supplied by the user via
SETNAM and SETBNK. The I/O status is updated appropriately and can be read via READST.
The path to OPEN is through an indirect RAM vector at $31A. Applications may therefor provide their own OPEN procedures or supplement the system's by redirecting this vector to their own routine.
EXAMPLE: OPEN 1,8,15,"IO"
LDA #length ;fnlen LDX #
filename JSR $FFBD ;SETNAM LDX #0 ;fnbank (RAM0) JSR $FF68 ;SETBNK LDA #1 ;la LDX #8 ;fa LDY #15 ;sa JSR $FFBA ;SETLFS JSR $FFC0 ;OPEN BCS error filename .BYTE 'IO' length = 2