Data Structures Used in IBM PC Compatibles and the PS/2 Compiled and Annotated by (c) 1985,'86,'87,'88 Send comments or corrections to: William C. Parke 1820 S Street NW Washington, D.C. 20009 ---------------------------------------------------------------------------- The following data structures are found in RAM, ROM, on the boot sector of formated disks, in file headers, or are created dynamically by the operating system. The structures establish the fields and parameters needed by the operating system to initialize and maintain communication with the various devices or files attached to the system. _____________________________________________________________________________ ----------------------------------------------------------------------------- PC Data Format: ----------------------------------------------------------------------------- Bit = One or zero value. A bit can be saved as an electrical circuit latch, through electrical capacitance, by an induced magnetic field, mechanical change, etc. All information can be stored as a series of bits. Use DBIT for asm directive. Common Synonyms to bit values: 1 = One Set High True Yes On Full Mark Open Pass Start Active 0 = Zero Reset Low False No Off Null Space Close Block Stop Inactive Nibble = Four bits, labeled 3 to 0; Half a byte; Used to store a numerical value from 0 to 9 in Binary Coded Decimal; Used to store hex value 0-F. (Also called nybble) BCD = Binary coded decimal value stored in one nibble as a value between 0 and 9. The 80x86 has several instructions for transforming between binary and BCD. Tribble = Three nibbles; Used in MS-DOS File Allocation Table when the disk partition has less than 16 Megabytes. Byte = Eight bits, labeled 7 to 0. Each ASCII character has a unique byte value. The IBM extended character set and the IBM EBCDIC characters have a unique byte value. The 80x86 registers AH, AL, BH, BL, CH, CL, DH, DL each hold one byte. 80x86 memory is accessible at a byte level. Use DB for asm directive. ASCII Byte = American-Standard-Code-for-Information-Interchange byte. ASCII codes represent numbers, letters, symbols and controls using a 7-bit code. EBCDIC = Extended binary coded decimal information codes established and used within IBM mainframe computers to represent numbers, letters, symbols and controls using an 8-bit code. Packed Decimal = Bytes holding a decimal value (0-9) in each nibble. Word = Two bytes, sixteen bits, labeled 15 to 0. The 80x86 registers AX, BX, CX, DX, SI, DI, BP, ES, DS, SS, and SP hold one word. The 80x86 memory is accessible at a word level. An 80x86 word is stored low byte first. Integer words use bit 15 for the sign. A 'word' on some computers refers to a value which can be stored in an arithemetic register of the Central Processing Unit (CPU). Thus, the bit size of a word varies among computers. Use DW for asm directive. Double Word = Two words. The 80x86 memory can be addressed by a double word. The 80x86 can load a double word from memory by a single instruction. Double words are stored low word first. Integer double words use bit 31 for the sign. The 8087 stores the two's complement if the number is negative (i.e. 1 + NOT x). In this way, a number plus its negative becomes zero. Use DD for asm directive. 80386 Pointer = 48 bits. Largest address pointer in 80386. Use DP for asm directive. Quad Word = Four words. Allocation for a long integer. Use DQ for asm directive. Ten byte = Allocation for packed decimal. Use DT for asm directive. 8087 Long Integer = 8 bytes, with last bit labeled 63 carrying the sign: If the number is positive, bit 63 is 0. If negative, the two's complement of the number is stored, making bit 63 a 1. 8087 Packed Decimal = 10 bytes; bit 79 is sign, 78-72 unused, 71-0 are 18 consecutive 4-bit packed decimal values. 8087 Short Real = 4 bytes; bit 31-23 is biased exponent (exponent + 127); 22-0 holds normalized significand (shifted to left until 1 appears at bit 23). Bit 23 of number is implicit = 1. 8087 Long Real = 8 bytes; bit 63 is sign of number; 62-52 is biased exponent (exponent + 1023); bits 51-0 are normalized significand (bit 52 of number is implicit = 1). 8087 Temporary Real = 10 bytes; bit 79 = sign; 78-64 = biased exponent (exponent + 16383); bit 63-0 = normalized significand, with explicit 1 at bit 63. MASM Long Real DQ = 8 bytes; bits 63-56 = biased exponent (exponent + 129); bit 55 = sign; bits 54-0 = normalized significand with implicit 1 as bit 55. MASM Short Real DD = 4 bytes; bits 31-24 = biased exponent (exponent + 129); bit 23 = sign; bits 22-0 = normalized significand with implicit 1 as bit 23. Paragraph = 16 bytes; Change of address if an 80x86 segment register is incremented. Page = 256 bytes; Change of address if an 80x86 register high byte is incremented. Sector = 512 bytes; Smallest number of bytes which can be loaded by MS-DOS from a disk. Cluster = A group of sectors which are indexed by MS-DOS as allocation units; these are reserved for file storage and data on disks. Allocation Unit = Cluster which has been assigned in a File Allocation Table (FAT) for a disk. Kilobyte = 1024 bytes (2**10); Smallest number of bytes in one allocation unit for a file under MS-DOS. Segment = 65,536 bytes (2**16); 80x86 address range for fixed segment register; this range reached by an offset stored in a word register; The largest address space for an 8080 CPU. Megabyte = 1,048,576 bytes (2**20); The largest address space for an 8086 CPU; An 80286 can address 16 Megabytes of physical memory; An average book stores about 1 Megabyte of data in 250 pages. Gigabyte = 1,073,741,824 bytes (2**30); An 80386 can address 4 Gigabytes (2**32) of physical memory; A laser disk can hold close to 1 Gigabyte of data; 1000 books of information. Terabyte = 1,099,511,627,520 bytes (2**40); The virtual address space of an 80386 CPU is 64 terabytes (2**46); Storage in a large library is under a terabyte; Estimated storage capacity of the human brain is about 10 terabytes. _____________________________________________________________________________ ----------------------------------------------------------------------------- Disk Drive Structures: ----------------------------------------------------------------------------- Diskette Control Table: ----------------------------------------------------------------------------- The diskette control table address is stored in the Int 1Eh vector. It is used to establish diskette controller parameters during formating, reading, and writing to a disk. See Int 13h, function 18h. Table Definitions: Offset Data type Description 00H BYTE Disk Controller Mode byte 1: ssssuuuuB s=0-FH = head step rate in milliseconds u=0-FH = head unload time in milliseconds 01H BYTE Disk Controller Mode byte 2: llllllldB l=0-7FH = head load time/2-1 in milliseconds d=0-1 = DMA flag (0 means DMA is used) 02H BYTE Clock Ticks until motor off 03H BYTE FM or MFM Mode: Log2 (Bytes per Sector/128) FM= Freq. Modulation used on single-density disks MFM=Modified Freq. Modulation used on double-sided disks 04H BYTE Last Sector on Track (e.g. 09H) 05H BYTE Gap Length in Bytes MFM Bytes/Sector Sectors/track Write Gap Format Gap 1 256 12H 0AH 0CH 1 256 10H 20H 32H 2 512 08H 2AH 50H 2 512 09H 1BH 6CH 3 1024 04H 80H F0H 4 2048 02H C8H FFH 5 4096 01H C8H FFH 06H BYTE Disk Data Length (80H for 128 bytes/sec or 0FFH otherwise) 07H BYTE Gap Length when formatting 08H BYTE Data pattern used during formatting (fill byte) 09H BYTE Floppy Head Bounce Delay (in milliseconds) 0AH BYTE Floppy Motor Start Delay (in 0.125 second intervals) 0BH BYTE Floppy Motor Stop Delay (in 0.25 seconds intervals) ---------------------------------------------------------------------------- ---------------------------------------------------------------------------- Fixed Disk Drive Parameter Tables: ---------------------------------------------------------------------------- The address for these tables are stored in the Int 41h vector address for drive 1, and Int 46h vector address for drive 2. These tables can be initialized to new drive type characteristics using Int 13h, function 9h. Offset Data type Description 00H WORD number of tracks (called cylinders on fixed disks) 02H BYTE number of heads 03H WORD start cylinder for reduced write current 05H WORD start cylinder for write precompensation on inner tracks 07H BYTE maximum number of bits to correct data errors (ECC burst length; ECC=Error correcting code) 08H BYTE controller options 7 disable access retries 6 disable ECC retries 5-3 000 (non-XT: 5=defect map at max.cyl.+1 3=more than 8 heads on AT) 2-0 000 3 usec/step 100 200 usec/step 101 60 usec/step (approx.) 110 3 msec/step 111 3 msec/step 09H BYTE time out value for read/write 0AH BYTE time out value for format 0BH BYTE time out for disk diagnostics 0CH WORD landing zone 0EH BYTE sectors/track 0FH BYTE reserved _____________________________________________________________________________ ----------------------------------------------------------------------------- BIOS System Structures: ----------------------------------------------------------------------------- Hard Disk Primitive Boot Sector: ----------------------------------------------------------------------------- Rather than a DOS Boot Sector, a hard disk may contain a primitive boot sector which is loaded into memory by the system ROM as the first disk activity. This sector must be the first sector on the disk (cylinder 0, head 0, sector 1). It is loaded at 0:7C00H and then run, starting at 0:7C00H. The code and data from this sector is strongly machine dependent. For IBM machines, the code checks the first byte of the four 16 byte disk drive partition tables starting at 01BEH to find the designated active and bootable partition. If one is not found, an Int 18h is generated to enter ROM BASIC. Otherwise, the active DOS boot sector is loaded and run. Offset Data type Description 000H n BYTES Primitive Boot Code to find active DOS partition 1BEH 16 BYTES First disk drive partition table ... 1FEH WORD AA55H = boot record signature ----------------------------------------------------------------------------- Extended Fixed Disk Drive Parameter Table: ----------------------------------------------------------------------------- For PS/2 (except Model 30), the fixed disk sector 2 at Head 0, Track 0 contains the information needed to support DOS extended partitions, from logical drive D: to F:. The format is: Offset Data type Description 000H 1 WORD Length of Extended Fixed Disk Drive Parameter Table below 002H 22 BYTES (ID) ASCII string: 'IBM HARDFILE TYPE xxx ' 018H 1 BYTE Drive Type number in binary 019H 16 BYTES Fixed disk drive partition table ----------------------------------------------------------------------------- Disk Drive Partition Table: ----------------------------------------------------------------------------- The disk drive partition tables begin at offset 1BEH in the boot record of the hard disk (track 0, cylinder 0, sector 1), at offset 019H in the extended fixed disk drive partition table, and offset 1BEH in the DOS boot sector. Offset Data type Description 00H BYTE Partition status: 00=inactive; 80H=bootable and active 01H BYTE Starting head of boot code 02H WORD Starting sector and cylinder of boot code (cyl. = bits 15,14,7-0; sector = bits 13-8) 04H BYTE Partition type: 1 = DOS with 12 bit FAT 4 = DOS with 16 bit FAT 5 = extended DOS 6 = reserved 0DBH= concurrent DOS 05H BYTE Ending head 06H WORD Ending sector and cylinder 08H DWORD Starting absolute sector for partition 0CH DWORD Number of sectors The 16 byte block repeats for each of four partitions, until: 40H WORD AA55H = valid boot record signature (at 1FEH) which completes the first sector on the disk. ---------------------------------------------------------------------------- DOS Boot Sector: ----------------------------------------------------------------------------- Offset Data type Description 00H 3 BYTES jump instruction to boot code in sector: JMP 0BH + nn (near JMP for DOS 2.1 (E9H), short JMP for DOS 3.x (EBH) ) 03H 8 BYTES Original Equipment Manufacturer (OEM) name and version 0BH nn BYTES Bios Parameter Block as below bb BYTES Boot Code 1BEH 64 BYTES Possible Partition Tables 1FEH WORD AA55H boot signature 200H ... ---------------------------------------------------------------------------- Disk BIOS Parameter Block: ----------------------------------------------------------------------------- The BIOS Parameter Block (BPB) determines the nature of a disk medium. It can be found in the DOS boot sector of every formated disk. This DOS boot sector is at track 0, head 0, sector 1, on diskettes, and follows the primitive boot sector and extended disk drive partition table on hard drives. A pointer to the memory image of the BPB is passed to a block device when requesting initialization of the device. A drive parameter block can be built with device driver request using the BPB and with the undocumented function 53h, Int 21h. See Disk Parameter Block. BIOS Parameter Block Structure: Offset Data type Description 00H WORD Sector size in bytes (not less than 32) 02H BYTE Sectors/Clusters [Allocation Unit](power of 2) 03H WORD Number of reserved sectors (starting at logical sector 0) 05H BYTE Number of FATs (usually 2) 06H WORD Number of directory entries (maximum allowed) 08H WORD Total number of sectors in logical image, including boot 0AH BYTE Media descriptor 11111xxxB (ID byte) 0BH WORD Number of sectors per FAT 0DH WORD Sectors/track 0FH WORD Number of Heads 11H DWORD Number of Hidden Sectors (used in partitioning schemes) 15H DWORD Number of logical sectors if +08H = 0 (DOS 4.0) DOS 4.0 Boot Sector Extension (created by FORMAT and LABEL commands): 19H BYTE Physical drive number 1AH BYTE Reserved 1BH BYTE Segment byte 29h 1CH DWORD Volume serial number (computed from date/time) 20H 11 BYTES Volume Label 2BH 8 BYTES Reserved Example BIOS parameters for drives: Diskette: Bytes/ Sec/ Track/ Sides Bytes Sec/ Sec/ Sec/ ID Sector Track Side Cluster DIR FAT Byte .-------+------+------+-----+-------+------+-----+----+----. 8.00 inch disk | 128 | 26 | 77 | 1 | 250K | 4 | 17 | 6 | FE | | 128 | 26 | 77 | 1 | 250K | 4 | 26 | 6 | FD | | 1024 | 8 | 77 | 2 | 1.23M | 1 | 6 | 1 | FE | 5.25-inch disk | 512 | 8 | 40 | 1 | 160K | 1 | 4 | 1 | FE | | 512 | 8 | 40 | 2 | 320K | 2 | 7 | 1 | FF | | 512 | 9 | 40 | 1 | 180K | 1 | 4 | 2 | FC | | 512 | 9 | 40 | 2 | 360K | 2 | 7 | 2 | FD | | 512 | 15 | 80 | 2 | 1.20M | 1 | 14 | 7 | F9 | 3.50-inch disk | 512 | 9 | 80 | 2 | 720K | 2 | 7 | 3 | F9 | | 512 | 18 | 80 | 2 | 1.44M | 1 | 14 | 9 | F0 | `-------+------+------+-----+-------+------+-----+----+----' Hard Disk: Bytes/ Sec/ Cylin. Heads Bytes Sec/ Sec/ Sec/ ID Sector Cylin. Cluster DIR FAT Byte .-------+------+------+-----+-------+------+-----+----+----. XT 10 Mb 5.25" | 512 | 17 | 306 | 4 | 10Mb | 8 | 32 | 8 | F8 | AT 20 Mb 5.25" | 512 | 17 | 615 | 4 | 21Mb | 4 | 32 | 40 | F8 | PS/2 20 Mb 3.5"| 512 | | | | 21Mb | | | | F8 | PS/2 44 Mb 3.5"| 512 | 17 | 1022 | 5 | 44Mb | 17 | 32 | 43 | F8 | PS/2 70 Mb 3.5"| 512 | | | | 70Mb | | | | F8 | `-------+------+------+-----+-------+------+-----+----+----' ----------------------------------------------------------------------------- System ROM Parameter Table: ----------------------------------------------------------------------------- Function 0C0h under Int 15h returns a pointer to this table in ES:BX. Offset Data type Description 00H WORD byte_count number of bytes following (min.=8) 02H BYTE model PC XT PCjr AT PS/50/60 XT/2 PS/30 CVT PS/80 FF FE FD FC FB FA F9 F8 03H BYTE submodel 04 05 01 00 00 00 04H BYTE BIOS_rev 0 for first release, 1 for 2nd, etc. 05H BYTE featbyte 80 = DMA channel 3 used by hd BIOS 40 = 2nd 8259 installed 20 = Real-Time Clock installed 10 = Int 15h, AH=41h called upon Int 9 (keyboard scan code hook) 8 = wait for external event supported (Int 15h, AH=41h) (CVT); reserved on PS/2 4 = extended BIOS area allocated at 640K 2 = bus is Micro Channel instead of PC 1 = reserved 06H WORD 0 reserved 08H WORD 0 reserved ---------------------------------------------------------------------------- CPU Global Descriptor Table: ----------------------------------------------------------------------------- The global descriptor tables are used to perform block moves in the protected mode of the 80286/386 with Int 15h, function 87h, and for switching to virtual mode, function 89h. GDT organization: offset 0 null descriptor 8 GDT descriptor 10 IDT descriptor 18 DS 20 ES 28 SS 30 CS 38 uninitialized, used to build descriptor for BIOS CS Sample descriptor: SOURCE_TARGET_DEF STRUC SEG_LIMIT DW ? ; Segment limit (1 to 65536) LO_WORD DW ? ; 24-bit segment physical address (0 to 16M-1) HI_BYTE DB ? ; DATA_ACC_RIGHT DW 93H ; Access rights byte (CPL0-R/W) Reserved DW 0 ; Reserved word (must be 0) SOURCE_TARGET_DEF ENDS Global descriptor table pointed to by ES:SI in Int 15h, function 87h: BLOCKMOV_GDT_DEF STRUC DW 0,0,0,0 ; First dummy descriptor CGDT_LOC DW ?,?,?,0 ; Location of calling routine GDT SOURCE DW ?,?,?,0 ; Source descriptor - segment to be moved TARGET DW ?,?,?,0 ; Target descriptor - destination segment BIOS_CS DW ?,?,?,0 ; BIOS code descriptor - protected mode CS TEMP_SS DW ?,?,?,0 ; Stack descriptor - protected mode SS BLOCKMOV_GDT_DEF ENDS _____________________________________________________________________________ ----------------------------------------------------------------------------- BIOS Video Structures: ----------------------------------------------------------------------------- Screen Attribute Byte: ----------------------------------------------------------------------------- In alphanumeric modes (0-3 and 7), character data is stored in Map 0, character attributes in Map 1, and character patterns in Map 2. Map 0 and Map 1 can be viewed as a single buffer, with a character/attribute pair stored at even addresses. Bit Function 7 Monochrome blinking or color background Intensity 6 Red background 5 Green background 4 Blue background 3 Foreground intensity or character select (see Char. Map Select Reg.) 2 Red foreground 1 Green foreground 0 Blue foreground Mixed colors: Non-intense: Intense: No color = Grey Green + Blue = Cyan Green + Blue = Light Cyan Red + Blue = Magenta Red + Blue = Light Magenta Red + Green = Brown Red + Green = Yellow All three = High intensity white ----------------------------------------------------------------------------- Screen Dynamic Video State Table: ----------------------------------------------------------------------------- This table is returned in a 64K byte buffer using Int 10h, function 1Bh, 'Get Video BIOS Functionality/State Information'. Offset Data type Description 00H DWORD Address of static video functionality table 04H BYTE Video mode 05H WORD Number of displayed character columns 07H WORD Length of displayed portion of video buffer in bytes 09H WORD Start address of upper left corner of video buffer 0BH 16 BYTES Table of cursor locations (col.,row) for 8 video pages 1BH BYTE Cursor end line 1CH BYTE Cursor start line 1DH BYTE Active video page 1EH WORD I/O port for CRTC address register 20H BYTE CRT_MODE_SET (current value of 3x8H register) 21H BYTE CRT_PALETTE (current value of 3x9H register) 22H BYTE Number of displayed character rows 23H WORD POINTS (height of displayed character matrix) 25H BYTE Active display combination code 26H BYTE Inactive display combination code 27H WORD Number of displayed colors (0 for monochrome) 29H BYTE Number of video pages supported 2AH BYTE Raster scan lines: 0=200,1=350,2=400,3=480 2BH BYTE Alphanumeric character table used when attribute bit 3 is 0 (VGA) 0=Block0,...0FFh=Block255 2CH BYTE Alphanumeric character table used when attribute bit 3 is 1 (VGA) 0=Block0,...0FFh=Block255 2DH BYTE Misc. state information (1 if true): Bit 0= all modes active on all video subsytems 1= gray-scale summing enabled 2= monochrome display attached 3= default palette loading disabled 4= cursor emulation enabled 5= blinking attribute enabled 6=7 reserved 2EH BYTE reserved 30H BYTE reserved 31H BYTE Video RAM available: 0=64K,1=128K,2=192K,3=256K 32H BYTE Save area status (1 if true): Bit 0= two alphanumeric char. sets active (VGA) 1= dynamic save area is active 2= alphanumeric char.set override is active 3= graphics char.set override is active 4= palette override is active 5= display combination code extension active 6-7 reserved 33H-33FH Reserved ---------------------------------------------------------------------------- Screen Static Video Functionality Table: ----------------------------------------------------------------------------- The address for this table appears as the first double word in the dynamic video state table. The dynamic video table is returned in a 64K byte buffer using Int 10h, function 1Bh, 'Get Video BIOS Functionality/State Information'. Offset Data type Description 00H BYTE Video modes supported (1 if supported) Bits 0-7=modes 0-7 01H BYTE Video modes supported Bits 0-7=modes 8-15 02H BYTE Video modes supported Bits 0-3=modes 16-19; bits 4-7 reserved 03-06H 4 BYTES Reserved 07H BYTE Scan lines available in alphanumeric mode (1 if avail.) Bit 0=200,1=350,2=400 lines 08H BYTE Maximum number of displayable alphanumeric char.sets 09H BYTE Number of available alphanumeric character definition tables in char. generator ROM 0AH BYTE Misc. video BIOS capabilities (1 if available) Bit 0= all modes on all monitors (0 for MCGA) 1= Gray-scale summing 2= char.set loading 3= default palette loading 4= cursor emulation 5= 64-color palette 6= video DAC loading 7= control of video DAC via attrib. controller color select 0BH BYTE Misc. video BIOS capabilities (1 if available) Bit 0= light pen support 1= save/restore video state 2= blinking/background intensity 3= display combination code 4-7 reserved 0CH BYTE Reserved 0DH BYTE Reserved 0EH BYTE Save area capabilities Bit 0= multiple alphanumeric char.sets 1= dynamic save area 2= alphanumeric char.set override 3= graphics character set override 4= palette override 5= Display Combination Code extension 6-7 reserved 0FH BYTE Reserved ---------------------------------------------------------------------------- Screen Alphanumeric Character Pattern Table: ----------------------------------------------------------------------------- The alphanumeric character pattern table addressis stored in the Int 1Fh vector. This is a pointer to graphic characters to replace 80H-FFH (8x8 matrix read from top to bottom to make 8 bytes per character). Used in color graphics mode. _____________________________________________________________________________ ----------------------------------------------------------------------------- MS-DOS Structures: ---------------------------------------------------------------------------- Disk Parameter Block (DPB): ----------------------------------------------------------------------------- The disk parameter block is an internal parameter block used by MS-DOS, and is built from the BIOS Parameter Block (BPB). Function 32h under Int 21h can be used to locate the disk parameter block. A different disk parameter block can be generated for each unit of a block device driver, supporting different media. The DOS disk partition length limitation of 32 Megabytes comes from the fact that MS-DOS uses WORD storage for logical sector pointers. Each sector is nominally 512 bytes. This limitation is shown in DOS interrupt functions Int 25h and Int 26h. Internal Disk Parameter Block (built by MS-DOS from BPB) Offset Data type Description 00H BYTE Drive Index (0='A', etc.) 01H BYTE Unit code: unit number in device driver 02H WORD Number of bytes/sector 04H BYTE Sectors/cluster - 1 05H BYTE Log base 2 of sectors/cluster 06H WORD Reserved sectors 08H BYTE Number of FAT copies 09H WORD Number of root DIR entries 0BH WORD Sectors in reserve, FATs, and DIR: First data sector 0DH WORD Max number of clusters + 1 available above DIR 0FH BYTE Sectors per FAT (WORD in DOS 4.x, shifting remaining addresses below by one byte.) 10H WORD Sectors in reserve and FATs: First DIR sector 12H DWORD Pointer to device driver for this device 16H BYTE Media descriptor byte (Disk ID byte) 17H BYTE Validity byte: 0FFH means block must be rebuilt 18H DWORD Address of next device driver or -1 if last 1CH WORD Starting cluster of current directory (0 for root) (DOS 2.x) or cluster to start search for next free cluster (DOS 3.x and 4.x) 1EH 64 BYTES ASCIZ string for current directory path (DOS 2.x) or 0FFFFH (DOS 3.x) ---------------------------------------------------------------------------- File Allocation Table (FAT) Structure: ----------------------------------------------------------------------------- 12-bit FAT layout (for DOS 1.x, 2.x, and 3.x if partition is less than 16 Megabytes, i.e. total clusters is less than 4087): Tribble Data type Description (values in hex) Offset 0 TRIBBLE Disk ID byte + F00 1 TRIBBLE Filler = FFF 2 TRIBBLE Cluster Value: 000 = unused 001-FEF = next cluster number FF0-FF6 = reserved cluster FF7 = cluster marked bad FF8-FFF = last cluster in file 003H TRIBBLE Etc. 16-bit FAT layout (for DOS 3.x if partition is greater or equal to 16 Megabytes, i.e. total clusters is 4087 or greater): Word Data type Description (values in hex) Offset 0 WORD Disk ID byte + FF00 1 WORD Filler = FFFF 2 WORD Cluster Value: 0000 = unused 0001-FFEF = next cluster number FFF0-FFF6 = reserved cluster FFF7 = cluster marked bad FFF8-FFFF = last cluster in file For example, the first file disk directory entry might have a starting cluster of 0002. At entry 2 in the FAT, there may be a next cluster value of 0003; at 3 there may be 0008; at 8 one might find FFF8, indicating this indexed position is the last cluster in the file. ---------------------------------------------------------------------------- Disk Directory Entry: (See also FCB) ----------------------------------------------------------------------------- Every formated disk has a root directory where information about files and subdirectories is kept. The root directory begins just after the file allocation tables. Its starting sectory on the disk can be found from the BIOS parameter block on the disk's boot sector. Subdirectories are stored on disk just like files, with their own cluster assignments. The first two file structures in a subdirectory have a dot and a double dot in the filename field, representing the current directory and the parent directory. Offset Data type Description 00H BYTE First character of filename, or E5H if file has been erased, or 00H if directory entry has not been used (there are no more used entries in directory), or 05H if first character of file is to be 0E5H, or 2EH = '.' if this entry is an alias for the current or parent directory. If next byte is a space (20H), the cluster field gives the starting cluster for the current directory. If the next byte is also a dot (2EH), then cluster field has the starting cluster of the parent or zero if the parent is the root directory. 01H 10 BYTES The next 7 characters of the filename and the file extension. Filled with 20H = ' '. 0BH BYTE File attribute: Bit 7-6 Reserved 5 Archive (set whenever file is changed) 4 Subdirectory 3 Volume label (only in root directory) 2 System file 1 Hidden file 0 Read only (file writes denied) 0CH 10 BYTES Reserved 16H WORD Time created or last updated Bit 15-11 Binary number of hours (0-23) 10- 5 Binary number of minutes (0-59) 4- 0 Binary number of even seconds (0-29) 18H WORD Date created or last updated Bit 15- 9 Binary number of years since 1980 8- 5 Binary number of months (1-12) 4- 0 Binary number of days (1-31) 1AH WORD Starting cluster 1CH DWORD File size ----------------------------------------------------------------------------- Disk File Control Block (FCB): (See also Disk Directory Entry) ----------------------------------------------------------------------------- The file control block is a storage buffer for transferring information about a current file to and from the disk operating system. Before the introduction of file handles (i.e. before DOS 2.x), the user was required to set up his own FCBs for each file accessed. The structure of a FCB is: Offset Data type Description -07H BYTE 0FFH = Extended FCB flag indicating seven extra bytes -06H 5 BYTES Reserved -01H BYTE Attribute of file: Bit 5 Archive 4 Subdirectory 3 Volume Label 2 System file 1 Hidden file 0 Read-only file 00H BYTE Drive identification: 0=default, 1='A', etc. 01H 8 BYTES Filename space filled. 09H 3 BYTES File Extension space filled. 0CH WORD Current block (1 block = 128 records) 0EH WORD Record size (default = 80H = 128 bytes) 10H DWORD File size 14H WORD Date created/updated (8 bit:year-1980, 5 bit month, day) 16H WORD Time created/updated (5 bit hour, 6 bit min, even secs) 18H 8 BYTES Reserved (contains device driver pointer) 20H BYTE Current record Offset of record in block ---------------------------------------------------------------------------- Country Information Table: ----------------------------------------------------------------------------- The country information table location can be found by using function 38h, Int 21h. Country Information Table Offset Data type Description 00H WORD date format (see above) 02H 5 BYTES ASCIIZ string showing currency country symbol 07H 2 BYTES ASCIIZ string showing thousands separator character 09H 2 BYTES ASCIIZ string showing decimal separator character 0BH 2 BYTES ASCIIZ string showing date separator character 0DH 2 BYTES ASCIIZ string showing time separator char 0FH BYTE currency format bit 1 = number of spaces between value and currency symb. bit 0 = 0 if currency symbol precedes value 1 if currency symbol follows value 10H BYTE Number of digits after decimal in currency 11H BYTE Time format bit 0 = 0 if 12-hour clock 1 if 24-hour clock 12H DWORD Address of case map routine (FAR CALL) for codes >7Fh Call with AL=ASCII code to be converted, AL=return. 16H BYTE Data-list separator char 17H BYTE Null = 00H 18H 10 BYTES reserved Time and Date format: 0 = USA standard h:m:s m/d/y 1 = Europe standard h:m:s d/m/y 2 = Japan standard h:m:s y:m:d ---------------------------------------------------------------------------- Device Driver Device Information Word: ----------------------------------------------------------------------------- The device information word is passed to a device driver through Int 21h, function 44h (IOCTL). Its setting is very similar to the third word in the device driver header. Bits 15 = 0 reserved 14 = 1 if can handle control codes 13-8 = 0 reserved 7 = 1 character device = 0 block device 6 = 1 EOF on input Character Device: Block Device: 5 = 1 'raw' mode Bits 5-0 = drive index = 0 'cooked' mode (0='A', 1='B', etc.) 4 = 0 reserved 3 = 1 clock 2 = 1 null device 1 = 1 console output device 0 = 1 console input device ---------------------------------------------------------------------------- Device Driver Header: ----------------------------------------------------------------------------- The device driver header appears as the first block of data in a device driver. Device drivers are installed by the operating system, starting with the NUL device driver. MS-DOS contains default device drivers for the console (CON:), a logical printer (PRN:), an auxiliary device (AUX:), serial devices (COMx:), parallel devices (LPTx:), and a system clock (`CLOCK). Replacement or supplemental drivers can be added using device driver file names in the CONFIG.SYS file. Note that a device drive file name may not be the name needed to refer to the device in a device open call. The device name appears at offset +0AH in the device driver header. Offset Data type Description 00H DWORD Pointer to next device or -1 04H WORD attribute: bit: 15 = 1 if character device, 0 if block device 14 = 1 if IOCTL (can handle control strings) 13 = if block device, 1 = non-IBM format if char. device, 1 = supports output-until-busy 12 = 0 reserved 11 = 1 if device supports OPEN/CLOSE/REMOVABLE 7-10 = 0 reserved 6 if supports Get/Set Logical Device 5 if char. device, 1='raw' mode, 0='cooked' mode 4 if char. device, 1=Special 3 if char. device, 1=Current CLOCK$ 2 if char. device, 1=Current NUL Device 1 if char. device, 1=Current Standard Output 0 if char. device, 1=Current Standard Input 06H WORD pointer to strategy entry 08H WORD pointer to interrupt entry 0AH 8 BYTES If char. device, name field If block device, 1 byte unit number Communication with device drivers is usually performed by the operating system through request packets. ---------------------------------------------------------------------------- Device Driver Device Request Header and Device Request Packet: ----------------------------------------------------------------------------- The device request header is used by the operating system to communicate with a particular device driver. It forms the beginning of the device request packet, a memory structure described below: Offset in device request header: For all functions: + 0 byte length + 1 byte unit code ('minor' device index) + 2 byte command code Extended Offset for device request packet: function 0 init : + D byte number of units + E dword break addr +12 dword BPB array function 1 media chk : + D byte media desc. from BPB + E byte returned function 2 build BPB : + D byte media desc. from BPB + E dword transfer addr. (128 bytes) or FAT +12 dword BPB function 3,12 IOCTL in out, 4 read, 8,9 write, with verify + D byte media desc. from BPB + E dword transfer addr +12 word byte/sector count +14 word starting sector number function 5 non-dest. read + D byte read from device function 6 in status, 10 output status function 7 input flush, 11 output flush + 3 word status (0 on entry) bit 15=1=>ERROR in bits 7-0 bit 9=1 device not busy on status call bit 8=1 device operation complete + 5 Dword to ms-dos queue + 9 Dword to device queue ---------------------------------------------------------------------------- Memory Control Block: ----------------------------------------------------------------------------- The memory control block is a 16 byte prefix to all programs and each copy of the environment. It is used by the operating system to keep track of memory allocation, and can be found 16 bytes below the Program Segment Prefix. The first MCB can be found using function 52h of Int 21h. Memory Control Block structure: Offset Data type Description 00H BYTE 4DH if in chain, 5AH if end of chain ('MZ'=Mark Zbikowski) 01H WORD 0 if free or Program owner PSP segment word 03H WORD size (in paragraphs) of controlled memory arena ---------------------------------------------------------------------------- Environment Block: ----------------------------------------------------------------------------- The environment blocks reside in memory just before each child process, unless they have been deallocated by a resident program. The original environment is located just after the COMMAND processor. It can be found by using function 52h of Int 21h to get the first memory control block, then jumping through the MCBs to locate the desired environment block. The environment blocks contain the definitions of variables used by DOS and by application programs. For example, COMSPEC, used in the CONFIG.SYS file, and PATH and PROMPT, used in the AUTOEXEC.BAT file, are entered into the original environment as variables. Moreover, the SET command defines user variables in the environment. Environment Block Structure: Offset Data type Description 00H n1 BYTES ASCIIZ string in form: 'PARAMETER1=VALUE1',0 n1+1 n2 BYTES ASCIIZ string in form: 'PARAMETER2=VALUE2',0 etc. nz BYTE 0 end of variable definition strings nz+1 WORD Count of number of following ASCIIZ strings (DOS 3.xx) nz+3 ns BYTES Name of Current Process as ASCIIZ string (DOS 3.xx) Note that variable definitions end with a double null. The current process ASCIIZ string contains the path and filename for the program residing in memory which owns the environment block. This information was not available before DOS 3.xx. ---------------------------------------------------------------------------- Program Segment Prefix: ----------------------------------------------------------------------------- Before any program is run, MS-DOS sets up a 256 byte program segment prefix containing termination vectors, default file control blocks, and the tail of the command line used to start the program. (This structure is a carry-over from the CP/M operating system.) The file control blocks are filled in with one or two file names if these are found in the correct format in the command line tail. PSP Structure: Offset Data type Description 00H WORD INT 20H 02H WORD end of allocation block segment (top of memory) 04H 2 BYTES reserved 06H WORD number of bytes available in this segment 08H 2 BYTES reserved 0AH DWORD contents of INT 22H termination vector 0EH DWORD contents of INT 23H ^C break vector 12H DWORD contents of INT 24H critical error vector 16H WORD parent PSP segment 18H BYTE open files (0FFH=unused) 19H 19 BYTES reserved 2CH WORD segment of environment block 2EH DWORD old stack address 32H BYTE maximum open files 34H DWORD old file address 36H 25 BYTES reserved 50H WORD long call address to DOS INT 21H handler 5CH 16 BYTES default FCB #1 6CH 16 BYTES default FCB #2 80H 128 BYTES command tail and default DTA ---------------------------------------------------------------------------- DOS Driver List: ----------------------------------------------------------------------------- The DOS drive list is reference data for device drivers kept in memory by the operating system. It is an undocumented internal data area which is strongly version dependent. A pointer to this list is returned by the internal function 52h under Int 21h. Offset Data type Description 00H DWORD Pointer to first disk parameter block (each disk parameter block contains pointer to next one) 04H DWORD Pointer to internal data area 08H DWORD Pointer to CLOCK$ device driver 0CH DWORD Pointer to actual CON: device driver If DOS 2.x: 10H BYTE Number of logical drives in system 11H WORD Maximum bytes/block of any block device (512) 13H DWORD Pointer to current internal disk transfer area 17H n BYTES Beginning of NUL device driver. If DOS 3.x: 10H WORD Maximum bytes/block of any block device (0200h) 12H DWORD Pointer to current internal disk transfer area 16H DWORD Pointer to drive dynamic information array: Drive Dynamic Information Array (81 bytes per drive, starting with drive A: 00H 69 BYTES Current path as ASCIIZ string, starting with 'x:\' 45H DWORD Pointer to disk parameter block for this drive 49H WORD Reserved 4BH DWORD Reserved 4FH DWORD Reserved 1AH DWORD Pointer to data area 1EH WORD Reserved 20H BYTE Number of block devices 21H BYTE Value of LASTDRIVE command in CONFIG.SYS (default 5) 22H n BYTES Beginning of NUL device driver. ----------------------------------------------------------------------------- Font Files and Code Pages Images: ----------------------------------------------------------------------------- Code page images are contained in font files (extension .CPI). These can be downloaded to the device, if the device has a code page switching device driver entry in CONFIG.SYS. Data type Value Description file_header: 8 BYTES ? 0FFH,"font " Font tag (7 characters) 8 BYTES 0 Reserved WORD 1 Number of pointers in header (1 for DOS 3.3) WORD 1 Type of info pointer (1 in DOS 3.3) 2 WORDS ? Offset info, 0 Displacement of info in file info: WORD 1 Number of code page entries code_page_header: WORD ? Size of this code page header 2 WORDS 0,0 Pointer to header of next code page WORD 1 Device type: 1 = display, 2 = printer 8 BYTES ? "EGA " Device sub type ID WORD ? 999 Code page ID 3 WORDS 0 Reserved data_header: WORD 1 Reserved (must be 1) WORD ? Number of fonts WORD ? Length of following font data If the font file is for a display device, then: font_1: BYTE ? character size, rows BYTE ? character size, columns 2 BYTES 0,0 aspect ratio WORD 256 number of characters ... pixel description for all 256 characters ... font_2: ... font_3: ... Else, if font file is for a printer, then: selection_type_1: WORD 1 selection type (1=4201, 2=5202 Proprinter) WORD 12 total number of bytes in control sequences 6 BYTES 5,27,"I",0,27,"6" defines hardware code page 6 BYTES 5,27,"I",4,27,"6" defines downloadable code ... character description of download selection_type_2: WORD 2 selection type WORD 12 total number of bytes in control sequences 6 BYTES 27,"[","T",5,0,0,0,1,181,0,26,"6" select active page 437 ... character description of download _____________________________________________________________________________ ----------------------------------------------------------------------------- DOS File Formats: ----------------------------------------------------------------------------- File EXE Program Header: ----------------------------------------------------------------------------- All .EXE files on disk begin with a header to determine how the segment and pointer registers are to be initialized, and to relocate absolute addresses. EXE header and program structure: Offset Data type Description 00H BYTE 4DH signature byte 1 01H BYTE 5AH signature byte 2 (for Mark Zbikowski) 02H WORD file size modulo 512 04H WORD file size in pages, including header 06H WORD number of relocatable table items 08H WORD size of header in paragraphs 0AH WORD Min. number of paragraphs needed above program 0CH WORD Max. number of paragraphs desired above program 0EH WORD segment displacement of stack module 10H WORD contents of SP at entry 12H WORD word checksum 14H WORD contents of IP register at entry 16H WORD segment of displacement of code module 18H WORD offset of first relocation item in file 1AH WORD overlay number (0 for resident part of program) 1CH n BYTES reserved space relocation table reserved space program and data segments stack segment ----------------------------------------------------------------------------- MicroSoft Object Module Structure: ----------------------------------------------------------------------------- Object modules are files created by language compilers as an intermediate step between source code and machine code. Individually, they have a .OBJ extension to their name. Collectively, in libraries, they have a .LIB extension. Each object module contains a sequence of variable-length records. Each record has the following format: 1 BYTE Record Type (80H to 0B0H) 1 WORD Record Length (for next n+1) n BYTES Record Body 1 BYTE Checksum (Sum of all n+4 bytes = 0 mod 256) Record Types: (Index Fields coded as: Actual length if < 128 size 81H , 2-byte size 84H , 3-byte size 88H , 4-byte size) 80H THEADR Translator Header Record (always first record of .obj file) The record body, the T-module name, is a variable-length field containing: 1 BYTE The length of the name of the object module n BYTES The name of the object module defined by NAME in MASM 88H COMENT Comment Record (never between FIXUPP and LEDATA or LIDATA) Record body: 1 BYTE Attribute: Bit 7=1 No Purge: Utilities should preserve comment. 6=1 No List: Utilities should not list comment. 5-0 0 1 BYTE Comment Class: 0 Language-translator name given by comment. 1 Copyright given by comment. 2-9BH Reserved by Intel 9CH MS-DOS version number. 9DH Memory model: s,c,m,l, and h for small, compact, medium, large, and huge 9EH Sets Microsoft LINK's DOSSEG switch. 9FH Default library search name. A1H Microsoft extensions to Intel object record specifications are used. C0H-FFH Reserved. n BYTES Comment Field 8AH MODEND Module End Record (Always last record in .obj file) Record body: 1 BYTE Module type: Bit 7=1 if module is a main program 6=1 if if this record contains a START address 6-1 0 0=1 START address is relocatable (always for 8086 code) n BYTES START address field (when Module type bit 6=1) Format: EndDat, FrameDat, TargetDat, TargetDispl. (See FIXUPP record for interpretation.) 8CH EXTDEF External Names Definition Record Record body: 1 BYTE Name Length (n= 0-7FH) n BYTES External Name 1 BYTE Type index: TYPDEF record index associated with External Name (unless 0). 8EH TYPDEF Type Definition Record (Precedes EXTDEF or PUBDEF records which reference a TYPDEF) Record body: 1 BYTE Name field (0 for Microsoft TYPDEF) n BYTES Intel Eight-Leaf Descriptor field (Microsoft uses only four) 1 BYTE 0 m BYTES Leaf Descriptor: Four Fields ("Leaves") to describe the type and size of a variable: 1 BYTE Variable Type = 62H if NEAR Variable = 61H if FAR Variable 1 BYTE Variable Subtype (ignored by LINK) = 77H Array 79H Structure (NEAR variable only) 7BH Scalar (NEAR variable only) i BYTES Size of communal variable (if NEAR) or Number of elements of array (if FAR) as an Index Field t BYTES For FAR array only: Index of previous NEAR TYPDEF containing the array data type and size of elements in array; Index of 1 means first TYPDEF, etc. 90H PUBDEF Public Names Definition Record (must be after GRPDEF and SEGDEF records to which it refers; PUBDEF usually placed near end of object module). Record Body: n BYTES Public Base i BYTES Group Index Field references a previous GRPDEF record (0 means no group associated with this PUBDEF) i BYTES Segment Index Field references a previous SEGDEF record (if 0, Frame Number used and Group Index = 0) 1 WORD Frame Number (only if GI and SI = 0). Specifies the start of an absolute segment. Value indicates the number of the frame containing the public name. m BYTES Public Name 1 BYTE Length of name (< 128) p BYTES Name 1 WORD Public Offset of location referred to by Public Name. Offset assumed to lie within segment, group, or frame specified in the public base field. i BYTES Type Index Index Field references a previous TYPDEF. ... Above three fields can be repeated to declare a list of public names. 94H LINNUM Line Number Record relates line numbers in source to addresses in object code. (Must be after SEGDEF to which they refer. LINNUM records generally placed near end of object module). Record body: l BYTES Line Number Base 1 BYTE Group Index = 0 i BYTES Segment Index. Index Field references previous SEGDEF record. 1 WORD Line Number (0 to 32,767) 1 WORD Line Number Offset in executable code in segment specified in the Line Number Base field to which the line number in the Line Number field refers. ... Above two fields can be repeated, so that a single LINNUM record can specify multiple line numbers in the same segment. 96H LNAMES List of Names Record. List of names that can be referenced by subsequent SEGDEF and GRPDEF records. LNAMES records usually placed near start of object module. Record Body: n BYTES Name List 1 BYTE Length of name (0-255) l BYTES Name ... up to 255 logical names, implicitly index 1,2,... 98H SEGDEF Segment Definition Record describes a logical segment in an object module, giving the segment's name, length, alignment, and the way the segment can be combined with other logical segments. LINK limits the number of SEGDEFs to 255 per object module. Record body: n BYTES Segment Attributes 1 BYTE ACBP byte: Bits 7-5 Alignment in the run-time memory map = 0 A = Absolute = 1 Relocatable, byte (1) aligned = 1 Relocatable, word (2) aligned = 1 Relocatable, paragraph (16) aligned = 1 Relocatable, page (256) aligned 4-2 C = Combination with other segments = 0 if A = 0 or private segment = 1 not used by Microsoft = 2 can be concatenated with another segment with the same name; used with 'public' combine type = 3 undefined = 4 same as C = 2 for Microsoft = 5 can be concatenated with another segment with the same name; used with 'stack' combine type = 6 can be overlapped with another segment with the same name; used with 'common' combine type = 7 save as C = 2 for Microsoft 1 B = Big = 1 (and Segment Length = 0) only if the segment is exactly 64K long 0 P = Page-resident (not used in MS-DOS) = 0 for Microsoft x BYTES Frame Number and Offset (present only for A = 0 in ACBP byte) 1 WORD Frame Number for start of segment 1 BYTE Offset (0-0FH) Ignored by LINK 1 WORD Segment Length in bytes (0-0FFFFH). If segment is exactly 64K, Segment Length = 0 and B = 1 in ACBP. i BYTES Segment Name Index Field identifies the segment with a unique name. i BYTES Class Name Index Field identifies the segment with a class name (such as CODE, FAR_DATA, or STACK). The linker places segments with the save class name into a contiguous area of memory in the run-time memory map. i BYTES Overlay Name Index Field identifies the segment with a run-time overlay. Ignored by LINK ver. 2.40 and later. 9AH GRPDEF Group Definition Record defines a group of segments, all of which lie within the same 64K frame in the run-time memory map. LINK limits number of GRPDEF to 21. Record body: i BYTES Group Name Index Field indicates the name in LNAMES record. n BYTES Group Component Descriptor 1 BYTE Type = 0FFH means following field is Segment Index. i BYTES Segment Index Field identifies previous SEGDEF record. ... Group Component Descriptor is usually be repeated. 9CH FIXUPP Fixup Record contains information to allow linker to resole addresses. FIXUPP records describe the location of each address value to be fixed up, the target address to which the fixup refers, and the frame relative to which the address computation is performed. FIXUPP must immedately follow LEDATA or LIDATA record if it refers to one of these. Record body: n BYTES Thread Field. FIXUPP may contain 0 or more Thread Fields. Format: 1 BYTE Thread Data Bits 7 = 0 Start of thread field 6 = 1 if thread specifies a frame 0 if thread specifies a target 5 = 0 unused 4-2 = Method: Frame specified by: 0 a segment index 1 a group index 2 an external index 3 explicit frame number (not supported by LINK) 4 the segment in which the Location is defined; the largest possible frame number is used. 5 the Target's segment, group, or external index. Target specified by: 0 a segment index and a displacement. The displacement is given in the Target Displacement field of the FIXUPP record. 1 a group index and a Target Displacement. 2 an external index and a Target Displacement. LINK adds the displacement to the address it determines from the external name's corresponding PUBDEF record in another object module. 3 an explicit frame number (not supported by LINK). 4 a segment index alone (displacement = 0) 5 a group index alone 6 an external index. The Target is the address associated with the external name. 7 an explicit frame number (not supported by LINK). 1-0 = Thread Number (0-3) for Frame or Target. The thread number can be reused in an object module; if so, it refers to the thread field in which it last appeared. i BYTES Thread Index Field: If Method = 0 : Segment index in previous SEGDEF record 1 : Group index in previous GRPDEF record 2 : External index in previous EXTDEF record 3 : Explicit Frame number (not supported by LINK; ignored) n BYTES Fixup Field; provides information needed to resolve a reference to a relocatable or external address. FIXUPP may contain 0 or more Fixup Fields. Format: 1 WORD Locat field: Bits: 7 = 1 indicates fixup field 6 = M = 1 if fixup is segment relative 0 if fixup is self-relative 5 = S = 0 unused 4-2 = Loc field for type of Location to fix: 0 = Low-order byte 1 = Offset 2 = Segment 3 = Pointer (Segment:offset) 4 = High-order byte (not recognized by LINK) 5 = Loder-resolved offset (treated as Loc=1 by LINK) 1-0,15-8 Data Record Offset; indicates the position of the Location to be fixed in LEDATA or LIDATA immediately preceding the FIXUPP record. This offset indicates either a byte in the Data field of an LEDATA record or a data byte in the Content field of an Iterated Data Block in an LIDATA record. 1 BYTE Fix Dat: Bit 7 = F = 1 if Frame for this fixup is specified by reference to a previous Thread Field; = 0 if the Frame method is explicitly defined in this fixup field. 6-4 = Frame: If F=1, Frame = number (0-3) of thread field containing the Frame method; F=0, Frame = Thread Field Method number (0-5) 3 = T = 1 if Target for fixup is specified by a reference to a previous Thread field 0 if the Target is explicitly defined in this fixup field 2 = P bit; determined by 1-0 bits: 1-0 = Targt field: If T=1, Targt contains the number of the previous Thread field containing the Target method and P bit combined with the 2 low-order bits of the Method field in the Thread field determines the Target method; If T=0, target is explicitly defined and the P and Targt fields contain number (0-6) of one of the Target fixup methods under the Thread Field method bits for Target. i BYTES Frame Datum is an index field that refers to a previous SEGDEF, GRPDEF, or EXTDEF record, depending on the Frame method. i BYTES Target Datum contains a segment index, a group index, or an external index field depending on the Target method. 1 WORD Target Displacement present only if the P bit in the Fixdat field is 0. If so, Target Displacement contains the offset used in methods 0-2 specifing a Target. A0H LEDATA Logical Enumerated Data Record The LEDATA record contains contiguous binary data, executable code or program data, that is eventually copied into the program's executable binary image. Record body: i BYTES Segment Index Field refers to a previous SEGDEF to which data is to be placed. A2H LIDATA Logically Iterated Data Record The LIDATA record contains binary data (code or program data) which can be specified by a repeating pattern rather than by explicit enumeration. Record body: i BYTES Segment Index Field refers to previous SEGDEF to which data is to be placed. 1 WORD Iterated Data Offset into the segment referenced by the Segment Index; relative to the base of the segment; determines where the enumerated data will be placed in the run-time memory map. d BYTES Iterated Data Block (may be nested to contain one or more other iterated data blocks): 1 WORD Repeat Count for contents field 1 WORD Block Count for number of iterated data blocks in content field n BYTES Content: Either nested iterated data blocks if the Block Count is nonzero, or data; if data: 1 BYTE Number of data bytes in field m BYTES Actual data B0H COMDEF Communal Names Definition Record The COMDEF record is a MicroSoft extension to the basic set of Intel record types; recognized by LINK 3.50 and later. Record body (can be repeated): c BYTES Communal Name 1 BYTE Length of name n BYTES Name i BYTES Type Index Field references a previous TYPDEF record in the object module, or 0 if no public name associated. 1 BYTE Data Segment Type = 61H FAR 62H NEAR n BYTES Communal Length indicates the amount of memory to be allocated for the communal variable. If Data Segment Type is NEAR, the Communal Length contains the size (in bytes) of the communal variable; If Data Segment Type is FAR, the Communal Length Field is: i BYTES Number of Elements (Index Field) in communal variable array of elements i BYTES Element Size (Index Field) for each element in the comunal variable array. -----------------------------------------------------------------------------