{ MS-System File Control Block, DOS Specific Version } INTERFACE; UNIT FILKQQ (FCBFQQ, FILEMODES, SEQUENTIAL, TERMINAL, DIRECT, DEVICETYPE, CONSOLE, LDEVICE, DISK, DOSEXT, DOSFCB, FNLUQQ, SCTRLNTH); CONST {$INCONST:MS_DOS 1 for MS-DOS, 0 for CP/M 80 or 86 } FNLUQQ = 21; { length of a DOS filename } {$IF MS_DOS $THEN} SCTRLNTH = 512; { length of a disk sector } {$ELSE} SCTRLNTH = 128; { length of a disk sector } {$END} TYPE DOSEXT = RECORD { DOS file control block extension } PS [0]: BYTE; { boundary byte, not in extension } FG [1]: BYTE; { flag; must be 255 in extension } XZ [2]: ARRAY [0..4] OF BYTE; { pad, internal use } AB [7]: BYTE; { internal use for attribute bits } END; DOSFCB = RECORD { DOS file control block (normal) } DR [00]: BYTE; { drive numb, 0=default, 1=A etc } FN [01]: STRING (8); { file name - eight characters } FT [09]: STRING (3); { file extn - three characters } EX [12]: BYTE; { current extent; lo order byte } E2 [13]: BYTE; { current extent; hi order byte } S2 [14]: BYTE; { size of sector; lo order byte } RC [15]: BYTE; { size of sector; hi order byte } Z1 [16]: WORD; { file size; lo word; readonly } Z2 [18]: WORD; { file size; hi word; readonly } DA [20]: WORD; { date; bits: DDDDDMMMMYYYYYYY } DN [22]: ARRAY [0..9] OF BYTE; { reserved for DOS } CR [32]: BYTE; { current sector (within extent) } RN [33]: WORD; { direct sector number (lo word) } R2 [35]: BYTE; { direct sector number (hi byte) } R3 [36]: BYTE; { DSN hi byte iff sect size < 64 } PD [37]: BYTE; { pad to word boundary; not DOS } END; DEVICETYPE = (CONSOLE, LDEVICE, DISK); { physical device } FILEMODES = (SEQUENTIAL, TERMINAL, DIRECT); { access mode } TYPE FCBFQQ = RECORD {byte offsets start every field comment} {fields accessible by Pascal user as .} TRAP: BOOLEAN; {00 Pascal user trapping errors if true} ERRS: WRD(0)..15; {01 error status, set only by all units} MODE: FILEMODES; {02 user file mode; not used in unit U} MISC: BYTE; {03 pad to word bound, special user use} {fields shared by units F, V, U; ERRC / ESTS are write-only} ERRC: WORD; {04 error code, error exists if nonzero} {1000..1099: set for unit U errors} {1100..1199: set for unit F errors} {1200..1299: set for unit V errors} ESTS: WORD; {06 error specific data usually from OS} CMOD: FILEMODES; {08 system file mode; copied from MODE} {fields set / used by units F and V, and read-only in unit U} TXTF: BOOLEAN; {09 true: formatted / ASCII / TEXT file} {false: not formatted / binary file} SIZE: WORD; {10 record size set when file is opened} {DIRECT: always fixed record length} {others: max buffer variable length} IERF: BOOLEAN; {12 Unit U Incomplete End Of Record } {Kluge. Set false by opnuqq and } {pccuqq, and true by peruqq. Thus } {if true in wefuqq, it means that } {there is an incomplete line, and } {pccuqq should be called to flush } {it. Only applies to terminal files} MISA: BYTE; {13 Used to keep alignment with old misa} OLDF: BOOLEAN; {14 true: must exist before open; RESET} {false: can create on open; REWRITE} INPT: BOOLEAN; {15 true: user is now reading from file} {false: user is now writing to file} RECL: WORD; {16 DIRECT record number, lo order word} RECH: WORD; {18 DIRECT record number, hi order word} USED: WORD; {20 number bytes used in current record} {field used internally by units F and V not needed by unit U} LINK: ADR OF FCBFQQ;{22 DS offset address of next open file} BADR: ADRMEM; {24 ADR of buffer variable (end of FCB)} TMPF: BOOLEAN; {26 true if temp file; delete on CLOSE} FULL: BOOLEAN; {27 buffer lazy evaluation status, TEXT} UNFM: BOOLEAN; {28 V: for unformatted binary file mode} OPEN: BOOLEAN; {29 file opened; RESET / REWRITE called} {fields used internally by unit V not needed by units F or U} FUNT: INTEGER; {30 Unit V's unit number always above 0} ENDF: BOOLEAN; {32 last operation was the ENDFILE stmt} {fields set / used by unit U, and read-only in units F and V} REDY: BOOLEAN; {33 buffer ready if true; set by F / U} BCNT: WORD; {34 number of data bytes actually moved} EORF: BOOLEAN; {36 true if end of record read, written} EOFF: BOOLEAN; {37 end of file flag set after EOF read} {unit U (operating system) information starts here} NAME: LSTRING (FNLUQQ); { 38 DOS filename (D:NNNNNNNN.XXX) } DEVT: DEVICETYPE; { 60 device type, accessed by file } RDFC: BYTE; { 61 function code, for device GET } WRFC: BYTE; { 62 function code, for device PUT } CHNG: BOOLEAN; { 63 true if sbuf data was changed } SPTR: WORD; { 64 index to current byte in sbuf } LNSB: WORD; { 66 number of valid bytes in sbuf } DOSX: DOSEXT; { 68 extend DOS file control block } DOSF: DOSFCB; { 76 normal DOS file control block } IEOF: BOOLEAN; {114 true if eoff is true next get } FNER: BOOLEAN; {115 true if pfnuqq filename error } SBFL: BYTE; {116 max textfile line len in sbuf } SBFC: BYTE; {117 number of chars, read to sbuf } SBUF: ARRAY [WRD(0)..SCTRLNTH-1] OF BYTE; {118 sect buffer } PMET: ARRAY [0..3] OF BYTE; {118+sctrlnth reserved pad } BUFF: CHAR; {122+sctrlnth (buffer var) } {end of section for unit U specific OS information} END; END;