Purpose: Search tables for given SA
Call address: $FF5C (hex) 65372 (decimal)
Preparation:
Registers: .Y = SA (secondary address) Memory: system map Flags: none Calls: noneResults:
Registers: .A = LA (only if found) .X = FA (only if found) .Y = SA (only if found Memory: none Flags: .C = 0 if found .C = 1 if not found
Description: LKUPSA is a Kernal routine used primarily by BASIC DOS commands to work around a user's open disk channels. The Kernal requires unique logical device numbers (LA's), and the disk requires unique secondary addresses (SA's); therefore BASIC must find alternative unused values whenever it needs to establish a disk channel.
EXAMPLE:
LDY #$60 ;find an available SA AGAIN INY CPY #$6F BCS TOO_MANY;too many files open JSR $FF5C ;LKUPSA BCC AGAIN