VPBTEXTLEN	EQU	12   
VPB_ACC_EXCL	EQU	8000H           
VPB_ACC_SHARE	EQU	1                
VPB_ALLOC_EXCL	EQU	8000H 
VPB_ALLOC_SHARE	EQU	1 
SPECVPDWORKAREASIZE	EQU	36           
VPDWORKAREASIZE	EQU	64           
.errnz  (not (VPDWORKAREASIZE ge SPECVPDWORKAREASIZE))
 

vpbfsi	STRUC
vpi_ID	DD	?
vpi_pDPB	DD	?
vpi_cbSector	DW	?
vpi_totsec	DD	?
vpi_trksec	DW	?
vpi_nhead	DW	?
vpi_text	DB	VPBTEXTLEN DUP (?)
vpi_pDCS	DD	?
vpi_pVCS	DD	?
vpi_drive	DB	?
vpi_unit	DB	?
vpi_flags	DW	?
vpbfsi	ENDS

VPB_NONCONTIG_ALLOWED	EQU	2        
VPB_ABOVE16M_ALLOWED	EQU	1        

vpbfsd	STRUC
vpd_work	DB	VPDWORKAREASIZE DUP (?)
vpbfsd	ENDS


vpb	STRUC
vpb_flink	DW	?
vpb_blink	DW	?
vpb_ref_count	DW	?
vpb_search_count	DW	?
vpb_first_access	DB	?
vpb_signature	DW	?
vpb_flags	DB	?
vpb_fMisc	DB	?
vpb_FSC	DD	?
vpb_fsd	DB	SIZE vpbfsd DUP (?)
vpb_fsi	DB	SIZE vpbfsi DUP (?)
vpb	ENDS


vpdFATFS	STRUC
vpdFAT_cluster_mask	DB	?
vpdFAT_cluster_shift	DB	?
vpdFAT_first_FAT	DW	?
vpdFAT_FAT_count	DB	?
vpdFAT_root_entries	DW	?
vpdFAT_first_sector	DD	?
vpdFAT_max_cluster	DW	?
vpdFAT_FAT_size	DW	?
vpdFAT_dir_sector	DD	?
vpdFAT_media	DB	?
vpdFAT_next_free	DW	?
vpdFAT_free_cnt	DW	?
vpdFAT_FATentrysize	DB	?
vpdFAT_IDsector	DD	?
vpdFAT_minEOF	DW	?
vpdFAT_access	DW	?
vpdFAT_accwait	DW	?
vpdFAT_alloc	DW	?
vpdFAT_eaflags	DW	?
vpdFAT_eareaders	DW	?
vpdFAT_eawaiters	DW	?
vpdFAT_eahandles	DW	?
vpdFAT_pEASFT	DD	?
vpdFAT_pBadSector	DD	?
vpdFAT_pClusBitMap	DD	?
vpdFAT_pNextFreeBitMap	DD	?
vpdFAT_cNextFreeBitMap	DW	?
vpdFATFS	ENDS

eavpb_fileopen	EQU	0001H   
eavpb_changing	EQU	0002H   
eavpb_dooropen	EQU	0004H   
.errnz  (VPDWORKAREASIZE lt size vpdFATFS)
 
NULLVPB	EQU	0000H 
VPBIDLEN	EQU	vpi_cbSector-vpi_ID
.errnz (vpi_pDPB - vpi_ID - 4)
.errnz (vpi_cbSector - vpi_pDPB - 4)
 
.ERRE vpb_signature
 
VPB_VALID	EQU	444AH 
VPB_INVALID	EQU	4A47H 
UNREAD_ID1	EQU	4A52H 
UNREAD_ID2	EQU	534EH 
DAMAGED_ID1	EQU	0000H 
DAMAGED_ID2	EQU	0000H 
VPBCHECK	EQU	01H     
VPBNEWBOOT	EQU	02H     
VPBMOUNT	EQU	04H     
VPBFORMATMOUNT	EQU	08H     
VPBINVALID	EQU	10H     
VPBINITCACHE	EQU	20H     
VPBSETVID	EQU	40H         
VPBALLOCATE	EQU	80H         
VPB_ALLOC_EXCL_KEY	EQU	1234H 
VPB_ALLOC_SHARE_KEY	EQU	5678H 
VPB_FM_WRITEABLE	EQU	01H     
VPB_FM_UNKNOWN	EQU	02H     
VPB_REMOTE_DRIVE	EQU	04H     
VPB_FM_ALLOCSHWAIT	EQU	08H     
VPB_FM_ALLOCEXWAIT	EQU	10H     
VPB_FM_INITCACHE_ERROR	EQU	20H     
VPB_FM_INITCACHE_DONE	EQU	40H 
FSM_MOUNT	EQU	0 
FSM_VOLREMOVED	EQU	1 
FSM_UNMOUNT	EQU	2 
FSM_FORMAT	EQU	3                
VPB_GRODELT	EQU	20               
FSD_MEDIA_BYTE	EQU	0F0H            



















VPBContext  macro  sel,indx,nocheck

        push    GSEL GDT_VPB
        pop     sel

IFB     <nocheck>
        chkvselhd sel,indx
ENDIF

    ASSUME sel:NOTHING

        endm














IFDEF VOLPTRCHK
        IF2
                IFNDEF  chkvselhdprc
                        extrn   chkvselhdprc:FAR
                ENDIF
        ENDIF

        chkvselhd MACRO sel,indx
        ifdif <sel>,<es>                
        ifdif <sel>,<ES>
                push    es
                push    sel
                pop     es              
        endif
        endif

        ifdif <indx>,<bp>               
        ifdif <indx>,<BP>
                push    bp
                mov     bp,indx         
        endif
        endif

                call    FAR PTR chkvselhdprc

        ifdif <indx>,<bp>               
        ifdif <indx>,<BP>
                pop     bp
        endif
        endif

        ifdif <sel>,<es>                
        ifdif <sel>,<ES>
                pop     es
        endif
        endif
        ENDM
ELSE
        chkvselhd MACRO sel,indx
        ENDM
ENDIF

