Dismiss
InnovationQ will be updated on Sunday, Jan. 21, from 9am - 11am ET. You may experience brief service interruptions during that time.
Browse Prior Art Database

Loading Terminate and Stay Resident Modules Into Expanded Memory

IP.com Disclosure Number: IPCOM000122532D
Original Publication Date: 1991-Dec-01
Included in the Prior Art Database: 2005-Apr-04
Document File: 3 page(s) / 117K

Publishing Venue

IBM

Related People

Blackburn, JT: AUTHOR

Abstract

This procedure will explain the steps necessary to load terminate and stay resident (TSR) programs into expanded memory or extended memory used as expanded memory. It is expected that the user of this procedure has an understanding of the use of expanded memory as described in the Lotus, Intel, Microsoft 4.0 EMS specifications. The user should also be familiar with the DOS device drivers XMAEM.SYS and XMA2EMS.SYS.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 51% of the total text.

Loading Terminate and Stay Resident Modules Into Expanded Memory

      This procedure will explain the steps necessary to load
terminate and stay resident (TSR) programs into expanded memory or
extended memory used as expanded memory.  It is expected that the
user of this procedure has an understanding of the use of expanded
memory as described in the Lotus, Intel, Microsoft 4.0 EMS
specifications. The user should also be familiar with the DOS device
drivers XMAEM.SYS and XMA2EMS.SYS.

      This procedure makes use of the information contained in the
file header of an EXE program and assumes familiarity with the format
of that structure.  Since we cannot use the normal load and run
procedure, the program must also make necessary changes to the
Program Segment Prefix after the file has been loaded into expanded
memory.  A familiarity with the format of the PSP will also be
necessary.

      Your program should include a test for the presence of the EMS
device driver and the version installed.  There are differences in
page formats between the two versions.
High-Level Program Flow

      The following is a high-level representation of the procedure
to follow to load one file into expanded memory, execute the code,
and return.  The procedure would be repeated for each individual file
to be loaded.
         Get name of file to open
         Open the file to read
         Read in file header information
         Get file size from header
         Calculate number of 16 KB pages needed (see note 1)
         Allocate EMS pages (see note 2)
         Save EMS handle returned
         Map logical pages to physical pages (see note 3)
         Load file into temporary buffer using DOS load
         overlay (4B03)
         (see note 4)
         Close file
         Copy this programs PSP to start of first page (see
         note 5)
         Set terminate address in new PSP to return point in
         this pro
         gram
         Move file from buffer to expanded memory
         Fix up all relocation addresses in file (see note 6)
         Copy parameters to PSP of file in expanded memory
         Push flags,CS,IP and IRET to file in expanded memory
         (see note 7)
         TSR module executes and returns
         Restore our own PSP (see note 8)
Note 1

      You will need to convert the file size given in 512 byte pages
to 16 KB pages to determine the number required to load the program.
The formula is 32 512 byte pages = 1 16 KB page.  Under the LIM
3.2 spec you will always have a page frame of four 16 KB pages.  LIM
4.0 removes this restriction so you may have less than four.  You
will need to check the number of pages available against what you
need to load the file.
Note 2

      You should save the handle returned from...