WRITE
NEXT
SECTOR
The write next sector routine, WRTNXS, is used to write a data sector to disk.
Address — $F94
|
|
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, and the sector has not been modified, then do not write the sector. Read the next data sector and then return to caller.
2) If the file has been opened for update, and the sector has been modified, then write the current sector. Read the next data sector into the sector buffer and return to the caller.
3) It the file is not opened for update, then allocate a new sector to the file by calling GETSECTOR.
4) Move the sector byte count from the FCB FCBDLN field to the data sector byte count field.
5) Move the address of the newly acquired sector from the FCB FCBLSN field into the link field of the current data sector.
6) Write the current sector to the disk via WRCSIO.
7) If the I/O was bad, mark the FCB by placing a zero value into FCBOTC as closed and exit via RETURN with the I/O error number as the return code.
8) If the I/O was good, then increment the FCB sector counter field, FCBCNT.
9) Call MVLSN to move the sector number of the link sector number field of the FCB, FCBLSN, to the current sector number field of the FCB, FCBCSN.
10) Set the current data length field of the FCB, FCBDLN, to zero.
11) Set the maximum data length field of the FCB, FCBMLN, to 125 (if 810 drive) or 253 (if 815 drive).
12) Return to user via the RTS instruction.
Return to Table of Contents | Previous Chapter | Next Chapter