;       SCCSID = @(#)cpmfcb.asm 1.1 85/04/10
;       SCCSID = @(#)cpmfcb.asm 1.1 85/04/10
;BREAK <File Control Block definition>

;
; Field definition for FCBs
; The FCB has the following structure:
;
;       +---------------------------+
;       |   Drive indicator(byte)   |
;       +---------------------------+
;       |    Filename (8 chars)     |
;       +---------------------------+
;       |    Extension (3 chars)    |
;       +---------------------------+
;       |   Current Extent(word)    |
;       +---------------------------+
;       |    Record size (word)     |
;       +---------------------------+
;       |    File Size (2 words)    |
;       +---------------------------+
;       |       Date of write       |
;       +---------------------------+
;       |       Time of write       |
;       +---------------------------+
;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
;            C  A  V  E  A  T     P  R  O  G  R  A  M  M  E  R             ;
;                                                                          ;
;       +---------------------------+
;       |   8 bytes reserved        |
;       +---------------------------+
;                                                                          ;
;            C  A  V  E  A  T     P  R  O  G  R  A  M  M  E  R             ;
;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
;       |    next record number     |
;       +---------------------------+
;       |   random record number    |
;       +---------------------------+
;

sys_fcb     STRUC
fcb_drive   DB      ?
fcb_name    DB      8 DUP (?)
fcb_ext     DB      3 DUP (?)
fcb_EXTENT  DW      ?
fcb_RECSIZ  DW      ?                   ; Size of record (user settable)
fcb_FILSIZ  DW      ?                   ; Size of file in bytes; used with the
                                        ; following word
fcb_DRVBP   DW      ?                   ; BP for SEARCH FIRST and SEARCH NEXT
fcb_FDATE   DW      ?                   ; Date of last writing
fcb_FTIME   DW      ?                   ; Time of last writing
;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
;            C  A  V  E  A  T     P  R  O  G  R  A  M  M  E  R             ;
;                                                                          ;
fcb_reserved DB      8 DUP (?)           ; RESERVED
;                                                                          ;
;            C  A  V  E  A  T     P  R  O  G  R  A  M  M  E  R             ;
;----+----+----+----+----+----+----+----+----+----+----+----+----+----+----;
fcb_NR      DB      ?                   ; Next record
fcb_RR      DB      4 DUP (?)           ; Random record
sys_fcb     ENDS

FILDIRENT       equ fcb_FILSIZ            ; Used only by SEARCH FIRST and SEARCH
                                        ; NEXT

labelsize fcb_sfn, byte, fcb_reserved

; Note that fcb_net_handle, fcb_nsl_drive, fcb_nsld_drive and fcb_l_drive
; all must point to the same byte.  Otherwise, the FCBRegen will fail.
; NOTE about this byte (fcb_nsl_drive)
;   The high two bits of this byte are used as follows to indicate the FCB type
;       00 means a local file or device with sharing loaded
;       10 means a remote (network) file
;       01 means a local file with no sharing loaded
;       11 means a local device with no sharing loaded

;
; Network FCB
;
labelsize fcb_net_drive, byte, fcb_reserved+1
labelsize fcb_net_handle, word, fcb_reserved+2
labelsize fcb_netID, dword, fcb_reserved+4

;
; No sharing local file FCB
;
labelsize fcb_nsl_drive, byte, fcb_reserved+1
labelsize fcb_nsl_bits, byte, fcb_reserved+2
labelsize fcb_nsl_firclus, word, fcb_reserved+3
labelsize fcb_nsl_dirsec, word, fcb_reserved+5
labelsize fcb_nsl_dirpos, byte, fcb_reserved+7

;
; No sharing local device FCB
;
labelsize fcb_nsld_drive, byte, fcb_reserved+1
labelsize fcb_nsld_drvptr, dword, fcb_reserved+2

;
; Sharing local FCB
;
labelsize fcb_l_drive, byte, fcb_reserved+1
labelsize fcb_l_firclus, word, fcb_reserved+2
labelsize fcb_l_mfs, word, fcb_reserved+4
labelsize fcb_l_attr, byte, fcb_reserved+6

;
; Bogusness:  the four cases are:
;
;   local file      00
;   local device    40
;   local sharing   C0
;   network         80
;
; Since sharing and network collide, we cannot use a test instruction for
; deciding whether a network or a share check in involved
;
FCBDEVICE   EQU 040h
FCBNETWORK  EQU 080h
FCBSHARE    EQU 0C0h

; FCBSPECIAL must be able to mask off both net and share
FCBSPECIAL  EQU 080h
FCBMASK     EQU 0C0h
