INF: How Minimum Load Size Is Calculated

ID Number: Q46774

3.x 4.x 5.0x 5.10 5.11 5.13 5.15

MS-DOS

Summary:

The MS-DOS program loader uses the following information to calculate

the number of 16-byte paragraphs to use when loading a program:

Name in EXEHDR OutputOffset in .EXE Header

------------------------------------------

Bytes on Last Page2h-3h

Pages in File4h-5h

Paragraphs in Header8h-9h

Extra Paragraphs NeededAh-Bh

Extra Paragraphs WantedCh-Dh

The load size can be computed as follows:

Load Size = Bytes on Last Page * (1 paragraph/10h bytes) +

Pages in File * (20h paragraphs/page) +

10h - Paragraphs in Header +

Extra Paragraphs Wanted

Load Size will be the number of 16-byte paragraphs requested. If there

is not enough memory, all available memory will be used. However, if

the available memory is not greater than or equal to the minimum load

size, then MS-DOS cannot load the program.

Minimum Load Size = Bytes on Last Page * (1 paragraph/10h bytes) +

Pages in File * (20h paragraphs/page) +

10h - Paragraphs in Header +

Extra Paragraphs Needed

The 20h is the size of a page in paragraphs, which is the size of a

page (512 bytes) divided by the size of a paragraph (16 bytes).

The 10h is the size in paragraphs of the 256-byte Program Segment

Prefix (PSP) that precedes all programs in memory.

For more information, refer to a good MS-DOS reference such as the

"MS-DOS Encyclopedia," page 124.

Additional reference words: 3.00 3.01 3.02 3.04 3.05 3.06 3.51 3.55

3.60 3.61 3.64 3.65 3.69 4.06 4.07 4.10 5.01.20 5.01.21 5.02 5.03 5.05

5.10 5.11 5.13 5.15