Calculating an Application's Load Size, Minimum Load Size

Last reviewed: July 17, 1997
Article ID: Q46774
3.x 4.x 5.0x 5.10 5.11 5.13 5.15 5.30 5.31.009 5.50 MS-DOS kbtool

The information in this article applies to:

  • Microsoft LINK for MS-DOS, versions 3.x, 4.x, 5.0x, 5.1, 5.11, 5.13, 5.15, 5.3, 5.31.009, and 5.5

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 Output      Offset in .EXE Header
   ------------------------------------------------

   Bytes on Last Page                 2h-3h
   Pages in File                      4h-5h
   Paragraphs in Header               8h-9h
   Extra Paragraphs Needed            Ah-Bh
   Extra Paragraphs Wanted            Ch-Dh

Given the information in the table above, compute the load size 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

The Load Size is the number of 16-byte paragraphs requested. If not enough memory is available, the application receives all available memory. However, if the memory available is not greater than or equal to the Minimum Load Size, MS-DOS cannot load the program. Compute the Minimum Load Size as follows:

   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 value 20h is the size, in paragraphs, of one page, (512 / 16). The value 10h is the size, in paragraphs, of the 256-byte Program Segment Prefix (PSP) that precedes each program in memory.

For more information, please refer to an MS-DOS reference like the "MS-DOS Encyclopedia" (Microsoft Press), page 124.


Additional reference words: kbinf 3.00 3.60 4.10 5.10 5.30 5.50
KBCategory: kbtool
KBSubcategory: LinkIss
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.