EXEHEADER

EXEHEADER STRUC

exSignature dw 5A4Dh ;.EXE signature

exExtraBytes dw ? ;number of bytes in last (partial) page

exPages dw ? ;number of whole and part pages in file

exRelocItems dw ? ;number of pointers in relocation table

exHeaderSize dw ? ;size of header, in paragraphs

exMinAlloc dw ? ;minimum allocation

exMaxAlloc dw ? ;maximum allocation

exInitSS dw ? ;initial ss value

exInitSP dw ? ;initial sp value

exCheckSum dw ? ;complemented checksum

exInitIP dw ? ;initial ip value

exInitCS dw ? ;initial cs value

exRelocTable dw ? ;byte offset to relocation table

exOverlay dw ? ;overlay number

EXEHEADER ENDS

The EXEHEADER structure contains values that MS-DOS uses when loading a relocatable program—values such as the size of the program and the initial values of the registers.

This structure appears at the beginning of the file header for an .EXE file. The complete .EXE file header consists of this structure and a relocation table. The size of the file header, in paragraphs, is specified by the exHeaderSize field.

Fields

exSignature

Specifies the .EXE file signature. This field must be set to 5A4Dh (the ASCII values for the letters M and Z).

exExtraBytes

Specifies the number of bytes in the last (partial) page in the file, as represented by the remainder, if any, when the total number of bytes in the file is divided by 512 (bytes per page).

exPages

Specifies the number of whole and partial pages in the file. Dividing this total number of bytes in the file by 512 (bytes per page) gives the number of whole pages. If the division leaves a remainder, the number of pages is increased by one and the remainder is stored in the exExtraBytes field. For example, in a file 513 bytes long, the exPages field is 2 and the exExtraBytes field is 1.

exRelocItems

Specifies the number of pointers in the relocation table.

exHeaderSize

Specifies the size of the file header, in paragraphs. Since each paragraph has 16 bytes, the file header size is always a multiple of 16.

exMinAlloc

Specifies the minimum amount of extra memory, in paragraphs, required by the program. The extra memory is in addition to the memory required to load the program image. If the values of both exMinAlloc and exMaxAlloc are zero, the program is loaded as high as possible in memory.

exMaxAlloc

Specifies the maximum amount of extra memory, in paragraphs, requested by the program. If the values of both exMinAlloc and exMaxAlloc are zero, the program is loaded as high as possible in memory.

exInitSS

Specifies the initial value of the SS register. The value is a relocatable-segment address. MS-DOS adjusts (relocates) this value when loading the program.

exInitSP

Specifies the initial value of the SP register.

exCheckSum

Specifies the checksum of the file. This value is equal to the one's complement (inverse) of the sum of all 16-bit values in the file, excluding this field.

exInitIP

Specifies the initial value of the IP register.

exInitCS

Specifies the initial value of the CS register. This value is a relocatable-segment address. MS-DOS adjusts (relocates) the value when loading the program.

exRelocTable

Specifies the offset, in bytes, from the beginning of the file to the relocation table.

exOverlay

Specifies a value used for overlay management. If this value is zero, the .EXE file contains the main program.

Comments

The exOverlay field can be followed by additional information used by the system for overlay management. The content and structure of this information depends on the method of overlay management used by the main program.

See Also

Interrupt 21h Function 4B00h Load and Execute Program
Interrupt 21h Function 4B01h Load Program
Interrupt 21h Function 4B03h Load Overlay