Program Segment Prefix (100h bytes) 00 INT 20 02 End of allocation segment 04 Reserved 05 Far call to DOS 0A Saved INT 22 vector 0E Saved INT 23 vector 12 Saved INT 24 vector (1.1+) 16 Caller PSP segment (2.0+) 18 File table (2.0+) 2C Environment segment (2.0+) 2E Stack pointer after last DOS call (2.0+) 32 File table size (3.0+) 34 Pointer to file table (3.0+) 38 Pointer to next PSP (SHARE only) (3.0+) 3C Reserved 40 DOS version (4.0+) 42 Reserved 50 INT 21,RETF (2.0+) 53 Reserved 5C FCB 1 6C FCB 2 7C Unused 80 Command tail File Control Block (25h bytes) 00 Drive code (1=A) 01 Filename 09 Extension 0C Current block number 0E Record size 10 File size 14 Date 16 Time 18 Reserved 20 Current record number 21 Random record number Extended FCB (2Ch bytes) 00 FF (Extended FCB indicator) 01 Reserved 06 Attribute byte 07 Standard FCB Disk partition table entry (10h bytes) 00 Status (00=non-bootable,80=bootable) 01 Starting head 02 Starting cylinder and sector (INT 13 format) 04 Type (0=unknown,1=FAT12,4=FAT16,5=extended,6=BIGDOS) 05 Ending head 06 Ending cylinder and sector (INT 13 format) 08 Starting absolute sector 0C Number of sectors Note: There are 4 entries starting at offset 1BE Disk boot sector (200h bytes) 00 Jump to boot code 03 OEM name 0B Bytes per sector 0D Sectors per cluster 0E Number of reserved sectors 10 Number of FATs 11 Number of root directory entries 13 Total number of sectors 15 Media descriptor byte F0 1.44M (2 sides,18 sectors/track,80 tracks) 2.88M (2 sides,36 sectors/track,80 tracks) F8 fixed disk F9 720K (2 sides,9 sectors/track,80 tracks) 1.2M (2 sides,15 sectors/track,80 tracks) FC 180K (1 side,9 sectors/track,40 tracks) FD 360K (2 sides,9 sectors/track,40 tracks) FE 160K (1 side,8 sectors/track,40 tracks) FF 320K (2 sides,8 sectors/track,40 tracks) 16 Sectors per FAT 18 Sectors per track 1A Number of heads 1C Number of hidden sectors 20 32-bit number of sectors if word at 13=0 (3.31+) 24 Drive number (4.0+) 25 Reserved (4.0+) 26 Extended boot record ID (29) (4.0+) 27 Serial number (4.0+) 2B Volume label (4.0+) 36 8-byte file system name (4.0+) Note: Bytes 0B-23 are the BIOS parameter block Directory entry (20h bytes) 00 Filename 08 Extension 0B Attribute byte 01=Read-only 02=Hidden 04=System 08=Volume label (2.0+) 10=Directory (2.0+) 20=Archive (2.0+) 0C Reserved 16 Time Bits 0-4 Seconds/2 (0-29) 5-10 Minutes (0-59) 11-15 Hours (0-23) 18 Date Bits 0-4 Day (1-31) 5-8 Month (1-12) 9-15 Year-1980 1A Starting cluster number 1C File size Disk parameter block (20h bytes in 3.x, 21h bytes in 4.0+) 00 Drive code (0=A) 01 Unit code 02 Bytes per sector 04 Sectors per cluster-1 05 Cluster shift factor (2**n sectors per cluster) 06 First FAT sector 08 Number of FATs 09 Number of directory entries 0B First data sector 0D Maximum cluster number 0F Sectors per FAT 11 First directory sector 13 Pointer to device driver 17 Media descriptor byte 18 Access flag (00=accessed,FF=not accessed) 19 Pointer to next DPB 1D Last cluster allocated 1F Number of free clusters (-1 if unknown) Note: (3.x) The sectors per FAT field is one byte and all following fields are moved back one byte. System file table (35h bytes in 3.x, 3Bh bytes in 4.0+) 00 Open count 02 Open mode Bit 0-2 access mode 000=read 001=write 010=read/write 4-6 sharing mode 000=compatibility 001=deny read/write 010=deny write 011=deny read 100=deny none 13 critical error handling 0=execute INT 24 1=return error code 14 buffering 0=buffer writes 1=don't buffer writes 15 1=FCB SFT 04 Attribute byte 05 Device info Character devices: Block devices: Bit 0 1=console input Bit 0-5 drive code (0=A) 1 1=console output 6 0=file has been written 2 1=NUL device 7 0=block device 3 1=CLOCK device 12 1=no inherit 4 1=INT 29 output (CON) 14 1=date/time set 5 0=ASCII,1=binary 15 1=redirected file 6 0=EOF on input 7 1=character device 11 1=network spooler 12 1=no inherit 13 1=named pipe 15 1=redirected device 07 Pointer to device driver or disk parameter block 0B First cluster number 0D Time 0F Date 11 File size 15 File pointer 19 Current relative cluster number 1B 32-bit directory entry sector (4.0+) 1B Current absolute cluster number (3.x) 1D Directory entry sector (3.x) 1F Directory entry position in sector 20 Filename 28 Extension 2B Pointer to next SFT for the same file (SHARE only) 2F Machine number 31 PSP of owner 33 SHARE file table offset 35 Current absolute cluster number (4.0+) 37 Reserved (4.0+) SHARE file table 00 Entry flag (1=open,0=unused,-1=end of list) 01 Entry length 03 Filespec checksum 04 First lock table offset 06 Pointer to system file table 0A SHARE file number 0C Filespec SHARE lock table (10h bytes) 00 Offset to next lock table for file 02 Start of lock region 06 End of lock region 0A Pointer to system file table 0E PSP of owner Current directory structure (51h bytes in 3.x, 58h bytes in 4.0+) 00 Current directory 43 Drive type 1000=SUBSTed drive 2000=JOINed drive 4000=valid drive 8000=redirected drive 45 Pointer to disk parameter block 49 Cluster number of current directory (0=root) 4B Reserved 4F Length of root directory name starting at offset 0 51 Reserved (4.0+) Disk buffer header (10h bytes) (3.x) 00 Pointer to next buffer 04 Drive code (0=A,FF=unused) 05 Flags Bit 0 reserved 1 1=FAT sector 2 1=directory sector 3 1=data sector 4 reserved 5 1=buffer read 6 1=buffer written 7 reserved 06 Sector number 08 Number of FATs (if FAT) or 1 09 Sectors per FAT (if FAT) or 0 0A Pointer to DPB 0E Reserved 10 Buffered sector Disk buffer header (14h bytes) (4.0+) 00 Pointer to next buffer 02 Pointer to previous buffer 04 Drive code (0=A,FF=unused) 05 Flags Bit 0 reserved 1 1=FAT sector 2 1=directory sector 3 1=data sector 4 reserved 5 1=buffer read (4.0) 6 1=buffer written 7 reserved 06 Sector number 0A Number of FATs (if FAT) or 1 0B Sectors per FAT (if FAT) or 0 0D Pointer to DPB 11 Reserved 14 Buffered sector Disk buffer control block (4.0) 00 Pointer to buffer chain array 04 Number of chains 06 Pointer to sector lookahead buffers 0A Number of sector lookahead buffers 0C Unknown Disk buffer control block (5.0+) 00 Pointer to buffer chain 04 Number of modified buffers 06 Pointer to sector lookahead buffers 0A Number of sector lookahead buffers 0C HMA flag (1=buffers in HMA) 0D Pointer to HMA transfer buffer Disk buffer chain array entry (8 bytes) (4.0) 00 Reserved 02 Pointer to last accessed buffer 06 Number of modified buffers 07 Reserved Stacks block header (12h bytes) 00 Reserved 02 Number of stacks 04 Offset of stacks 06 Stack size 08 Pointer to stacks table (descriptors followed by stacks) 0C Offset of first stacks descriptor 0E Offset of last stacks descriptor 10 Offset of current stacks descriptor Stacks descriptor (8 bytes) 00 Flag (0=free,1=in use) 02 Savearea for SS:SP 06 Offset of end of stack Device driver header (12h bytes) 00 Pointer to next device driver or -1 04 Attribute word Bit 0 1=console input 1 1=console output (character devices) 1=32-bit sectors supported (block devices) (3.31+) 2 1=NUL device 3 1=CLOCK device 4 1=INT 29 output (CON) 6 1=extended functions supported (13,17,18) (3.2+) 7 1=query IOCTL function supported (19) (5.0+) 11 1=open/close/removable media supported (3.0+) 13 1=output until busy supported (character devices) (3.0+) 1=media descriptor in FAT required (block devices) 14 1=IOCTL supported 15 0=block device 1=character device 06 Strategy address 08 Interrupt address 0A Device name or number of units Device driver request header (common fields) 00 Request header length 01 Unit number 02 Command code 00=Init 0B=Flush output buffers 01=Media check 0C=I/O control write 02=Build BPB 0D=Open (3.0+) 03=I/O control read 0E=Close (3.0+) 04=Read 0F=Removable media check (3.0+) 05=Non-destructive read 10=Output until busy (3.0+) 06=Input status 13=Generic I/O control (3.2+) 07=Flush input buffers 17=Get drive map (3.2+) 08=Write 18=Set drive map (3.2+) 09=Write with verify 19=Query I/O control (5.0+) 0A=Output status 03 Return status word Bit 0-7 if error 00=write-protect error 07=unknown medium 01=unknown unit 08=sector not found 02=drive not ready 09=printer out of paper 03=unknown command 0A=write fault 04=data error (CRC) 0B=read fault 05=bad request length 0C=general failure 06=seek error 0F=invalid disk change 8 1=done 9 1=busy 15 1=error 05 Reserved (8 bytes) Device driver request headers: Init 00 Common (length=17h in 3.x, 19h in 4.0+) 0D Number of units (set by driver) 0E End of available memory (5.0+) End of resident code (set by driver) 12 Pointer to string after DEVICE= BPB array pointer (set by driver) 16 Drive code of first unit (0=A) 17 Error message flag (1=display message) (4.0+) Media check 00 Common (length=13h) 0D Media descriptor byte 0E Status (set by driver: 1=unchanged,0=unknown,-1=changed) 0F Pointer to previous disk label (set by driver if disk changed) Build BPB 00 Common (length=16h) 0D Media descriptor byte 0E Pointer to sector buffer 12 Pointer to BPB (set by driver) Note: The sector buffer contains the first sector of the FAT if bit 13 in the device attribute word is zero otherwise it may be used as scratch space. IOCTL read, Read, Write, Write with verify, IOCTL write, Output until busy 00 Common (length=14h) 0D Unused 0E Pointer to data buffer 12 Byte count (set by driver to number of bytes transferred) Notes: 1) The IOCTL functions are called only if bit 14 in the device attribute word is set. 2) The output until busy function is called only if bit 13 in the device attribute word is set. Read, Write, Write with verify 00 Common (length=16h-1Eh) 0D Media descriptor byte 0E Pointer to data buffer 12 Sector count (set by driver to number of sectors transferred) 14 Starting sector number (-1=if 32-bit sectors) 16 Pointer to previous disk label (set by driver if error 0F) 1A 32-bit starting sector number Note: The 32-bit starting sector number is used only if bit 1 in the device attribute word is set. Non-destructive read 00 Common (length=0Eh) 0D Character (set by driver) Note: This function sets the busy bit (bit 9) in the request header if no character is ready. Input status, Output status 00 Common (length=0Dh) Note: These functions set the busy bit (bit 9) in the request header to indicate device status. Flush input buffers, Flush output buffers 00 Common (length=0Dh) Open, Close, Removable media check 00 Common (length=0Dh) Notes: 1) These functions are called only if bit 11 in the device attribute word is set. 2) The removable media check function sets bit 9 in the status word if the device is non-removable. Generic IOCTL, Query IOCTL 00 Common (length=17h) 0D Category code 0E Function code 0F Unused 13 Parameter buffer pointer Notes: 1) The Generic IOCTL function is called only if bit 6 in the device attribute word is set. 2) The Query IOCTL function is called only if bit 7 in the device attribute word is set. Get drive map, Set drive map 00 Common (length=0Dh) Notes: 1) These functions are called only if bit 6 in the device attribute word is set. 2) These functions set the unit field (byte 1) in the request header to the physical drive code. Clock device info (6 bytes) 00 Days since 1/1/80 02 Minutes 03 Hours 04 Hundredths 05 Seconds Memory Control Block (10h bytes) 00 Type ('M' or 'Z' if last) 01 PSP segment of owner (0=free,8=DOS) 03 Size (paragraphs) 05 Unused 08 Program name (4.0+) EXE file header 00 'MZ' 02 Size of last page 04 File size in 512-byte pages 06 Relocation table count 08 Header size (paragraphs) 0A Minimum allocation (paragraphs) 0C Maximum allocation (paragraphs) 0E Initial SS 10 Initial SP 12 Checksum 14 Initial IP 16 Initial CS 18 Offset of relocation table Table entry format: 0 offset of relocation 2 segment of relocation 1A Overlay number EXEPACK header 00 Actual IP 02 Actual CS 04 0 (set to PSP+10h by unpack code) 06 Unpack code and data size (including relocation table) 08 Actual SP 0A Actual SS 0C Actual code and data size Note: If an EXE file is packed then CS:IP-2 points to 'RB' and CS:0 points to the EXEPACK header, this is followed by the unpack code and a relocation table containing a word count and relocation entries for 16 segments.