User`s guide
BDOS FUNCTION 15: OPEN FILE
Entry Parameters:
Registers C: OFH
DE: FCB Address
Returned Value:
Registers A: Directory Code
H: Physical or Extended Error
The Open File function activates the FCB for a file that exists in the disk directory
under the currently active user number or user zero. The calling program passes the
address of the FCB in register pair DE, with byte 0 of the FCB specifying the drive,
bytes 1 through 11 specifying the filename and filetype, and byte 12 specifying the
extent. Usually, byte 12 of the FCB is initialized to zero.
If the file is password protected in Read mode, the correct password must be
placed in the first eight bytes of the current DMA, or have been previously estab-
lished as the default password (see Function 106). If the current record field of the
FCB, cr, is set to OFFH, Function 15 returns the byte count of the last record of the
file in the cr field. You can set the last record byte count for a file with Function 30,
Set File Attributes. Note that the current record field of the FCB, cr, must be zeroed
by the calling program before beginning read or write operations if the file is to be
accessed sequentially from the first record.
If the current user is non-zero, and the file to be opened does not exist under the
current user number, the open function searches user zero for the file. If the file exists
under user zero, and has the system attribute, t2', set, the file is opened under user
zero. Write operations are not supported for a file that is opened under user zero in
this manner.
3-20
BDOS Function Calls CP/M 3 Programmers Guide