Chapter Thirteen


A formatted subset of the data in the Directory can be read as if the Directory were a disk file. This is accomplished by using the open directory code ($02) in the IOCB ICAUX1 byte. When FMS recognizes this code in the Open routine (at $8B1), it will go directly to the LISTDIR routine. The LISTDIR routine prepares the FCB for reading the directory as a file. The GET BYTE routine will recognize the read directory condition from information stored in the FCBOTC field (see $AC2) and go directly to the directory read character I/O routine GDCHAR.

Address $DAD
Entry Registers  
A = Don't Care.
X = IOCB and FCB number times 16.
Y = Don't Care.
Exit Registers    
A = Unknown.
X = Unknown.
Y = Unknown.


1) The TEMP4 byte is used to count the characters that have been transmitted by GDBYTE from the formatted line buffer. LISTDIR sets this value to zero to indicate the start of a new formatted line.
2) The SFDIR routine is called to start a wild card search for the file name in the directory.
3) If a match is found then FDENT is called to format the entry and prepare for the GDBYTE calls. Exit via GREAT.
4) If a match is not found, then LDCNT is called to prepare to send the xxx FREE SECTORS line.
GDCHAR ($DB9) is entered from GET BYTE to get a single data byte from a formatted directory line.
1) The TEMP4 flag is tested. If the value is negative, then all formatted information has been transmitted. Exit is via the ERREOF (end-of-file error) exit.
2) The value in TEMP4 is used as an index into the formatted line buffer to get the next character. The character is placed into SVDBYT for loading into the A register by the RETURN routine.
3) The character retrieved from the buffer is examined for the EOL ($9B) character.
4) If the character is not an EOL, then exit is via GREAT.
5) If the character was an EOL, then the line length is examined to see if the line was a directory entry line (i.e., if the length was 17) or the final xxx FREE SECTORS.
6) If the line was the final line, then TEMP4 is set to a negative value ($80) to indicate that all formatted lines have been sent. Exit is via GREAT.
7) If the line was not the final line, then CSFDIR is called to find the next matching file name.
8) If a file name match is found, then FDENT is called to format the found entry into the formatted line buffer. Exit is via GREAT.
9) If a file name match is not found, then go to LDCNT to format the final line.
LDCNT ($DE9) formats the final line of a directory read.
1) Read the VTOC.
2) Get the free sector count from the VTOC and convert it to ATASCII via the CVDX routine.
3) Move the FREE SECTORS message to the formatted line buffer.
4) EXIT is via FGREAT.
The FDENT ($E21) routine formats the current directory entry into the formatted line buffer for subsequent reading by GDBYTE.
1) The directory flag is checked for the file locked condition. If the file is locked, then the “*” is placed in the formatted line.
2) The file name is moved from the directory entry to the formatted line.
3) The file sector count is converted to ATASCII and placed in the formatted line.
4) The EOL character is placed in the formatted line.
5) Exit is via the RTS instruction.

Return to Table of Contents | Previous Chapter | Next Chapter