;==================================================================
;*** Structures for DOS 5.00 programming
;==================================================================

;MS-DOS 5.00 Prog. Ref. pg 34
;PC Source Book, pg 2-27
BOOTSECTOR	STRUC
	bsJump		db  3 DUP (?)	;E9 XX XX or EB XX 90
	bsOemName	db  '????????'	;OEM name and version
					;Start of BIOS parameter block
	bsBytesPerSec	dw  ?		;Bytes/sector
	bsSecPerClust	db  ?		;Sectors/cluster
	bsResSectors	dw  ?		;Number of reserved sectors
	bsFATs		db  ?		;Number of file allocation tables
	bsRootDirEnts	dw  ?		;Number of root directory entries
	bsSectors	dw  ?		;Total number of sectors
	bsMedia 	db  ?		;Media Descriptor
	bsFATsecs	dw  ?		;Number of sectors/FAT
	bsSecPerTrack	dw  ?		;Number of sectors/track
	bsHeads 	dw  ?		;Number of heads
	bsHiddenSecs	dd  ?		;Number of hidden sectors
	bsHugeSectors	dd  ?		;Number of sectors if bsSectors=0
					;End of BIOS parameter block
	bsDriveNumber	db  ?		;Drive number (80h)
	bsReserved1	db  ?		;Reserved
	bsBootSignature db  ?		;Extended boot signature (29h)
	bsVolumeID	dd  ?		;Volumn ID number
	bsFileSysType	db  8 dup(?)	;File-system type
BOOTSECTOR	ENDS


; page 38
DIRENTRY	STRUC
	deName		db	8 DUP (0)	;File Name
	deExtension	db	3 DUP (0)	;File Extension
	deAttribute	db	0		;File Attributes
	deReserved	db	10 DUP (?)	;Reserved by DOS
	deTime		dw	?		;Time
	deDate		dw	?		;Date
	deStartCluster	dw	?		;Starting Cluster
	deFileSize	dd	?		;File Size
DIRENTRY	ENDS

DIRENTRY_SIZE	EQU	8+3+1+10+2*3+4

EQU_deName		EQU	0	    ;File Name
EQU_deExtension 	EQU	8	    ;File Extension
EQU_deAttribute 	EQU	11	    ;File Attributes
EQU_deReserved		EQU	12	    ;Reserved by DOS
EQU_deTime		EQU	22	    ;Time
EQU_deDate		EQU	24	    ;Date
EQU_deStartCluster	EQU	26	    ;Starting Cluster
EQU_deFileSize		EQU	28	    ;File Size


; pg. 40
DISKIO	STRUC
	diStartSector	dd	?	;Starting sector number
	diSectors	dw	?	;Number of sectors
	diBuffer	dd	?	;Address of buffer
DISKIO	ENDS


; pg. 41
DPB	STRUC
	dpbDrive	db	?	;Drive number
	dpbUnit 	db	?	;Unit number for driver
	dpbSectorSize	dw	?	;Sector size in bytes
	dpbClusterMask	db	?	;Sectors per cluster - 1
	dpbClusterShift db	?	;Sectors per cluster, as power of 2
	dpbFirstFAT	dw	?	;First sector containing FAT
	dpbFATCount	db	?	;Number of FATs
	dpbRootEntries	dw	?	;Number of root-directory entries
	dpbFirstSector	dw	?	;First sector of first cluster
	dpbMaxCluster	dw	?	;Number of clusters on drive + 1
	dpbFATSize	dw	?	;Number of sectors occupied by FAT
	dpbDirSector	dw	?	;First sector containing the root dir
	dpbDriverAddr	dd	?	;Address of device driver
	dpbMedia	db	?	;Media descriptor
	dpbFirstAccess	db	?	;Indicates access to drive
	dpbNextDPB	dd	?	;Address of next drive parameter block
	dpbNextFree	dw	?	;Last allocated cluster
	dpbFreeCnt	dw	?	;Number of free clusters
DPB	ENDS

DPB_SIZE	EQU	33


;page 228
EXTENDEDFCB	STRUC
	extSignature	db	0ffh		;Extended FCB signature
	extReserved1	db	5 dup (0)	;Reserved by DOS
	extAttribute	db	0		;File attribute byte
						;File control block (FCB)
	extDriveID	db	0		;Drive # (0=default, 1=A, etc)
	extFileName	db	8 dup (' ')	  ;Filename
	extExtent	db	3 dup (' ')	  ;File extension
	extCurBlockNo	dw	0		;Current block number
	extRecSize	dw	0		;Record size
	extFileSize	dd	0		;Size of file, in bytes
	extFileDate	dw	0		;Date file last modified
	extFileTime	dw	0		;Time file last modified
	extReserved2	db	8 dup (0)	;Reserved by DOS
	extCurRecNo	db	0		;Current record number
	extRandomRecNo	dd	0		;Random record number
EXTENDEDFCB	ENDS

EQU_extSignature    EQU      0			;Extended FCB signature
EQU_extReserved1    EQU      1			;Reserved by DOS
EQU_extAttribute    EQU      6			;File attribute byte
						;File control block (FCB)
EQU_extDriveID	    EQU      7			;Drive # (0=default, 1=A, etc)
EQU_extFileName     EQU      8			;Filename
EQU_extExtent	    EQU      16 		;File extension
EQU_extCurBlockNo   EQU      19 		;Current block number
EQU_extRecSize	    EQU      21 		;Record size
EQU_extFileSize     EQU      23 		;Size of file, in bytes
EQU_extFileDate     EQU      27 		;Date file last modified
EQU_extFileTime     EQU      29 		;Time file last modified
EQU_extReserved2    EQU      31 		;Reserved by DOS
EQU_extCurRecNo     EQU      39 		;Current record number
EQU_extRandomRecNo  EQU      40 		;Random record number



;For int 21:11,12 - Find First File with FCB (pg 228)
FCB	STRUC
	fcbDriveID	db	?		;Drive # (0=default, 1=A, etc)
	fcbFileName	db	8 dup (?)	;Filename
	fcbExtent	db	3 dup (?)	;File extension
	fcbCurBlockNo	dw	0		;Current block number
	fcbRecSize	dw	0		;Record size
	fcbFileSize	db	4 dup (0)	;Size of file in bytes
	fcbFileDate	dw	0		;Date file last modified
	fcbFileTime	dw	0		;Time file last modified
	fcbReserved	db	8 dup (0)	;Reserved by DOS
	fcbCurRecNo	db	0		;Current record number
	fcbRandomRecNo	dd	0		;Random record number
FCB	ENDS

;pg 231
EXTHEADER	STRUC
	ehSignature	db	0ffh		;Extended signature
	ehReserved	db	5 dup (0)	;Reserved
	ehSearchAttrs	db	?		;Attribute byte
EXTHEADER	ENDS


MID	STRUC
	midInfoLevel	dw	0		;Information level
	midSerialNum	dd	?		;Serial number
	midVolLabel	db	11 dup (?)	;ASCII volume label
	midFileSysType	db	8 dup (?)	;File system type
MID	ENDS


