User`s guide
2.3.12 File Byte Counts
Although the logical record size of CP/M 3 is restricted to 128 bytes, CP/M 3 does
provide a mechanism to store and retrieve a byte count for a file. This facility can
identify the last byte of the last record of a file. The BDOS Compute File Size
function returns the random record number, plus 1, of the last record of a file.
The BDOS Set File Attributes function can set a file's byte count. Conversely, the
Open function can return a file's byte count to the cr field of the FCB. The BDOS
Search and Search Next functions also return a file's byte count. These functions
return the byte count in the sl field of the FCB returned in the current DMA buffer
(see BDOS Functions Returned 17 and 26).
Note that the file system does not access or update the byte count value in file read
or write operations. However, the BDOS Make File function does set the byte count
of a file to zero when it creates a file in the directory.
2.3.13 BDOS Error Handling
The BDOS file system responds to error situations in one of three ways:
Method 1. It returns to the calling program with return codes in register
A, H, and L identifying the error.
Method 2. It displays an error message on the console, and branches to
the BIOS warm start entry point, thereby terminating execu-
tion of the calling program.
Method 3. It displays an error message on the console, and returns to
the calling program as in method 1.
The file system handles the majority of errors it detects by method 1. Two examples
of this kind of error are the file not found error for the open function and the reading
unwritten data error for a read function. More serious errors, such as disk I/O errors,
are usually handled by method 2. Errors in this category, called physical and extended
errors, can also be reported by methods 1 and 3 under program control.
2-28
2.3 BDOS File System CP/M 3 Programmer's Guide