|
STANDARD FILE CONTROL BLOCK The standard file control block is defined as follows, with the offsets in decimal: +----------------------------------------------------------------------+ | F I L E C O N T R O L B L O C K | +-------+--------------------------------------------------------------+ | Bytes | Function | +-------+--------------------------------------------------------------+ | 0 | Drive number. For example: | | | Before open: 00h = default drive | | | 01h = drive A: | | | 02h = drive B: etc. | | | After open: 00h = drive C: | | | 01h = drive A: | | | 02h = drive B: etc. | | | 0 is replaced by the actual drive number during open. | +-------+--------------------------------------------------------------+ | 1-8 | Filename, left justified with trailing blanks. If a reserved | | | device name is placed here (such as PRN) do not include the | | | optional colon. | +-------+--------------------------------------------------------------+ | 9-11 | Filename extension, left justified with trailing blanks. | +-------+--------------------------------------------------------------+ | 12-13 | Current block number relative to beginning of file, starting | | | with 0 (set to 0 by the open function call). A block | | | consists of 128 records, each of the size specified in the | | | logical record size field. The current block number is used | | | with the current record field (below) for sequential reads | | | and writes. | +-------+--------------------------------------------------------------+ | 14-15 | Logical record size in bytes. Set to 80h by the OPEN | | | function call. If this is not correct, you must set the | | | value because DOS uses it to determine the proper locations | | | in the file for all disk reads and writes. | +-------+--------------------------------------------------------------+ | 16-19 | File size in bytes. In this 2 word field, the first word is | | | the low-order part of the size. | +-------+--------------------------------------------------------------+ | 20-21 | Date the file was created or last updated. The mm/dd/yy are | | | mapped as follows: | | | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 | | | y y y y y y y m m m m d d d d d | | | where: mm is 1-12 | | | dd is 1-31 | | | yy is 0-119 (1980-2099) | +-------+--------------------------------------------------------------+ | 22-31 | Reserved for system use. | +-------+--------------------------------------------------------------+ | 32 | Current relative record number (0-127) within the current | | | block. (See above). You must set this field before doing | | | sequential read/write operations to the diskette. This field | | | is not initialized by the open function call. | | | If the record size is less than 64 bytes, both words are | | | used. Otherwise, only the first 3 bytes are used. Note that | | | if you use the File Control Block at 5Ch in the program | | | segment, the last byte of the FCB overlaps the first byte of | | | the unformatted parameter area. | +-------+--------------------------------------------------------------+ Notes: 1) An unopened FCB consists of the FCB prefix (if used), drive number, and filename.ext properly filled in. An open FCB is one in which the remaining fields have been filled in by the CREATE or OPEN function calls. 2) Bytes 0-5 and 32-36 must be set by the user program. Bytes 16-31 are set by DOS and must not be changed by user programs. 3) All word fields are stored with the least significant byte first. For example, a record length of 128 is stored as 80h at offset 14, and 00h at offset 15. EXTENDED FILE CONTROL BLOCK The extended file control block is used to create or search for files in the disk directory that have special attributes. It adds a 7 byte prefix to the FCB, formatted as follows: +----------------------------------------------------------------------+ | E X T E N D E D F I L E C O N T R O L B L O C K | +-------+--------------------------------------------------------------+ | Bytes | Function | +-------+--------------------------------------------------------------+ | 0 | Flag byte containing 0FFh to indicate an extended FCB. | +-------+--------------------------------------------------------------+ | 1-6 | Reserved | +-------+--------------------------------------------------------------+ | 6-7 | Attribute byte. Refer to function call 11h (search first) | | | for details on using the attribute bits during directory | | | searches. This function is present to allow applications to | | | define their own files as hidden (and thereby excluded from | | | normal directory searches) and to allow selective directory | | | searches. | +-------+--------------------------------------------------------------+ Any reference in the DOS function calls to an FCB, whether opened or unopened, may use either a normal or extended FCB. If you are using an extended FCB, the appropriate register should be set to the first byte of the prefix, rather than the drive-number field. |
|