User`s guide

Source files under CP/M 3 are treated as a sequence of ASCII characters, where
each line of the source file is followed by a carriage return line-feed sequence, ODH
followed by OAH. Thus a single 128-byte record could contain several lines of source
text. The end of an ASCII file is denoted by a CTRL-Z character, 1AH, or a real end
of file, returned by the BDOS read operation. CTRL-Z characters embedded within
machine code files such as COM files are ignored. The actual end-of-file condition
returned by the BDOS is used to terminate read operations.
2.3.3 File Control Block Definition
The File Control Block, FCB, is a data structure that is set up and initialized by a
transient program, and then used by any BDOS file access and directory functions
called by the transient program. Thus the FCB is an important channel for informa-
tion exchange between the BDOS and a transient program. For example, when a
program opens a file, and subsequently accesses it with BDOS read and write record
functions, the BDOS file system maintains the current file state and position within
the program's FCB. Some BDOS functions use certain fields in the FCB for invoking
special options. Other BDOS functions use the FCB to return data to the calling
program. In addition, all BDOS random I/O functions specify the random record
number with a 3-byte field at the end of the FCB.
When a transient program makes a file access or directory BDOS function call,
register pair DE must address an FCB. The length of the FCB data area depends on
the BDOS function. For most functions, the required length is 33 bytes. For random
I/O functions, the Truncate File function, and the Compute File Size function, the
FCB length must be 36 bytes. The FCB format is shown on the next page.
2-13
2.3 BDOS File System CP/M 3 Programmer's Guide