Chapter Eighteen

READ
NEXT
SECTOR


The read next sector routine, RDNXTS, reads the next sector in the file sector chain into the sector buffer. If there are no more sectors in the chain, then the routine returns with the carry set to indicate end-of-file. If the routine returns with the carry clear, then the next sector has been read.

RDNXTS
Address — $100F
Entry Registers —  
A = Don’t Care.
X = IOCB and FCB number times 16.
Y = Don’t Care.
Exit Registers —   
A = Unknown.
X = IOCB and FCB number times 16.
Y = Unknown.

Functions:

1) If the file has been opened for Update, then WRTNXS is called to write the current sector if it has been modified.
2) If the FCB link sector number field, FBCLSN, is zero then there are no further sectors to read. Return to the caller with the carry set to indicate that the end-of-file has been reached.
3) Call MVLSN to move the FCB link sector number field, FCBLSN, the FCB current sector number field, FCBCSN.
4) Call RWCSIO with the carry set to read the next sector.
5) If the I/O operation was bad, exit via the ERRIO exit (I/O error).
6) Insure that the file number in the sector just read agrees with the file number in the FCB. If the file numbers are not the same, exit via the ERFNMM exit (file number mismatch). Note: if the routine was called by delete, return to delete indicating end-of-file.
7) Move the link sector number from the data sector to the FCB link sector field in the FCB, FCBLSN.
8) Move the sector data length information from the data sector to the FCB maximum data length field, FCBMLN.
9) Reset the FCB data length field, FDBDLN, to zero.
10) Return to the caller with the carry clear to indicate that a sector has been read.

Return to Table of Contents | Previous Chapter | Next Chapter