CP/M File Control Block
The File Control Block is a 36-byte data structure (33 bytes in CP/M 1). It is laid out as
follows:
DR F1 F2 F3 F4 F5 F6 F7 F8 T1 T2 T3 EX S1 S2 RC .FILENAMETYP...
AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL ...............
CR R0 R1 R2 ....
The bytes in it have the following meanings:
FCB+00h DR - Drive. 0 for default, 1-16 for A-P.
FCB+01h Fn - Filename, 7-bit ASCII. The top bits of the filename bytes
(usually referred to as F1' to F8') have the following
meanings:
F1'-F4' - User-defined attributes. Any program can use
them in any way it likes. The filename in the
disc directory has the corresponding bits set.
F5'-F8' - Interface attributes. They modify the
behaviour of various BDOS functions or
indicate error conditions. In the directory
these bits are always zero.
FCB+09h Tn - Filetype, 7-bit ASCII. T1' to T3' have the following
meanings:
T1' - Read-Only.
T2' - System (hidden). System files in user 0 can be
opened from other user areas.
T3' - Archive. Set if the file has not been changed
since it was last copied.
FCB+0Ch EX - Set this to 0 when opening a file and then leave it to
CP/M. You can rewind a file by setting EX, RC and CR to 0.
FCB+0Dh S1 - Reserved.
FCB+0Eh S2 - Reserved.
FCB+0Fh RC - Set this to 0 when opening a file and then leave it to
CP/M.
FCB+10h AL - Image of the second half of the directory entry,
containing the file's allocation (which disc blocks it
owns).
FCB+20h CR - Current record within extent. It is usually best to set
this to 0 immediately after a file has been opened and
then ignore it.
FCB+21h Rn - Random access record number (not CP/M 1). A 16-bit
value in CP/M 2 (with R2 used for overflow); an 18-bit
value in CP/M 3.