home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / emstulkt.zip / EMS4.EXE / 162A.MSG
Text File  |  1989-01-10  |  338KB  |  10,759 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.                                  LOTUS /INTEL /MICROSOFT
  9.  
  10.                               EXPANDED MEMORY SPECIFICATION
  11.  
  12.                                        Version 4.0
  13.  
  14.                                         300275-005
  15.  
  16.                                       October, 1987
  17.  
  18.           Copyright (c) 1987
  19.  
  20.           Lotus Development Corporation
  21.           55 Cambridge Parkway
  22.           Cambridge, MA 02142
  23.  
  24.           Intel Corporation
  25.           5200 NE Elam Young Parkway
  26.           Hillsboro, OR 97124
  27.  
  28.           Microsoft Corporation
  29.           16011 NE 36TH Way
  30.           Box 97017
  31.           Redmond, WA 98073
  32.  
  33.           This specification was jointly developed by Lotus Development
  34.           Corporation, Intel Corporation, and Microsoft Corporation.  Although
  35.           it has been released into the public domain and is not confidential or
  36.           proprietary, the specification is still the copyright and property of
  37.           Lotus Development Corporation, Intel Corporation, and Microsoft
  38.           Corporation.
  39.  
  40.           DISCLAIMER OF WARRANTY
  41.  
  42.           LOTUS DEVELOPMENT CORPORATION, INTEL CORPORATION, AND MICROSOFT
  43.           CORPORATION EXCLUDE ANY AND ALL IMPLIED WARRANTIES, INCLUDING
  44.           WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  45.           NEITHER LOTUS NOR INTEL NOR MICROSOFT MAKE ANY WARRANTY OF
  46.           REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS
  47.           SPECIFICATION, ITS QUALITY, PERFORMANCE, MERCHANTABILITY, OR FITNESS
  48.           FOR A PARTICULAR PURPOSE.  NEITHER LOTUS NOR INTEL NOR MICROSOFT SHALL
  49.           HAVE ANY LIABILITY FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  50.           ARISING OUT OF OR RESULTING FROM THE USE OR MODIFICATION OF THIS
  51.           SPECIFICATION.
  52.  
  53.           This specification uses the following trademarks:
  54.  
  55.           Intel is a trademark of Intel Corporation
  56.           Lotus is a trademark of Lotus Development Corporation
  57.           Microsoft is a trademark of Microsoft Corporation
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.                                                                         1
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.      CHAPTER 1
  74.  
  75.           INTRODUCTION
  76.  
  77.           Because even the maximum amount (640K bytes) of conventional memory
  78.           isn't always enough for large application programs, Lotus Development
  79.           Corporation, Intel Corporation, and Microsoft Corporation created the
  80.           Lotus/Intel/Microsoft (LIM) Expanded Memory Specification.
  81.  
  82.           The LIM Expanded Memory Specification defines the software interface
  83.           between the Expanded Memory Manager (EMM) -- a device driver that
  84.           controls and manages expanded memory -- and application programs that
  85.           use expanded memory.
  86.  
  87.           WHAT IS EXPANDED MEMORY?
  88.  
  89.           Expanded memory is memory beyond DOS's 640K-byte limit.  The LIM
  90.           specification supports up to 32M bytes of expanded memory.  Because
  91.           the 8086, 8088, and 80286 (in real mode) microprocessors can
  92.           physically address only 1M byte of memory, they access expanded memory
  93.           through a window in their physical address range.  The next section
  94.           explains how this is done.
  95.  
  96.           HOW EXPANDED MEMORY WORKS
  97.  
  98.           Expanded memory is divided into segments called logical pages.  These
  99.           pages are typically 16K-bytes of memory.  Your computer accesses
  100.           logical pages through a physical block of memory called a page frame.
  101.           The page frame contains multiple physical pages, pages that the
  102.           microprocessor can address directly.  Physical pages are also
  103.           typically 16K bytes of memory.
  104.  
  105.           This page frame serves as a window into expanded memory.  Just as your
  106.           computer screen is a window into a large spreadsheet, so the page
  107.           frame is a window into expanded memory.
  108.  
  109.           A logical page of expanded memory can be mapped into (made to appear
  110.           in) any one of the physical pages in the page frame.  Thus, a read or
  111.           write to the physical page actually becomes a read or write to the
  112.           associated logical page.  One logical page can be mapped into the page
  113.           frame for each physical page.
  114.  
  115.           The page frame is located above 640K bytes.  Normally, only video
  116.           adapters, network cards, and similar devices exist between 640K and
  117.           1024K.
  118.  
  119.           This specification also defines methods for operating systems and
  120.           environments to access expanded memory through physical pages below
  121.           640K bytes.  These methods are intended for operating
  122.           system/environment developers only.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.                                                                         2
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.      CHAPTER 2
  140.  
  141.           WRITING PROGRAMS THAT USE EXPANDED MEMORY
  142.  
  143.           This chapter describes what every program must do to use expanded
  144.           memory and describes more advanced techniques of using expanded
  145.           memory.
  146.  
  147.           This chapter also lists programming guidelines you should follow when
  148.           writing programs that use expanded memory and provides the listings of
  149.           some example programs.
  150.  
  151.           WHAT EVERY PROGRAM MUST DO
  152.  
  153.           This section describes the steps every program must take to use
  154.           expanded memory.
  155.  
  156.           In order to use expanded memory, applications must perform these steps
  157.           in the following order:
  158.  
  159.           1.  Determine if EMM is installed.
  160.  
  161.           2.  Determine if enough expanded memory pages exist for your
  162.               application. (Function 3)
  163.  
  164.           3.  Allocate expanded memory pages.  (Function 4 or 18)
  165.  
  166.           4.  Get the page frame base address.  (Function 2)
  167.  
  168.           5.  Map in expanded memory pages.  (Function 5 or 17)
  169.  
  170.           6.  Read/write/execute data in expanded memory, just as if it were
  171.               conventional memory.
  172.  
  173.           7.  Return expanded memory pages to expanded memory pool before
  174.               exiting.  (Function 6 or 18)
  175.  
  176.           Table 2-1 overviews the functions while Chapter 3 describes each of
  177.           these functions in detail.  Example programs at the end of this
  178.           chapter illustrate using expanded memory.
  179.  
  180.      TABLE 2-1.  THE BASIC FUNCTIONS
  181.  
  182.           ----------------------------------------------------------------------
  183.           Function                      Description
  184.           ----------------------------------------------------------------------
  185.  
  186.           1   The Get Status function returns a status code indicating whether
  187.               the memory manager hardware is working correctly.
  188.  
  189.           2   The Get Page Frame Address function returns the address where the
  190.               64K-byte page frame is located.
  191.  
  192.           3   The Get Unallocated Page Count function returns the number of
  193.               unallocated pages (pages available to your program) and the total
  194.               number of pages in expanded memory.
  195.  
  196.  
  197.                                                                         3
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.           4   The Allocate Pages function allocates the number of pages
  206.               requested and assigns a unique EMM handle to these pages.
  207.  
  208.           5   The Map/Unmap Handle Page function maps a logical page to a
  209.               specific physical page anywhere in the mappable regions of system
  210.               memory.
  211.  
  212.           6   The Deallocate Pages deallocates the logical pages currently
  213.               allocated to an EMM handle.
  214.  
  215.           7   The Get Version function returns the version number of the memory
  216.               manager software.
  217.  
  218.           ADVANCED PROGRAMMING
  219.  
  220.           In addition to the basic functions, the Lotus/Intel/Microsoft Expanded
  221.           Memory Specification provides several advanced functions which enhance
  222.           the capabilities of software that uses expanded memory.
  223.  
  224.           The following sections describe the advanced programming capabilities
  225.           and list the advanced EMM functions.
  226.  
  227.           Note.............................................................
  228.  
  229.           Before using the advanced functions, programs should first call
  230.           Function 7 (Get Version) to determine whether the installed version of
  231.           EMM supports these functions.
  232.  
  233.           SAVING THE STATE OF MAPPING HARDWARE
  234.  
  235.           Some software (such as interrupt service routines, device drivers, and
  236.           resident software) must save the current state of the mapping
  237.           hardware, switch mapping contexts, manipulate sections of expanded
  238.           memory, and restore the original context of the memory mapping
  239.           hardware.   Use Functions 8 and 9 or 15 and 16 to save the state of
  240.           the hardware.
  241.  
  242.           RETRIEVING HANDLE AND PAGE COUNTS
  243.  
  244.           Some utility programs need to keep track of how expanded memory is
  245.           being used; use Functions 12 through 14 to do this.
  246.  
  247.           MAPPING AND UNMAPPING MULTIPLE PAGES
  248.  
  249.           Mapping multiple pages reduces the overhead an application must
  250.           perform during mapping.  Function 17 lets a program map (or unmap)
  251.           multiple pages at one time.
  252.  
  253.           In addition, you can map pages using segment addresses instead of
  254.           physical pages.  For example, if the page frame base address is set to
  255.           D000, you can map to either physical page 0 or segment D000.  Function
  256.           25 (Get Mappable Physical Address Array) returns a cross reference
  257.           between all expanded memory physical pages and their corresponding
  258.           segment values.
  259.  
  260.  
  261.  
  262.  
  263.                                                                         4
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.           REALLOCATING PAGES
  272.  
  273.           Reallocating pages (Function 18) lets applications dynamically
  274.           allocate expanded memory pages without acquiring another handle or
  275.           obtain a handle without allocating pages.  Reallocating pages is an
  276.           efficient means for applications to obtain and release expanded memory
  277.           pages.
  278.  
  279.           USING HANDLES AND ASSIGNING NAMES TO HANDLES
  280.  
  281.           This specification lets you associate a name with a handle, so a
  282.           family of applications can share information in expanded memory.  For
  283.           example, a software package consisting of a word processor,
  284.           spreadsheet, and print spooler can share the same data among the
  285.           different applications.  The print spooler could use a handle name to
  286.           reference data that either the spreadsheet or word processor put in
  287.           expanded memory and could check for data in a particular handle name's
  288.           expanded memory pages.
  289.  
  290.           Use Function 20 (Set Handle Name subfunction) to assign a handle name
  291.           to an EMM handle or Function 21 (Search for Named Handle subfunction)
  292.           to obtain the EMM handle associated with the handle name.  In
  293.           addition, you can use Function 14 (Get Handle Pages) to determine the
  294.           number of expanded memory pages allocated to an EMM handle.
  295.  
  296.           USING HANDLE ATTRIBUTES
  297.  
  298.           In addition to naming a handle, you can use Function 19 to associate
  299.           an attribute (volatile or non-volatile) with a handle name.  A non-
  300.           volatile attribute enables expanded memory pages to preserve their
  301.           data through a warmboot.
  302.  
  303.           With a volatile attribute, the data is not preserved.  The default
  304.           attribute for handles is volatile.
  305.  
  306.           Because using this function depends on the capabilities of the
  307.           expanded memory hardware installed in the system, you should use the
  308.           Get Attribute Capability subfunction before attempting to assign an
  309.           attribute to a handle's pages.
  310.  
  311.           ALTERING PAGE MAPS AND JUMPING/CALLING
  312.  
  313.           You can use Functions 22 (Alter Page Map and Jump) and 23 (Alter Page
  314.           Map and Call) to map a new set of values into the map registers and
  315.           transfer program control to a specified address within expanded
  316.           memory.  These functions can be used to load and execute code in
  317.           expanded memory.  An application using this feature can significantly
  318.           reduce the amount of conventional memory it requires.  Programs can
  319.           load needed modules into expanded memory at run time and use Functions
  320.           22 and 23 to transfer control to these modules.
  321.  
  322.           Using expanded memory to store code can improve program execution in
  323.           many ways.  For example, sometimes programs need to be divided into
  324.           small overlays because of conventional memory size limitations.
  325.           Overlays targeted for expanded memory can be very large because LIM
  326.           EMS 4.0 supports up to 32M bytes of expanded memory.  This method of
  327.           loading overlays improves overall system performance by conserving
  328.  
  329.                                                                         5
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.           conventional memory and eliminating conventional memory allocation
  338.           errors.
  339.  
  340.           MOVING OR EXCHANGING MEMORY REGIONS
  341.  
  342.           Using Function 24 (Move/Exchange Memory Region), you can easily move
  343.           and exchange data between conventional and expanded memory.  Function
  344.           24 can manipulate up to one megabyte of data with one function call.
  345.           Although applications can perform this operation without this
  346.           function, having the expanded memory manager do it reduces the amount
  347.           of overhead for the application.  In addition, this function checks
  348.           for overlapping regions and performs all the necessary mapping,
  349.           preserving the mapping context from before the exchange/move call.
  350.  
  351.           GETTING THE AMOUNT OF MAPPABLE MEMORY
  352.  
  353.           Function 25 enables applications to determine the total amount of
  354.           mappable memory the hardware/system currently supports.   Not all
  355.           expanded memory boards supply the same number of physical pages (map
  356.           registers).
  357.  
  358.           The Get Mappable Physical Address Array Entries subfunction returns
  359.           the total number of physical pages the expanded memory hardware/system
  360.           is capable of supporting.  The Get Mappable Physical Address Array
  361.           subfunction returns a cross reference between physical page numbers
  362.           and the actual segment address for each of the physical pages.
  363.  
  364.           OPERATING SYSTEM FUNCTIONS
  365.  
  366.           In addition to the functions for application programs, this
  367.           specification defines functions for operating systems/environments.
  368.           These functions can be disabled at any time by the operating
  369.           system/environment, so programs should not depend on their presence.
  370.           Applications that avoid this warning and use these functions run a
  371.           great risk of being incompatible with other programs, including the
  372.           operating system.
  373.  
  374.           TABLE 2-2.  THE ADVANCED FUNCTIONS
  375.  
  376.           ----------------------------------------------------------------------
  377.           Function                 Description
  378.           ----------------------------------------------------------------------
  379.  
  380.           8   The Save Page Map saves the contents of the page mapping registers
  381.               from all expanded memory boards in an internal save area.
  382.  
  383.           9   The Restore Page Map function restores (from an internal save
  384.               area) the page mapping register contents on the expanded memory
  385.               boards for a particular EMM handle.
  386.  
  387.           10  Reserved.
  388.  
  389.           11  Reserved.
  390.  
  391.           12  The Get Handle Count function returns the number of open EMM
  392.               handles in the system.
  393.  
  394.  
  395.                                                                         6
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.           13  The Get Handle Pages function returns the number of pages
  404.               allocated to a specific EMM handle.
  405.  
  406.           14  The Get All Handle Pages function returns an array of the active
  407.               EMM handles and the number of pages allocated to each one.
  408.  
  409.           15  The Get/Set Page Map subfunction saves or restores the mapping
  410.               context for all mappable memory regions (conventional and
  411.               expanded) in a destination array which the application supplies.
  412.  
  413.           16  The Get/Set Partial Page Map subfunction provides a mechanism for
  414.               saving a partial mapping context for specific mappable memory
  415.               regions in a system.
  416.  
  417.           17  The Map/Unmap Multiple Handle Pages function can, in a single
  418.               invocation, map (or unmap) logical pages into as many physical
  419.               pages as the system supports.
  420.  
  421.           18  The Reallocate Pages function can increase or decrease the amount
  422.               of expanded memory allocated to a handle.
  423.  
  424.           19  The Get/Set Handle Attribute function allows an application
  425.               program to determine and set the attribute associated with a
  426.               handle.
  427.  
  428.           20  The Get/Set Handle Name function gets the eight character name
  429.               currently assigned to a handle and can assign an eight character
  430.               name to a handle.
  431.  
  432.           21  The Get Handle Directory function returns information about active
  433.               handles and the names assigned to each.
  434.  
  435.           22  The Alter Page Map & Jump function alters the memory mapping
  436.               context and transfers control to the specified address.
  437.  
  438.           23  The Alter Page Map & Call function alters the specified mapping
  439.               context and transfers control to the specified address.  A return
  440.               can then restore the context and return control to the caller.
  441.  
  442.           24  The Move/Exchange Memory Region function copies or exchanges a
  443.               region of memory from conventional to conventional memory,
  444.               conventional to expanded memory, expanded to conventional memory,
  445.               or expanded to expanded memory.
  446.  
  447.           25  The Get Mappable Physical Address Array function returns an array
  448.               containing the segment address and physical page number for each
  449.               mappable physical page in a system.
  450.  
  451.           26  The Get Expanded Memory Hardware Information function returns an
  452.               array containing the hardware capabilities of the expanded memory
  453.               system.
  454.  
  455.           27  The Allocate Standard/Raw Pages function allocates the number of
  456.               standard or non-standard size pages that the operating system
  457.               requests and assigns a unique EMM handle to these pages.
  458.  
  459.  
  460.  
  461.                                                                         7
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.           28  The Alternate Map Register Set function enables an application to
  470.               simulate alternate sets of hardware mapping registers.
  471.  
  472.           29  The Prepare Expanded Memory Hardware for Warm Boot function
  473.               prepares the expanded memory hardware for an "impending" warm
  474.               boot.
  475.  
  476.           30  The Enable/Disable OS/E function enables operating systems
  477.               developers to enable and disable functions designed for operating
  478.               system use.
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.  
  492.  
  493.  
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.                                                                         8
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.           PROGRAMMING GUIDELINES
  536.  
  537.           The following section contains guidelines for programmers writing
  538.           applications that use EMM.
  539.  
  540.           o   Do not put a program's stack in expanded memory.
  541.  
  542.           o   Do not replace interrupt 67h.  This is the interrupt vector the
  543.               EMM uses.  Replacing interrupt 67h could result in disabling the
  544.               Expanded Memory Manager.
  545.  
  546.           o   Do not map into conventional memory address space your application
  547.               doesn't own.  Applications that use the EMM to swap into
  548.               conventional memory space, must first allocate this space from the
  549.               operating system.  If the operating system is not aware that a
  550.               region of memory it manages is in use, it will think it is
  551.               available.  This could have disastrous results.  EMM should not be
  552.               used to 'allocate' conventional memory.  DOS is the proper manager
  553.               of conventional memory space.  EMM should only be used to swap
  554.               data in conventional memory space previously allocated from DOS.
  555.  
  556.           o   Applications that plan on using data aliasing in expanded memory
  557.               must check for the presence of expanded memory hardware.  Data
  558.               aliasing occurs when mapping one logical page into two or more
  559.               mappable segments.  This makes one 16K-byte expanded memory page
  560.               appear to be in more than one 16K-byte memory address space.  Data
  561.               aliasing is legal and sometimes useful for applications.
  562.  
  563.               Software-only expanded memory emulators cannot perform data
  564.               aliasing.  A simple way to distinguish software emulators from
  565.               actual expanded memory hardware is to attempt data aliasing and
  566.               check the results.  For example, map one logical page into four
  567.               physical pages.  Write to physical page 0.  Read physical pages 1-
  568.               3 to see if the data is there as well.  If the data appears in all
  569.               four physical pages, then expanded memory hardware is installed in
  570.               the system, and data aliasing is supported.
  571.  
  572.           o   Applications should always return expanded memory pages to the
  573.               expanded memory manager upon termination.  These pages will be
  574.               made available for other applications.  If unneeded pages are not
  575.               returned to the expanded memory manager, the system could 'run
  576.               out' of expanded memory pages or expanded memory handles.
  577.  
  578.           o   Terminate and stay resident programs (TSR's) should ALWAYS save
  579.               the state of the map registers before changing them.  Since TSR's
  580.               may interrupt other programs which may be using expanded memory,
  581.               they must not change the state of the page mapping registers
  582.               without first saving them.  Before exiting, TSR's must restore the
  583.               state of the map registers.
  584.  
  585.               The following sections describe the three ways to save and restore
  586.               the state of the map registers.
  587.  
  588.               1  Save Page Map and Restore Page Map (Functions 8 and 9).
  589.                  This is the simplest of the three methods.  The EMM saves
  590.                  the map register contents in its own data structures --
  591.                  the application does not need to provide extra storage
  592.  
  593.                                                                         9
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.                  locations for the mapping context.  The last mapping
  602.                  context to be saved, under a particular handle, will be
  603.                  restored when a call to Restore Page Map is issued with
  604.                  the same handle.  This method is limited to one mapping
  605.                  context for each handle and saves the context for only LIM
  606.                  standard 64K-byte page frames.
  607.  
  608.               2  Get/Set Page Map (Function 15).  This method requires the
  609.                  application to allocate space for the storage array.   The
  610.                  EMM saves the mapping context in an array whose address is
  611.                  passed to the EMM.  When restoring the mapping context
  612.                  with this method, an application passes the address of an
  613.                  array which contains a previously stored mapping context.
  614.  
  615.                  This method is preferable if an application needs to do
  616.                  more than one save before a restore.  It provides a
  617.                  mechanism for switching between more than one mapping
  618.                  context.
  619.  
  620.               3  Get/Set Partial Page Map (Function 16).  This method
  621.                  provides a way for saving a partial mapping context.  It
  622.                  should be used when the application does not need to save
  623.                  the context of all mappable memory.  This function also
  624.                  requires that the storage array be part of the
  625.                  application's data.
  626.  
  627.           o   All functions using pointers to data structures must have those
  628.               data structures in memory which will not be mapped out.  Functions
  629.               22 and 23 (Alter Map and Call and Alter Map and Jump) are the only
  630.               exceptions.
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.                                                                        10
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.      CHAPTER 3
  668.  
  669.           EMM FUNCTIONS
  670.  
  671.           This chapter provides you with a standardized set of expanded memory
  672.           functions.  Because they are standardized, you avoid potential
  673.           compatibility problems with other expanded memory programs that also
  674.           adhere to the memory manager specification.  Programs that deal
  675.           directly with the hardware or that don't adhere to this specification
  676.           will be incompatible.
  677.  
  678.           Table 3-1 presents a sequential list of the EMM functions. The
  679.           remainder of this chapter provides detailed descriptions of each
  680.           function.
  681.  
  682.           TABLE 3-1.  LIST OF EMM FUNCTIONS
  683.  
  684.           ----------------------------------------------------------------------
  685.           Number       Function Name                        Hex Value Page
  686.           ----------------------------------------------------------------------
  687.  
  688.           1  Get Status                                     40h       14
  689.  
  690.           2  Get Page Frame Segment Address                 41h       15
  691.  
  692.           3  Get Unallocated Page Count                     42h       16
  693.  
  694.           4  Allocate Pages                                 43h       17
  695.  
  696.           5  Map/Unmap Handle Page                          44h       20
  697.  
  698.           6  Deallocate Pages                               45h       22
  699.  
  700.           7  Get Version                                    46h       24
  701.  
  702.           8  Save Page Map                                  47h       26
  703.  
  704.           9  Restore Page Map                               48h       28
  705.  
  706.           10 Reserved                                       49h       30
  707.  
  708.           11 Reserved                                       4Ah       31
  709.  
  710.           12 Get Handle Count                               4Bh       32
  711.  
  712.           13 Get Handle Pages                               4Ch       34
  713.  
  714.           14 Get All Handle Pages                           4Dh       36
  715.  
  716.           15 Get Page Map                                   4E00h     38
  717.  
  718.              Set Page Map                                   4E01h     40
  719.  
  720.              Get & Set Page Map                             4E02h     42
  721.  
  722.              Get Size of Page Map Save Array                4E03h     44
  723.  
  724.  
  725.                                                                        11
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.           16 Get Partial Page Map                           4F00h     46
  734.  
  735.              Set Partial Page Map                           4F01h     48
  736.  
  737.              Get Size of Partial Page Map Save Array        4F02h     50
  738.  
  739.           17 Map/Unmap Multiple Handle Pages
  740.              (Physical page number mode)                    5000h     52
  741.  
  742.              Map/Unmap Multiple Handle Pages
  743.              (Segment address mode)                         5001h     56
  744.  
  745.           18 Reallocate Pages                               51h       59
  746.  
  747.           19 Get Handle Attribute                           5200h     62
  748.  
  749.              Set Handle Attribute                           5201h     65
  750.  
  751.              Get Handle Attribute Capability                5202h     67
  752.  
  753.           20 Get Handle Name                                5300h     68
  754.  
  755.              Set Handle Name                                5301h     70
  756.  
  757.           21 Get Handle Directory                           5400h     72
  758.  
  759.              Search for Named Handle                        5401h     74
  760.  
  761.              Get Total Handles                              5402h     76
  762.  
  763.           22 Alter Page Map & Jump
  764.              (Physical page number mode)                    5500h     77
  765.  
  766.              Alter Page Map & Jump
  767.              (Segment address mode)                         5501h     77
  768.  
  769.           23 Alter Page Map & Call
  770.              (Physical page number mode)                    5600h     80
  771.  
  772.              Alter Page Map & Call
  773.              (Segment address mode)                         5601h     80
  774.  
  775.              Get Page Map Stack Space Size                  5602h     84
  776.  
  777.           24 Move Memory Region                             5700h     86
  778.  
  779.              Exchange Memory Region                         5701h     91
  780.  
  781.           25 Get Mappable Physical Address Array            5800h     96
  782.  
  783.              Get Mappable Physical Address Array Entries    5801h     99
  784.  
  785.           26 Get Hardware Configuration Array               5900h     101
  786.  
  787.              Get Unallocated Raw Page Count                 5901h     104
  788.  
  789.           27 Allocate Standard Pages                        5A00h     106
  790.  
  791.                                                                        12
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.              Allocate Raw Pages                             5A01h     109
  800.  
  801.           28 Get Alternate Map Register Set                 5B00h     112
  802.  
  803.              Set Alternate Map Register Set                 5B01h     117
  804.  
  805.              Get Alternate Map Save Array Size              5B02h     120
  806.  
  807.              Allocate Alternate Map Register Set            5B03h     122
  808.  
  809.              Deallocate Alternate Map Register Set          5B04h     124
  810.  
  811.              Allocate DMA Register Set                      5B05h     126
  812.  
  813.              Enable DMA on Alternate Map Register Set       5B06h     128
  814.  
  815.              Disable DMA on Alternate Map Register Set      5B07h     130
  816.  
  817.              Deallocate DMA Register Set                    5B08h     132
  818.  
  819.           29 Prepare Expanded Memory Hardware for Warmboot  5Ch       134
  820.  
  821.           30 Enable OS/E Function Set                       5D00h     135
  822.  
  823.              Disable OS/E Function Set                      5D01h     138
  824.  
  825.              Return OS/E Access Key                         5D02h     140
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.                                                                        13
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.      FUNCTION 1    GET STATUS
  866.  
  867.           PURPOSE
  868.  
  869.           The Get Status function returns a status code indicating whether the
  870.           memory manager is present and the hardware is working correctly.
  871.  
  872.           CALLING PARAMETERS
  873.  
  874.           AH = 40h
  875.                      Contains the Get Status function.
  876.  
  877.           REGISTERS MODIFIED
  878.  
  879.           AX
  880.  
  881.           STATUS
  882.  
  883.           AH = 0     SUCCESSFUL
  884.                      The manager is present in the system, and the hardware is
  885.                      working correctly.
  886.  
  887.           AH = 80h   NON-RECOVERABLE
  888.                      The manager detected a malfunction in the memory manager
  889.                      software.
  890.  
  891.           AH = 81h   NON-RECOVERABLE
  892.                      The manager detected a malfunction in the expanded memory
  893.                      hardware.
  894.  
  895.           AH = 84h   NON-RECOVERABLE
  896.                      The function code passed to the memory manager is not
  897.                      defined.
  898.  
  899.           EXAMPLE
  900.           
  901.           MOV  AH, 40h                       ; load function code
  902.           INT  67h                           ; call the memory manager
  903.           OR   AH, AH                        ; check EMM status
  904.           JNZ  emm_err_handler               ; jump to error handler on error
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.                                                                        14
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.      FUNCTION 2    GET PAGE FRAME ADDRESS
  932.  
  933.           PURPOSE
  934.  
  935.           The Get Page Frame Address function returns the segment address where
  936.           the page frame is located.
  937.  
  938.           CALLING PARAMETERS
  939.  
  940.           AH = 41h
  941.                      Contains the Get Page Frame function.
  942.  
  943.           RESULTS
  944.  
  945.           These results are valid only if the status returned is zero.
  946.  
  947.           BX = page frame segment address
  948.                      Contains the segment address of the page frame.
  949.  
  950.           REGISTERS MODIFIED
  951.  
  952.           AX, BX
  953.  
  954.           STATUS
  955.  
  956.           AH = 0     SUCCESSFUL
  957.                      The manager has returned the page frame address in the BX
  958.                      register.
  959.  
  960.           AH = 80h   NON-RECOVERABLE
  961.                      The manager detected a malfunction in the memory manager
  962.                      software.
  963.  
  964.           AH = 81h   NON-RECOVERABLE
  965.                      The manager detected a malfunction in the expanded memory
  966.                      hardware.
  967.  
  968.           AH = 84h   NON-RECOVERABLE
  969.                      The function code passed to the memory manager is not
  970.                      defined.
  971.  
  972.           EXAMPLE
  973.           
  974.           page_frame_segment                 DW  ?
  975.           
  976.           MOV  AH, 41h                       ; load function code
  977.           INT  67h                           ; call the memory manager
  978.           OR   AH, AH                        ; check EMM status
  979.           JNZ  emm_err_handler               ; jump to error handler on error
  980.           MOV  page_frame_segment, BX        ; save page frame address
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.                                                                        15
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.      FUNCTION 3    GET UNALLOCATED PAGE COUNT
  998.  
  999.           PURPOSE
  1000.  
  1001.           The Get Unallocated Page Count function returns the number of
  1002.           unallocated pages and the total number of expanded memory pages.
  1003.  
  1004.           CALLING PARAMETERS
  1005.  
  1006.           AH = 42h   Contains the Get Unallocated Page Count function.
  1007.  
  1008.           RESULTS
  1009.  
  1010.           These results are valid only if the status returned is zero.
  1011.  
  1012.           BX = unallocated pages
  1013.                      The number of expanded memory pages that are currently
  1014.                      available for use (unallocated).
  1015.  
  1016.           DX = total pages
  1017.                      The total number expanded memory pages.
  1018.  
  1019.           REGISTERS MODIFIED
  1020.  
  1021.           AX, BX, DX
  1022.  
  1023.           STATUS
  1024.  
  1025.           AH = 0     SUCCESSFUL
  1026.                      The manager has returned the number of unallocated pages
  1027.                      and the number of total pages in expanded memory.
  1028.  
  1029.           AH = 80h   NON-RECOVERABLE
  1030.                      The manager detected a malfunction in the memory manager
  1031.                      software.
  1032.  
  1033.           AH = 81h   NON-RECOVERABLE
  1034.                      The manager detected a malfunction in the expanded memory
  1035.                      hardware.
  1036.  
  1037.           AH = 84h   NON-RECOVERABLE
  1038.                      The function code passed to the memory manager is not
  1039.                      defined.
  1040.  
  1041.           EXAMPLE
  1042.           
  1043.           un_alloc_pages                     DW  ?
  1044.           total_pages                        DW  ?
  1045.           
  1046.           MOV  AH, 42h                       ; load function code
  1047.           INT  67h                           ; call the memory manager
  1048.           OR   AH, AH                        ; check EMM status
  1049.           JNZ  emm_err_handler               ; jump to error handler on error
  1050.           MOV  un_alloc_pages, BX            ; save unallocated page count
  1051.           MOV  total_pages, DX               ; save total page count
  1052.  
  1053.  
  1054.  
  1055.                                                                        16
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.      FUNCTION 4    ALLOCATE PAGES
  1064.  
  1065.           PURPOSE
  1066.  
  1067.           The Allocate Pages function allocates the number of pages requested
  1068.           and assigns a unique EMM handle to these pages.  The EMM handle owns
  1069.           these pages until the application deallocates them.
  1070.  
  1071.           Handles which are assigned using this function will have 16K-byte
  1072.           pages, the size of a standard expanded memory page.  If the expanded
  1073.           memory board hardware isn't able to supply 16K-byte pages, it will
  1074.           emulate them by combining multiple non-standard size pages to form a
  1075.           single 16K-byte page.  All application programs and functions that use
  1076.           the handles this function returns will deal with 16K-byte pages.
  1077.  
  1078.           The numeric value of the handles the EMM returns are in the range of 1
  1079.           to 254 decimal (0001h to 00FEh).  The OS handle (handle value 0) is
  1080.           never returned by the Allocate Pages function.  Also, the uppermost
  1081.           byte of the handle will be zero and cannot be used by the application.
  1082.           A memory manager should be able to supply up to 255 handles, including
  1083.           the OS handle.  An application can use Function 21 to find out how
  1084.           many handles an EMM supports.
  1085.  
  1086.           Allocating zero pages to a handle is not valid.  If an application
  1087.           needs to allocate 0 pages to a handle it should use Function 27
  1088.           provided for this purpose.
  1089.  
  1090.           Note...............................................................
  1091.  
  1092.           This note affects expanded memory manager implementers and operating
  1093.           system developers only.  Applications should not use the following
  1094.           characteristic of the memory manager.  An application violating this
  1095.           rule will be incompatible with future versions of Microsoft's
  1096.           operating systems and environments.
  1097.  
  1098.           To be compatible with this specification, an expanded memory manager
  1099.           will provide a special handle which is available to the operating
  1100.           system only.  This handle will have a value of 0000h and will have a
  1101.           set of pages allocated to it when the expanded memory manager driver
  1102.           installs.  The pages that the memory manager will automatically
  1103.           allocate to handle 0000h are those that backfill conventional memory.
  1104.           Typically, this backfill occurs between addresses 40000h (256K) and
  1105.           9FFFFh (640K).  However, the range can extend below and above this
  1106.           limit if the hardware and memory manager have the capability.
  1107.  
  1108.           An operating system won't have to invoke Function 4 to obtain this
  1109.           handle because it can assume the handle already exists and is
  1110.           available for use immediately after the expanded memory device driver
  1111.           installs.  When an operating system wants to use this handle, it uses
  1112.           the special handle value of 0000h. The operating system will be able
  1113.           to invoke any EMM function using this special handle value.  To
  1114.           allocate pages to this handle, the operating system need only invoke
  1115.           Function 18 (Reallocate pages)..
  1116.  
  1117.           There are two special cases for this handle:
  1118.  
  1119.  
  1120.  
  1121.                                                                        17
  1122.  
  1123.  
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.           1.  Function 4 (Allocate Pages).  This function must never return zero
  1130.               as a handle value.  Applications must always invoke Function 4 to
  1131.               allocate pages and obtain a handle which identifies the pages
  1132.               which belong to it.  Since Function 4 never returns a handle value
  1133.               of zero, an application will never gain access to this special
  1134.               handle.
  1135.  
  1136.           2.  Function 6 (Deallocate Pages). If the operating system uses it to
  1137.               deallocate the pages which are allocated to this special handle,
  1138.               the pages the handle owns will be returned to the manager for use.
  1139.               But the handle will not be available for reassignment.  The
  1140.               manager should treat a deallocate pages function request for this
  1141.               handle the same as a reallocate pages function request, where the
  1142.               number of pages to reallocate to this handle is zero.
  1143.  
  1144.           CALLING PARAMETERS
  1145.  
  1146.           AH = 43h
  1147.                      Contains the Allocate Pages function.
  1148.  
  1149.           BX = num_of_pages_to_alloc
  1150.                      Contains the number of pages you want your program to
  1151.                      allocate.
  1152.  
  1153.           RESULTS
  1154.  
  1155.           These results are valid only if the status returned is zero.
  1156.  
  1157.           DX = handle
  1158.                      Contains a unique EMM handle.  Your program must use this
  1159.                      EMM handle (as a parameter) in any function that requires
  1160.                      it.  You can use up to 255 handles.  The uppermost byte of
  1161.                      the handle will be zero and cannot be used by the
  1162.                      application.
  1163.  
  1164.           REGISTERS MODIFIED
  1165.  
  1166.           AX, DX
  1167.  
  1168.           STATUS
  1169.  
  1170.           AH = 0     SUCCESSFUL
  1171.                      The manager has allocated the requested pages to the
  1172.                      assigned EMM handle.
  1173.  
  1174.           AH = 80h   NON-RECOVERABLE
  1175.                      The manager detected a malfunction in the memory manager
  1176.                      software.
  1177.  
  1178.           AH = 81h   NON-RECOVERABLE
  1179.                      The manager detected a malfunction in the expanded memory
  1180.                      hardware.
  1181.  
  1182.           AH = 84h   NON-RECOVERABLE
  1183.                      The function code passed to the memory manager is not
  1184.                      defined.
  1185.  
  1186.  
  1187.                                                                        18
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.           AH = 85h   RECOVERABLE
  1196.                      All EMM handles are being used.
  1197.  
  1198.           AH = 87h   RECOVERABLE
  1199.                      There aren't enough expanded memory pages present in the
  1200.                      system to satisfy your program's request.
  1201.  
  1202.           AH = 88h   RECOVERABLE
  1203.                      There aren't enough unallocated pages to satisfy your
  1204.                      program's request.
  1205.  
  1206.           AH = 89h   RECOVERABLE
  1207.                      Your program attempted to allocate zero pages.
  1208.  
  1209.           EXAMPLE
  1210.           
  1211.           num_of_pages_to_alloc              DW  ?
  1212.           emm_handle                         DW  ?
  1213.           
  1214.           MOV  BX, num_of_pages_to_alloc     ; load number of pages
  1215.           MOV  AH, 43h                       ; load function code
  1216.           INT  67h                           ; call the memory manager
  1217.           OR   AH, AH                        ; check EMM status
  1218.           JNZ  emm_err_handler               ; jump to error handler on error
  1219.           MOV  emm_handle, DX                ; save EMM handle
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.                                                                        19
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.      FUNCTION 5    MAP/UNMAP HANDLE PAGES
  1262.  
  1263.           PURPOSE
  1264.  
  1265.           The Map/Unmap Handle Page function maps a logical page at a specific
  1266.           physical page anywhere in the mappable regions of system memory.
  1267.           The lowest valued physical page numbers are associated with regions of
  1268.           memory outside the conventional memory range.  Use Function 25 (Get
  1269.           Mappable Physical Address Array) to determine which physical pages
  1270.           within a system are mappable and determine the segment addresses which
  1271.           correspond to a specific physical page number.  Function 25 provides a
  1272.           cross reference between physical page numbers and segment addresses.
  1273.  
  1274.           This function can also unmap physical pages, making them inaccessible
  1275.           for reading or writing.  You unmap a physical page by setting its
  1276.           associated logical page to FFFFh.
  1277.  
  1278.           You might unmap an entire set of mapped pages, for example, before
  1279.           loading and executing a program.  Doing so ensures the loaded program,
  1280.           if it accesses expanded memory, won't access the pages your program
  1281.           has mapped.  However, you must save the mapping context before you
  1282.           unmap the physical pages.  This enables you to restore it later so you
  1283.           can access the memory you mapped there.  To save the mapping context,
  1284.           use Function 8, 15, or 16.  To restore the mapping context, use
  1285.           Function 9, 15, or 16.
  1286.  
  1287.           The handle determines what type of pages are being mapped. Logical
  1288.           pages allocated by Function 4 and Function 27 (Allocate Standard Pages
  1289.           subfunction) are referred to as pages and are 16K bytes long.  Logical
  1290.           pages allocated by Function 27 (Allocate Raw Pages subfunction) are
  1291.           referred to as raw pages and might not be the same size as logical
  1292.           pages.
  1293.  
  1294.           CALLING PARAMETERS
  1295.  
  1296.           AH = 44h
  1297.                      Contains the Map Handle Page function.
  1298.  
  1299.           AL = physical_page_number
  1300.                      Contains the number of the physical page into which the
  1301.                      logical page number is to be mapped.  Physical pages are
  1302.                      numbered zero relative.
  1303.  
  1304.           BX = logical_page_number
  1305.                      Contains the number of the logical page to be mapped at the
  1306.                      physical page within the page frame.  Logical pages are
  1307.                      numbered zero relative.  The logical page must be in the
  1308.                      range zero through (number of pages allocated to the EMM
  1309.                      handle - 1).  However, if BX contains logical page number
  1310.                      FFFFh, the physical page specified in AL will be unmapped
  1311.                      (be made inaccessible for reading or writing).
  1312.  
  1313.           DX = emm_handle
  1314.                      Contains the EMM handle your program received from Function
  1315.                      4 (Allocate Pages).
  1316.  
  1317.           REGISTERS MODIFIED
  1318.  
  1319.                                                                        20
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.           AX
  1328.  
  1329.           STATUS
  1330.  
  1331.           AH = 0     SUCCESSFUL
  1332.                      The manager has mapped the page.  The page is ready to be
  1333.                      accessed.
  1334.  
  1335.           AH = 80h   NON-RECOVERABLE
  1336.                      The manager detected a malfunction in the memory manager
  1337.                      software.
  1338.  
  1339.           AH = 81h   NON-RECOVERABLE
  1340.                      The manager detected a malfunction in the expanded memory
  1341.                      hardware.
  1342.  
  1343.           AH = 83h   NON-RECOVERABLE
  1344.                      The memory manager couldn't find the EMM handle your
  1345.                      program specified.
  1346.  
  1347.           AH = 84h   NON-RECOVERABLE
  1348.                      The function code passed to the memory manager isn't
  1349.                      defined.
  1350.  
  1351.           AH = 8Ah   RECOVERABLE
  1352.                      The logical page is out of the range of logical pages which
  1353.                      are allocated to the EMM handle.  This status is also
  1354.                      returned if a program attempts map a logical page when no
  1355.                      logical pages are allocated to the handle.
  1356.  
  1357.           AH = 8Bh   RECOVERABLE
  1358.                      The physical page number is out of the range of allowable
  1359.                      physical pages.  The program can recover by attempting to
  1360.                      map into memory at a physical page which is within the
  1361.                      range of allowable physical pages.
  1362.  
  1363.           EXAMPLE
  1364.           
  1365.           emm_handle                         DW  ?
  1366.           logical_page_number                DW  ?
  1367.           physical_page_number               DB  ?
  1368.           
  1369.           MOV  DX, emm_handle                ; load EMM handle
  1370.           MOV  BX, logical_page_number       ; load logical page number
  1371.           MOV  AL, physical_page_number      ; load physical page number
  1372.           MOV  AH, 44h                       ; load function code
  1373.           INT  67h                           ; call the memory manager
  1374.           OR   AH, AH                        ; check EMM status
  1375.           JNZ  emm_err_handler               ; jump to error handler on error
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.  
  1383.  
  1384.  
  1385.                                                                        21
  1386.  
  1387.  
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.      FUNCTION 6    DEALLOCATE PAGES
  1394.  
  1395.           PURPOSE
  1396.  
  1397.           Deallocate Pages deallocates the logical pages currently allocated to
  1398.           an EMM handle.  Only after the application deallocates these pages can
  1399.           other applications use them.  When a handle is deallocated, it name is
  1400.           set to all ASCII nulls (binary zeros).
  1401.  
  1402.           Note...............................................................
  1403.  
  1404.           A program must perform this function before it exits to DOS. If it
  1405.           doesn't, no other programs can use these pages or the EMM handle.
  1406.           This means that a program using expanded memory should trap critical
  1407.           errors and control-break if there is a chance that the program will
  1408.           have allocated pages when either of these events occur.
  1409.  
  1410.           Calling Parameters
  1411.  
  1412.           AH = 45h
  1413.                      Contains the Deallocate Pages function.
  1414.  
  1415.           DX = handle
  1416.                      Contains the EMM handle returned by Function 4 (Allocate
  1417.                      Pages).
  1418.  
  1419.           REGISTERS MODIFIED
  1420.  
  1421.           AX
  1422.  
  1423.           STATUS
  1424.  
  1425.           AH = 0     SUCCESSFUL
  1426.                      The manager has deallocated the pages previously allocated
  1427.                      to the EMM handle.
  1428.  
  1429.           AH = 80h   NON-RECOVERABLE
  1430.                      The manager detected a malfunction in the memory manager
  1431.                      software.
  1432.  
  1433.           AH = 81h   NON-RECOVERABLE
  1434.                      The manager detected a malfunction in the expanded memory
  1435.                      hardware.
  1436.  
  1437.           AH = 83h   NON-RECOVERABLE
  1438.                      The manager couldn't find the specified EMM handle.
  1439.  
  1440.           AH = 84h   NON-RECOVERABLE
  1441.                      The function code passed to the memory manager is not
  1442.                      defined.
  1443.  
  1444.           AH = 86h   RECOVERABLE
  1445.                      The memory manager detected a save or restore  page mapping
  1446.                      context error (Function 8 or 9).  There is a page mapping
  1447.                      register state in the save area for the specified EMM
  1448.                      handle.  Save Page Map (Function 8) placed it there and a
  1449.                      subsequent Restore Page Map (Function 9) has not removed
  1450.  
  1451.                                                                        22
  1452.  
  1453.  
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.                      it.  If you have saved the mapping context, you must
  1460.                      restore it before you deallocate the EMM handle's pages.
  1461.  
  1462.           EXAMPLE
  1463.           
  1464.           emm_handle                         DW  ?
  1465.           
  1466.           MOV  DX, emm_handle                ; load EMM handle
  1467.           MOV  AH, 45h                       ; load function code
  1468.           INT  67h                           ; call the memory manager
  1469.           OR   AH, AH                        ; check EMM status
  1470.           JNZ  emm_err_handler               ; jump to error handler on error
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.                                                                        23
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.      FUNCTION 7    GET VERSION
  1526.  
  1527.           PURPOSE
  1528.  
  1529.           The Get Version function returns the version number of the memory
  1530.           manager software.
  1531.  
  1532.           CALLING PARAMETERS
  1533.  
  1534.           AH = 46h
  1535.                      Contains the Get Version function.
  1536.  
  1537.           RESULTS
  1538.  
  1539.           These results are valid only if the status returned is zero.
  1540.  
  1541.           AL = version number
  1542.                      Contains the memory manager's version number in binary
  1543.                      coded decimal (BCD) format.  The upper four bits contain
  1544.                      the integer digit of the version number.  The lower four
  1545.                      bits contain the fractional digit of version number.  For
  1546.                      example, version 4.0 is represented like this:
  1547.  
  1548.                                              0100 0000
  1549.                                                /   \
  1550.                                               4  .  0
  1551.  
  1552.                      When checking for a version number, an application should
  1553.                      check for a version number or greater.  Vendors may use the
  1554.                      fractional digit to indicate enhancements or corrections to
  1555.                      their memory managers.  Therefore, to allow for future
  1556.                      versions of memory managers, an application shouldn't
  1557.                      depend on an exact version number.
  1558.  
  1559.           REGISTERS MODIFIED
  1560.  
  1561.           AX
  1562.  
  1563.           STATUS
  1564.  
  1565.           AH = 0     SUCCESSFUL
  1566.                      The manager is present in the system and the hardware is
  1567.                      working correctly.
  1568.  
  1569.           AH = 80h   NON-RECOVERABLE
  1570.                      The manager detected a malfunction in the memory manager
  1571.                      software.
  1572.  
  1573.           AH = 81h   NON-RECOVERABLE
  1574.                      The manager detected a malfunction in the expanded memory
  1575.                      hardware.
  1576.  
  1577.           AH = 84h   NON-RECOVERABLE
  1578.                      The function code passed to the memory manager is not
  1579.                      defined.
  1580.  
  1581.           EXAMPLE
  1582.  
  1583.                                                                        24
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.           
  1592.           emm_version                        DB  ?
  1593.           
  1594.           MOV  AH, 46h                       ; load function code
  1595.           INT  67h                           ; call the memory manager
  1596.           OR   AH, AH                        ; check EMM status
  1597.           JNZ  emm_err_handler               ; jump to error handler on error
  1598.           MOV  emm_version, AL               ; save version number
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.  
  1614.  
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.  
  1649.                                                                        25
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.      FUNCTION 8    SAVE PAGE MAP
  1658.  
  1659.           PURPOSE
  1660.  
  1661.           Save Page Map saves the contents of the page mapping registers on all
  1662.           expanded memory boards in an internal save area.  The function is
  1663.           typically used to save the memory mapping context of the EMM handle
  1664.           that was active when a software or hardware interrupt occurred.  (See
  1665.           Function 9, Restore Page Map, for the restore operation.)  If you're
  1666.           writing a resident program, an interrupt service, or a device driver
  1667.           that uses expanded memory, you must save the state of the mapping
  1668.           hardware.  You must save this state because application software using
  1669.           expanded memory may be running when your program is invoked by a
  1670.           hardware interrupt, a software interrupt, or DOS.
  1671.  
  1672.           The Save Page Map function requires the EMM handle that was assigned
  1673.           to your resident program, interrupt service routine, or device driver
  1674.           at the time it was initialized. This is not the EMM handle that the
  1675.           application software was using when your software interrupted it.
  1676.  
  1677.           The Save Page Map function saves the state of the map registers for
  1678.           only the 64K-byte page frame defined in versions 3.x of this
  1679.           specification.  Since all applications written to LIM versions 3.x
  1680.           require saving the map register state of only this 64K-byte page
  1681.           frame, saving the entire mapping state for a large number of mappable
  1682.           pages would be inefficient use of memory.  Applications that use a
  1683.           mappable memory region outside the LIM 3.x page frame should use
  1684.           Function 15 or 16 to save and restore the state of the map registers.
  1685.  
  1686.           CALLING PARAMETERS
  1687.  
  1688.           AH = 47h
  1689.                      Contains the Save Page Map function.
  1690.  
  1691.           DX = handle
  1692.                      Contains the EMM handle assigned to the interrupt service
  1693.                      routine that's servicing the software or hardware
  1694.                      interrupt.  The interrupt service routine needs to save the
  1695.                      state of the page mapping hardware before mapping any
  1696.                      pages.
  1697.  
  1698.           REGISTERS MODIFIED
  1699.  
  1700.           AX
  1701.  
  1702.           STATUS
  1703.  
  1704.           AH = 0     SUCCESSFUL
  1705.                      The manager has saved the state of the page mapping
  1706.                      hardware.
  1707.  
  1708.           AH = 80h   NON-RECOVERABLE
  1709.                      The manager detected a malfunction in the memory manager
  1710.                      software.
  1711.  
  1712.  
  1713.  
  1714.  
  1715.                                                                        26
  1716.  
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.           AH = 81h   NON-RECOVERABLE
  1724.                      The manager detected a malfunction in the expanded memory
  1725.                      hardware.
  1726.  
  1727.           AH = 83h   NON-RECOVERABLE
  1728.                      The memory manager couldn't find the EMM handle your
  1729.                      program specified.
  1730.  
  1731.           AH = 84h   NON-RECOVERABLE
  1732.                      The function code passed to the memory manager is not
  1733.                      defined.
  1734.  
  1735.           AH = 8Ch   NON-RECOVERABLE
  1736.                      There is no room in the save area to store the state of the
  1737.                      page mapping registers.  The state of the map registers has
  1738.                      not been saved.
  1739.  
  1740.           AH = 8Dh   CONDITIONALLY-RECOVERABLE
  1741.                      The save area already contains the page mapping register
  1742.                      state for the EMM handle your program specified.
  1743.  
  1744.           EXAMPLE
  1745.           
  1746.           emm_handle                         DW  ?
  1747.           
  1748.           MOV  DX, emm_handle                ; load EMM handle
  1749.           MOV  AH, 47h                       ; load function code
  1750.           INT  67h                           ; call the memory manager
  1751.           OR   AH, AH                        ; check EMM status
  1752.           JNZ  emm_err_handler               ; jump to error handler on error
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.                                                                        27
  1782.  
  1783.  
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.      FUNCTION 9    RESTORE PAGE MAP
  1790.  
  1791.           PURPOSE
  1792.  
  1793.           The Restore Page Map function restores the page mapping register
  1794.           contents on the expanded memory boards for a particular EMM handle.
  1795.           This function lets your program restore the contents of the mapping
  1796.           registers its EMM handle saved. (See Function 8, Save Page Map for the
  1797.           save operation.)
  1798.  
  1799.           If you're writing a resident program, an interrupt service routine, or
  1800.           a device driver that uses expanded memory, you must restore the
  1801.           mapping hardware to the state it was in before your program took over.
  1802.           You must save this state because application software using expanded
  1803.           memory might have been running when your program was invoked.
  1804.  
  1805.           The Restore Page Map function requires the EMM handle that was
  1806.           assigned to your resident program, interrupt service routine, or
  1807.           device driver at the time it was initialized.  This is not the EMM
  1808.           handle that the application software was using when your software
  1809.           interrupted it.
  1810.  
  1811.           The Restore Page Map function restores the state of the map registers
  1812.           for only the 64K-byte page frame defined in versions 3.x of this
  1813.           specification.  Since all applications written to LIM versions 3.x
  1814.           require restoring the map register state of only this 64K-byte page
  1815.           frame, restoring the entire mapping state for a large number of
  1816.           mappable pages would be inefficient use of memory.  Applications that
  1817.           use a mappable memory region outside the LIM 3.x page frame should use
  1818.           Function 15 or 16 to save and restore the state of the map registers.
  1819.  
  1820.           CALLING PARAMETERS
  1821.  
  1822.           AH = 48h
  1823.                      Contains the Restore Page Map function.
  1824.  
  1825.           DX = emm_handle
  1826.                      Contains the EMM handle assigned to the interrupt service
  1827.                      routine that's servicing the software or hardware
  1828.                      interrupt.  The interrupt service routine needs to restore
  1829.                      the state of the page mapping hardware.
  1830.  
  1831.           REGISTERS MODIFIED
  1832.  
  1833.           AX
  1834.  
  1835.           STATUS
  1836.  
  1837.           AH = 0     SUCCESSFUL
  1838.                      The manager has restored the state of the page mapping
  1839.                      registers.
  1840.  
  1841.           AH = 80h   NON-RECOVERABLE
  1842.                      The manager detected a malfunction in the memory manager
  1843.                      software.
  1844.  
  1845.  
  1846.  
  1847.                                                                        28
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.           AH = 81h   NON-RECOVERABLE
  1856.                      The manager detected a malfunction in the expanded memory
  1857.                      hardware.
  1858.  
  1859.           AH = 83h   NON-RECOVERABLE
  1860.                      The memory manager couldn't find the EMM handle your
  1861.                      program specified.
  1862.  
  1863.           AH = 84h   NON-RECOVERABLE
  1864.                      The function code passed to the memory manager is not
  1865.                      defined.
  1866.  
  1867.           AH = 8Eh   CONDITIONALLY-RECOVERABLE
  1868.                      There is no page mapping register state in the save area
  1869.                      for the specified EMM handle.  Your program didn't save the
  1870.                      contents of the page mapping hardware, so Restore Page Map
  1871.                      can't restore it.
  1872.  
  1873.           EXAMPLE
  1874.           
  1875.           emm_handle                         DW  ?
  1876.           
  1877.           MOV  DX, emm_handle                ; load EMM handle
  1878.           MOV  AH, 48h                       ; load function code
  1879.           INT  67h                           ; call the memory manager
  1880.           OR   AH, AH                        ; check EMM status
  1881.           JNZ  emm_err_handler               ; jump to error handler on error
  1882.  
  1883.  
  1884.  
  1885.  
  1886.  
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.  
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.                                                                        29
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.      FUNCTION 10   RESERVED
  1922.  
  1923.           In earlier versions of the Lotus/Intel/Microsoft Expanded Memory
  1924.           Specification the use of this function was documented.  This function
  1925.           is now documented as "RESERVED" (i.e. not documented) in the public
  1926.           versions of the specification and new programs should not use it.
  1927.           
  1928.           Existing programs that use this function may still work correctly if
  1929.           the hardware is capable of supporting them.  Since IBM Microchannel
  1930.           hardware is not capable of supporting this function, it cannot be
  1931.           implemented in the IBM Microchannel architecture.  However, programs
  1932.           that use Functions 16 through 30 in Version 4.0 of this specification
  1933.           must not use Functions 10 and 11.  These functions won't work
  1934.           correctly if a program attempts to mix the use of the new functions
  1935.           (Functions 16 through 30) and functions 10 and 11.  Functions 10 and
  1936.           11 are specific to the hardware on Intel expanded memory boards and
  1937.           will not work correctly on all vendors expanded memory boards.
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.  
  1944.  
  1945.  
  1946.  
  1947.  
  1948.  
  1949.  
  1950.  
  1951.  
  1952.  
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.                                                                        30
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.      FUNCTION 11   RESERVED
  1988.  
  1989.           In earlier versions of the Lotus/Intel/Microsoft Expanded Memory
  1990.           Specification the use of this function was documented.  This function
  1991.           is now documented as "RESERVED" (i.e. not documented) in the public
  1992.           versions of the specification and new programs should not use it.
  1993.           
  1994.           Existing programs that use this function may still work correctly if
  1995.           the hardware is capable of supporting them.  Since IBM Microchannel
  1996.           hardware is not capable of supporting this function, it cannot be
  1997.           implemented in the IBM Microchannel architecture.  However, programs
  1998.           that use Functions 16 through 30 in Version 4.0 of this specification
  1999.           must not use Functions 10 and 11.  These functions won't work
  2000.           correctly if a program attempts to mix the use of the new functions
  2001.           (Functions 16 through 30) and functions 10 and 11.  Functions 10 and
  2002.           11 are specific to the hardware on Intel expanded memory boards and
  2003.           will not work correctly on all vendors expanded memory boards.
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.                                                                        31
  2046.  
  2047.  
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.      FUNCTION 12   GET HANDLE COUNT
  2054.  
  2055.           PURPOSE
  2056.  
  2057.           The Get Handle Count function returns the number of open EMM handles
  2058.           (including the operating system handle 0) in the system.
  2059.  
  2060.           CALLING PARAMETERS
  2061.  
  2062.           AH = 4Bh
  2063.                      Contains the Get Handle Count function.
  2064.  
  2065.           RESULTS
  2066.  
  2067.           These results are valid only if the status returned is zero.
  2068.  
  2069.           BX = total_open_emm_handles
  2070.                      Contains the number of open EMM handles [including the
  2071.                      operating system handle (0)].  This number will not exceed
  2072.                      255.
  2073.  
  2074.           REGISTERS MODIFIED
  2075.  
  2076.           AX, BX
  2077.  
  2078.           STATUS
  2079.  
  2080.           AH = 0     SUCCESSFUL
  2081.                      The manager has returned the number of active EMM handles.
  2082.  
  2083.           AH = 80h   NON-RECOVERABLE
  2084.                      The manager detected a malfunction in the memory manager
  2085.                      software.
  2086.  
  2087.           AH = 81h   NON-RECOVERABLE
  2088.                      The manager detected a malfunction in the expanded memory
  2089.                      hardware.
  2090.  
  2091.           AH = 84h   NON-RECOVERABLE
  2092.                      The function code passed to the memory manager is not
  2093.                      defined.
  2094.  
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.  
  2104.  
  2105.  
  2106.  
  2107.  
  2108.  
  2109.  
  2110.  
  2111.                                                                        32
  2112.  
  2113.  
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.           EXAMPLE
  2120.           
  2121.           total_open_emm_handles             DW  ?
  2122.           
  2123.           MOV  AH, 4Bh                       ; load function code
  2124.           INT  67h                           ; call the memory manager
  2125.           OR   AH, AH                        ; check EMM status
  2126.           JNZ  emm_err_handler               ; jump to error handler on error
  2127.           MOV  total_open_emm_handles, BX    ; save total active handle count
  2128.  
  2129.  
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145.  
  2146.  
  2147.  
  2148.  
  2149.  
  2150.  
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.  
  2160.  
  2161.  
  2162.  
  2163.  
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.                                                                        33
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.      FUNCTION 13   GET HANDLE PAGES
  2186.  
  2187.           PURPOSE
  2188.  
  2189.           The Get Handle Pages function returns the number of pages allocated to
  2190.           a specific EMM handle.
  2191.  
  2192.           CALLING PARAMETERS
  2193.  
  2194.           AH = 4Ch
  2195.                      Contains the Get Handle Pages function.
  2196.  
  2197.           DX = emm_handle
  2198.                      Contains the EMM handle.
  2199.  
  2200.           RESULTS
  2201.  
  2202.           These results are valid only if the status returned is zero.
  2203.  
  2204.           BX = num_pages_alloc_to_emm_handle
  2205.                      Contains the number of logical pages allocated to the
  2206.                      specified EMM handle.  This number never exceeds 2048
  2207.                      because the memory manager allows a maximum of 2048 pages
  2208.                      (32M bytes) of expanded memory.
  2209.  
  2210.           REGISTERS MODIFIED
  2211.  
  2212.           AX, BX
  2213.  
  2214.           STATUS
  2215.  
  2216.           AH = 0     SUCCESSFUL
  2217.                      The manager has returned the number of pages allocated to
  2218.                      the EMM handle.
  2219.  
  2220.           AH = 80h   NON-RECOVERABLE
  2221.                      The manager detected a malfunction in the memory manager
  2222.                      software.
  2223.  
  2224.           AH = 81h   NON-RECOVERABLE
  2225.                      The manager detected a malfunction in the expanded memory
  2226.                      hardware.
  2227.  
  2228.           AH = 83h   NON-RECOVERABLE
  2229.                      The memory manager couldn't find the EMM handle your
  2230.                      program specified.
  2231.  
  2232.           AH = 84h   NON-RECOVERABLE
  2233.                      The function code passed to the memory manager is not
  2234.                      defined.
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.                                                                        34
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.           EXAMPLE
  2252.           
  2253.           emm_handle                         DW  ?
  2254.           pages_alloc_to_handle              DW  ?
  2255.           
  2256.           MOV  DX, emm_handle                ; load EMM handle
  2257.           MOV  AH, 4Ch                       ; load function code
  2258.           INT  67h                           ; call the memory manager
  2259.           OR   AH, AH                        ; check EMM status
  2260.           JNZ  emm_err_handler               ; jump to error handler on error
  2261.           MOV  pages_alloc_to_handle, BX     ; save number of pages allocated
  2262.                                              ; to specified handle
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.  
  2274.  
  2275.  
  2276.  
  2277.  
  2278.  
  2279.  
  2280.  
  2281.  
  2282.  
  2283.  
  2284.  
  2285.  
  2286.  
  2287.  
  2288.  
  2289.  
  2290.  
  2291.  
  2292.  
  2293.  
  2294.  
  2295.  
  2296.  
  2297.  
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.  
  2307.  
  2308.  
  2309.                                                                        35
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.      FUNCTION 14   GET ALL HANDLES PAGES
  2318.  
  2319.           PURPOSE
  2320.  
  2321.           The Get All Handle Pages function returns an array of the open emm
  2322.           handles and the number of pages allocated to each one.
  2323.  
  2324.           CALLING PARAMETERS
  2325.  
  2326.           AH = 4Dh
  2327.                      Contains the Get All Handle Pages function.
  2328.  
  2329.           handle_page_struct         STRUC
  2330.              emm_handle              DW ?
  2331.              pages_alloc_to_handle   DW ?
  2332.           handle_page_struct         ENDS
  2333.  
  2334.           ES:DI = pointer to handle_page
  2335.                      Contains a pointer to an array of structures where a copy
  2336.                      of all open EMM handles and the number of pages allocated
  2337.                      to each will be stored.  Each structure has these two
  2338.                      members:
  2339.  
  2340.           .emm_handle
  2341.                      The first member is a word which contains the value of the
  2342.                      open EMM handle.  The values of the handles this function
  2343.                      returns will be in the range of 0 to 255 decimal (0000h to
  2344.                      00FFh).  The uppermost byte of the handle is always zero.
  2345.  
  2346.           .pages_alloc_to_handle
  2347.                      The second member is a word which contains the number of
  2348.                      pages allocated to the open EMM handle.
  2349.  
  2350.           RESULTS
  2351.  
  2352.           These results are valid only if the status returned is zero.
  2353.  
  2354.           BX = total_open_emm_handles
  2355.                      Contains the number of open EMM handles (including the
  2356.                      operating system handle [0]).  The number cannot be zero
  2357.                      because the operating system handle is always active and
  2358.                      cannot be deallocated.  This number will not exceed 255.
  2359.  
  2360.           REGISTERS MODIFIED
  2361.  
  2362.           AX, BX
  2363.  
  2364.           STATUS
  2365.  
  2366.           AH = 0     SUCCESSFUL
  2367.                      The manager has returned the array.
  2368.  
  2369.           AH = 80h   NON-RECOVERABLE
  2370.                      The manager detected a malfunction in the memory manager
  2371.                      software.
  2372.  
  2373.  
  2374.  
  2375.                                                                        36
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.           AH = 81h   NON-RECOVERABLE
  2384.                      The manager detected a malfunction in the expanded memory
  2385.                      hardware.
  2386.  
  2387.           AH = 84h   NON-RECOVERABLE
  2388.                      The function code passed to the memory manager isn't
  2389.                      defined.
  2390.  
  2391.           EXAMPLE
  2392.           
  2393.           handle_page                        handle_page_struct 255 DUP (?)
  2394.           total_open_handles                 DW  ?
  2395.           
  2396.           MOV  AX, SEG handle_page
  2397.           MOV  ES, AX
  2398.           LEA  DI, handle_page               ; ES:DI points to handle_page
  2399.           MOV  AH, 4Dh                       ; load function code
  2400.           INT  67h                           ; call the memory manager
  2401.           OR   AH, AH                        ; check EMM status
  2402.           JNZ  emm_err_handler               ; jump to error handler on error
  2403.           MOV  total_open_handles, BX        ; save total open handle count
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.  
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.  
  2440.  
  2441.                                                                        37
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.      FUNCTION 15   GET/SET PAGE MAP
  2450.  
  2451.           GET PAGE MAP SUBFUNCTION
  2452.  
  2453.           PURPOSE
  2454.  
  2455.           The Get Page Map subfunction saves the mapping context for all
  2456.           mappable memory regions (conventional and expanded) by copying the
  2457.           contents of the mapping registers from each expanded memory board to a
  2458.           destination array.  The application must pass a pointer to the
  2459.           destination array.  This subfunction doesn't require an EMM handle.
  2460.           Use this function instead of Functions 8 and 9 if you need to save or
  2461.           restore the mapping context but don't want (or have) to use a handle.
  2462.  
  2463.           CALLING PARAMETERS
  2464.  
  2465.           AX = 4E00h
  2466.                      Contains the Get Page Map subfunction.
  2467.  
  2468.           ES:DI = dest_page_map
  2469.                      Contains a pointer to the destination array address in
  2470.                      segment:offset format.  Use the Get Size of Page Map Save
  2471.                      Array subfunction to determine the size of the desired
  2472.                      array.
  2473.  
  2474.           RESULTS
  2475.  
  2476.           These results are valid only if the status returned is zero.
  2477.  
  2478.           dest_page_map
  2479.                      The array contains the state of all the mapping registers
  2480.                      on all boards in the system.  It also contains any
  2481.                      additional information necessary to restore the boards to
  2482.                      their original state when the program invokes a Set
  2483.                      subfunction.
  2484.  
  2485.           REGISTERS MODIFIED
  2486.  
  2487.           AX
  2488.  
  2489.           STATUS
  2490.  
  2491.           AH = 0     SUCCESSFUL
  2492.                      The manager has returned the array.
  2493.  
  2494.           AH = 80h   NON-RECOVERABLE
  2495.                      The manager detected a malfunction in the memory manager
  2496.                      software.
  2497.  
  2498.           AH = 81h   NON-RECOVERABLE
  2499.                      The manager detected a malfunction in the expanded memory
  2500.                      hardware.
  2501.  
  2502.           AH = 84h   NON-RECOVERABLE
  2503.                      The function code passed to the memory manager is not
  2504.                      defined.
  2505.  
  2506.  
  2507.                                                                        38
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.           AH = 8Fh   NON-RECOVERABLE
  2516.                      The subfunction parameter is invalid.
  2517.  
  2518.           EXAMPLE
  2519.           
  2520.           dest_page_map                      DB  ?  DUP  (?)
  2521.           
  2522.           MOV  AX, SEG dest_page_map
  2523.           MOV  ES, AX
  2524.           LEA  DI, dest_page_map             ; ES:DI points to dest_page_map
  2525.           MOV  AX, 4E00h                     ; load function code
  2526.           INT  67h                           ; call the memory manager
  2527.           OR   AH, AH                        ; check EMM status
  2528.           JNZ  emm_err_handler               ; jump to error handler on error
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.  
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.  
  2552.  
  2553.  
  2554.  
  2555.  
  2556.  
  2557.  
  2558.  
  2559.  
  2560.  
  2561.  
  2562.  
  2563.  
  2564.  
  2565.  
  2566.  
  2567.  
  2568.  
  2569.  
  2570.  
  2571.  
  2572.  
  2573.                                                                        39
  2574.  
  2575.  
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.      FUNCTION 15   GET/SET PAGE MAP (CONTINUED)
  2582.  
  2583.           SET PAGE MAP SUBFUNCTION
  2584.  
  2585.           PURPOSE
  2586.  
  2587.           The Set Page Map subfunction restores the mapping context for all
  2588.           mappable memory regions (conventional and expanded) by copying the
  2589.           contents of a source array into the mapping registers on each expanded
  2590.           memory board in the system.  The application must pass a pointer to
  2591.           the source array.  This subfunction doesn't require an EMM handle.
  2592.           Use this function instead of Functions 8 and 9 if you need to save or
  2593.           restore the mapping context but don't want (or have) to use a handle.
  2594.  
  2595.           CALLING PARAMETERS
  2596.  
  2597.           AX = 4E01h
  2598.                      Contains the Set Page Map subfunction.
  2599.  
  2600.           DS:SI = source_page_map
  2601.                      Contains a pointer to the source array address in
  2602.                      segment:offset format.  The application must point to an
  2603.                      array which contains the mapping register state.  Use the
  2604.                      Get Size of Page Map Save Array subfunction to determine
  2605.                      the size of the desired array.
  2606.  
  2607.           REGISTERS MODIFIED
  2608.  
  2609.           AX
  2610.  
  2611.           STATUS
  2612.  
  2613.           AH = 0     SUCCESSFUL
  2614.                      The manager has passed the array.
  2615.  
  2616.           AH = 80h   NON-RECOVERABLE
  2617.                      The manager detected a malfunction in the memory manager
  2618.                      software.
  2619.  
  2620.           AH = 81h   NON-RECOVERABLE
  2621.                      The manager detected a malfunction in the expanded memory
  2622.                      hardware.
  2623.  
  2624.           AH = 84h   NON-RECOVERABLE
  2625.                      The function code passed to the memory manager is not
  2626.                      defined.
  2627.  
  2628.           AH = 8Fh   NON-RECOVERABLE
  2629.                      The subfunction parameter is invalid.
  2630.  
  2631.           AH = A3h   NON-RECOVERABLE
  2632.                      The contents of the source array have been corrupted, or
  2633.                      the pointer passed to the subfunction is invalid.
  2634.  
  2635.           EXAMPLE
  2636.           
  2637.           source_page_map                    DB  ?  DUP  (?)
  2638.  
  2639.                                                                        40
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.           
  2648.           MOV  AX, SEG source_page_map
  2649.           MOV  DS, AX
  2650.           LEA  SI, source_page_map           ; DS:SI points to source_page_map
  2651.           MOV  AX, 4E01h                     ; load function code
  2652.           INT  67h                           ; call the memory manager
  2653.           OR   AH, AH                        ; check EMM status
  2654.           JNZ  emm_err_handler               ; jump to error handler on error
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.  
  2667.  
  2668.  
  2669.  
  2670.  
  2671.  
  2672.  
  2673.  
  2674.  
  2675.  
  2676.  
  2677.  
  2678.  
  2679.  
  2680.  
  2681.  
  2682.  
  2683.  
  2684.  
  2685.  
  2686.  
  2687.  
  2688.  
  2689.  
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.  
  2703.  
  2704.  
  2705.                                                                        41
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.      FUNCTION 15   GET/SET PAGE MAP (CONTINUED)
  2714.  
  2715.           GET & SET PAGE MAP SUBFUNCTION
  2716.  
  2717.           PURPOSE
  2718.  
  2719.           The Get & Set subfunction simultaneously saves a current mapping
  2720.           context and restores a previous mapping context for all mappable
  2721.           memory regions (both conventional and expanded).  It first copies the
  2722.           contents of the mapping registers from each expanded memory board in
  2723.           the system into a destination array.  (The application must pass a
  2724.           pointer to the destination array.)  Then, the subfunction copies the
  2725.           contents of a source array into the mapping registers on each of the
  2726.           expanded memory boards.  (The application must pass a pointer to the
  2727.           source array.)
  2728.  
  2729.           Use this function instead of Functions 8 and 9 if you need to save or
  2730.           restore the mapping context but don't want (or have) to use a handle.
  2731.  
  2732.           CALLING PARAMETERS
  2733.  
  2734.           AX = 4E02h
  2735.                      Contains the Get & Set Page Map subfunction.
  2736.  
  2737.           ES:DI = dest_page_map
  2738.                      Contains a pointer to the destination array address in
  2739.                      segment:offset format.  The current contents of the map
  2740.                      registers will be saved in this array.
  2741.  
  2742.           DS:SI = source_page_map
  2743.                      Contains a pointer to the source array address in
  2744.                      segment:offset format.  The contents of this array will be
  2745.                      copied into the map registers.  The application must point
  2746.                      to an array which contains the mapping register state.
  2747.                      This address is required only for the Set or Get and Set
  2748.                      subfunctions.
  2749.  
  2750.           RESULTS
  2751.  
  2752.           These results are valid only if the status returned is zero.
  2753.  
  2754.           dest_page_map
  2755.                      The array contains the mapping state.  It also contains any
  2756.                      additional information necessary to restore the original
  2757.                      state when the program invokes a Set subfunction.
  2758.  
  2759.           REGISTERS MODIFIED
  2760.  
  2761.           AX
  2762.  
  2763.           STATUS
  2764.  
  2765.           AH = 0     SUCCESSFUL
  2766.                      The manager has returned and passed both arrays.
  2767.  
  2768.  
  2769.  
  2770.  
  2771.                                                                        42
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.           AH = 80h   NON-RECOVERABLE
  2780.                      The manager detected a malfunction in the memory manager
  2781.                      software.
  2782.  
  2783.           AH = 81h   NON-RECOVERABLE
  2784.                      The manager detected a malfunction in the expanded memory
  2785.                      hardware.
  2786.  
  2787.           AH = 84h   NON-RECOVERABLE the function code passed to the memory
  2788.                      manager is not defined.
  2789.  
  2790.           AH = 8Fh   NON-RECOVERABLE
  2791.                      The subfunction parameter is invalid.
  2792.  
  2793.           AH = A3h   NON-RECOVERABLE
  2794.                      The contents of the source array have been corrupted, or
  2795.                      the pointer passed to the subfunction is invalid.
  2796.  
  2797.           EXAMPLE
  2798.           
  2799.           dest_page_map                      DB  ?  DUP  (?)
  2800.           source_page_map                    DB  ?  DUP  (?)
  2801.           
  2802.           MOV  AX, SEG dest_page_map
  2803.           MOV  ES, AX
  2804.           MOV  AX, SEG source_page_map
  2805.           MOV  DS, AX
  2806.           LEA  DI, dest_page_map             ; ES:DI points to dest_page_map
  2807.           LEA  SI, source_page_map           ; DS:SI points to source_page_map
  2808.           MOV  AX, 4E02h                     ; load function code
  2809.           INT  67h                           ; call the memory manager
  2810.           OR   AH, AH                        ; check EMM status
  2811.           JNZ  emm_err_handler               ; jump to error handler on error
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.  
  2835.  
  2836.  
  2837.                                                                        43
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.      FUNCTION 15   GET/SET PAGE MAP (CONTINUED)
  2846.  
  2847.           GET SIZE OF PAGE MAP SAVE ARRAY SUBFUNCTION
  2848.  
  2849.           PURPOSE
  2850.  
  2851.           The Get Size of Page Map Save Array subfunction returns the storage
  2852.           requirements for the array passed by the other three subfunctions.
  2853.           This subfunction doesn't require an EMM handle.
  2854.  
  2855.           CALLING PARAMETERS
  2856.  
  2857.           AX = 4E03h
  2858.                      Contains the Get Size of Page Map Save Array subfunction.
  2859.                      The size of this array depends on how the expanded memory
  2860.                      system is configured and how the expanded memory manager is
  2861.                      implemented.  Therefore, the size must be determined after
  2862.                      the memory manager is loaded.
  2863.  
  2864.           RESULTS
  2865.  
  2866.           These results are valid only if the status returned is zero.
  2867.  
  2868.           AL = size_of_array
  2869.                      Contains the number of bytes that will be transferred to
  2870.                      the memory area an application supplies whenever a program
  2871.                      requests the Get, Set, or Get and Set subfunctions.
  2872.  
  2873.           REGISTERS MODIFIED
  2874.  
  2875.           AX
  2876.  
  2877.           STATUS
  2878.  
  2879.           AH = 0     SUCCESSFUL
  2880.                      The manager has returned the array size.
  2881.  
  2882.           AH = 80h   NON-Recoverable the manager detected a malfunction in the
  2883.                      memory manager software.
  2884.  
  2885.           AH = 81h   NON-Recoverable the manager detected a malfunction in the
  2886.                      expanded memory hardware.
  2887.  
  2888.           AH = 84h   NON-Recoverable the function code passed to the memory
  2889.                      manager is not defined.
  2890.  
  2891.           AH = 8Fh   NON-RECOVERABLE
  2892.                      The subfunction parameter is invalid.
  2893.  
  2894.           EXAMPLE
  2895.           
  2896.           size_of_array                      DB  ?
  2897.           
  2898.           MOV  AX, 4E03h                     ; load function code
  2899.           INT  67h                           ; call the memory manager
  2900.           OR   AH, AH                        ; check EMM status
  2901.           JNZ  emm_err_handler               ; jump to error handler on error
  2902.  
  2903.                                                                        44
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.           MOV  size_of_array, AL             ; save array size
  2912.  
  2913.  
  2914.  
  2915.  
  2916.  
  2917.  
  2918.  
  2919.  
  2920.  
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.  
  2927.  
  2928.  
  2929.  
  2930.  
  2931.  
  2932.  
  2933.  
  2934.  
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.  
  2944.  
  2945.  
  2946.  
  2947.  
  2948.  
  2949.  
  2950.  
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.  
  2967.  
  2968.  
  2969.                                                                        45
  2970.  
  2971.  
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.      FUNCTION 16   GET/SET PARTIAL PAGE MAP
  2978.  
  2979.           GET PARTIAL PAGE MAP SUBFUNCTION
  2980.  
  2981.           PURPOSE
  2982.  
  2983.           The Get Partial Page Map subfunction saves a partial mapping context
  2984.           for specific mappable memory regions in a system.  Because this
  2985.           function saves only a subset of the entire mapping context, it uses
  2986.           much less memory for the save area and may be potentially faster than
  2987.           Function 15.  The subfunction does this by copying the contents of
  2988.           selected mapping registers from each expanded memory board to a
  2989.           destination array.
  2990.  
  2991.           The application must pass a pair of pointers.  The first points to a
  2992.           structure which specifies which mappable segments to save; the second
  2993.           points to the destination array.
  2994.  
  2995.           Use this function instead of Functions 8 and 9 if you need to save or
  2996.           restore the mapping context but don't want (or have) to use a handle.
  2997.  
  2998.           CALLING PARAMETERS
  2999.  
  3000.           AX = 4F00h
  3001.                      Contains the Get Partial Page Map subfunction.
  3002.  
  3003.           partial_page_map_struct     STRUC
  3004.              mappable_segment_count   DW  ?
  3005.              mappable_segment         DW  (?)  DUP  (?)
  3006.           partial_page_map_struct     ENDS
  3007.  
  3008.           DS:SI = partial_page_map
  3009.                      Contains a pointer to a structure which specifies only
  3010.                      those mappable memory regions which are to have their
  3011.                      mapping context saved.  The structure members are described
  3012.                      below.
  3013.  
  3014.           .mappable_segment_count
  3015.                      The first member is a word which specifies the number of
  3016.                      members in the word array which immediately follows it.
  3017.                      This number should not exceed the number of mappable
  3018.                      segments in the system.
  3019.  
  3020.           .mappable_segment
  3021.                      The second member is a word array which contains the
  3022.                      segment addresses of the mappable memory regions whose
  3023.                      mapping contexts are to be saved.  The segment address must
  3024.                      be a mappable segment.  Use Function 25 to determine which
  3025.                      segments are mappable.
  3026.  
  3027.           ES:DI = dest_array
  3028.                      Contains a pointer to the destination array address in
  3029.                      Segment:Offset format.  To determine the size of the
  3030.                      required array, see the Get Size of Partial Page Map Save
  3031.                      Array subfunction.
  3032.  
  3033.           RESULTS
  3034.  
  3035.                                                                        46
  3036.  
  3037.  
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.           These results are valid only if the status returned is zero.
  3044.  
  3045.           dest_array
  3046.                      The array contains the partial mapping context and any
  3047.                      additional information necessary to restore this context to
  3048.                      its original state when the program invokes a Set
  3049.                      subfunction.
  3050.  
  3051.           REGISTERS MODIFIED
  3052.  
  3053.           AX
  3054.  
  3055.           STATUS
  3056.  
  3057.           AH = 0     SUCCESSFUL
  3058.                      The manager has saved the partial map context.
  3059.  
  3060.           AH = 80h   NON-RECOVERABLE
  3061.                      The manager detected a malfunction in the memory manager
  3062.                      software.
  3063.  
  3064.           AH = 81h   NON-RECOVERABLE
  3065.                      The manager detected a malfunction in the expanded memory
  3066.                      hardware.
  3067.  
  3068.           AH = 84h   NON-RECOVERABLE
  3069.                      The function code passed to the memory manager is not
  3070.                      defined.
  3071.  
  3072.           AH = 8Bh   NON-RECOVERABLE
  3073.                      One of the specified segments is not a mappable segment.
  3074.  
  3075.           AH = 8Fh   NON-RECOVERABLE
  3076.                      The subfunction parameter is invalid.
  3077.  
  3078.           AH = A3h   NON-RECOVERABLE
  3079.                      The contents of the partial page map structure have been
  3080.                      corrupted, the pointer passed to the subfunction is
  3081.                      invalid, or the mappable_segment_count exceeds the number
  3082.                      of mappable segments in the system.
  3083.  
  3084.           EXAMPLE
  3085.           
  3086.           partial_page_map                   partial_page_map_struct <>
  3087.           dest_array                         DB ? DUP (?)
  3088.           
  3089.           MOV  AX, SEG partial_page_map
  3090.           MOV  DS, AX
  3091.           LEA  SI, partial_page_map          ; DS:SI points to
  3092.           MOV  AX, SEG dest_array            ; partial_page_map
  3093.           MOV  ES, AX
  3094.           LEA  DI, dest_array                ; ES:DI points to dest_array
  3095.           MOV  AX, 4F00h                     ; load function code
  3096.           INT  67h                           ; call the memory manager
  3097.           OR   AH, AH                        ; check EMM status
  3098.           JNZ  emm_err_handler               ; jump to error handler on error
  3099.  
  3100.  
  3101.                                                                        47
  3102.  
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.      FUNCTION 16   GET/SET PARTIAL PAGE MAP (CONTINUED)
  3110.  
  3111.           SET PARTIAL PAGE MAP SUBFUNCTION
  3112.  
  3113.           PURPOSE
  3114.  
  3115.           The Set Partial Page Map subfunction provides a mechanism for
  3116.           restoring the mapping context for a partial mapping context for
  3117.           specific mappable memory regions in a system.  Because this function
  3118.           restores only a subset of the entire mapping context and not the
  3119.           entire systems mapping context, it uses much less memory for the save
  3120.           area and is potentially faster than Function 15.  The subfunction does
  3121.           this by copying the contents of the source array to selected mapping
  3122.           registers on each expanded memory board.  The application passes a
  3123.           pointer to the source array.  Use this function instead of Functions 8
  3124.           and 9 if you need to save or restore the mapping context but don't
  3125.           want (or have) to use a handle.
  3126.  
  3127.           CALLING PARAMETERS
  3128.  
  3129.           AX = 4F01h
  3130.                      Contains the Set Partial Page Map subfunction.
  3131.  
  3132.           source_array DB  ?  DUP  (?)
  3133.  
  3134.           DS:SI = source_array
  3135.                      Contains a pointer to the source array in segment:offset
  3136.                      format.  The application must point to an array which
  3137.                      contains the partial mapping register state.  To determine
  3138.                      the size of the required array, see the Get Size of Partial
  3139.                      Page Map Save Array subfunction.
  3140.  
  3141.           REGISTERS MODIFIED
  3142.  
  3143.           AX
  3144.  
  3145.           STATUS
  3146.  
  3147.           AH = 0     SUCCESSFUL
  3148.                      The manager has restored the partial mapping context.
  3149.  
  3150.           AH = 80h   NON-RECOVERABLE
  3151.                      The manager detected a malfunction in the memory manager
  3152.                      software.
  3153.  
  3154.           AH = 81h   NON-RECOVERABLE
  3155.                      The manager detected a malfunction in the expanded memory
  3156.                      hardware.
  3157.  
  3158.           AH = 84h   NON-RECOVERABLE
  3159.                      The function code passed to the memory manager is not
  3160.                      defined.
  3161.  
  3162.           AH = 8Fh   NON-RECOVERABLE
  3163.                      The subfunction parameter is invalid.
  3164.  
  3165.  
  3166.  
  3167.                                                                        48
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.           AH = A3h   NON-RECOVERABLE
  3176.                      The contents of the source array have been corrupted, or
  3177.                      the pointer passed to the subfunction is invalid.
  3178.  
  3179.           EXAMPLE
  3180.           
  3181.           MOV  AX, SEG source_array
  3182.           MOV  DS, AX
  3183.           LEA  SI, source_array              ; DS:SI points to source_array
  3184.           MOV  AX, 4F01h                     ; load function code
  3185.           INT  67h                           ; call the memory manager
  3186.           OR   AH, AH                        ; check EMM status
  3187.           JNZ  emm_err_handler               ; jump to error handler on error
  3188.  
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.  
  3198.  
  3199.  
  3200.  
  3201.  
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.  
  3231.  
  3232.  
  3233.                                                                        49
  3234.  
  3235.  
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.      FUNCTION 16   GET/SET PARTIAL PAGE MAP (CONTINUED)
  3242.  
  3243.           GET SIZE OF PARTIAL PAGE MAP SAVE ARRAY SUBFUNCTION
  3244.  
  3245.           PURPOSE
  3246.  
  3247.           The Return Size subfunction returns the storage requirements for the
  3248.           array passed by the other two subfunctions.  This subfunction doesn't
  3249.           require an EMM handle.
  3250.  
  3251.           CALLING PARAMETERS
  3252.  
  3253.           AX = 4F02h
  3254.                      Contains the Get Size of Partial Page Map Save Array
  3255.                      subfunction.  The size of this array depends on the
  3256.                      expanded memory system configuration and the implementation
  3257.                      of the expanded memory manager.  Therefore, it will vary
  3258.                      between hardware configurations and implementations and
  3259.                      must be determined after a specific memory manager is
  3260.                      loaded.
  3261.  
  3262.           BX = number of pages in the partial array
  3263.                      Contains the number of pages in the partial map to be saved
  3264.                      by the Get/Set Partial Page Map subfunctions.  This number
  3265.                      should be the same as the mappable_segment_count in the Get
  3266.                      Partial Page Map subfunction.
  3267.  
  3268.           Results
  3269.  
  3270.           These results are valid only if the status returned is zero.
  3271.  
  3272.           AL = size_of_partial_save_array
  3273.                      Contains the number of bytes that will be transferred to
  3274.                      the memory area supplied by an application whenever a
  3275.                      program requests the Get or Set subfunction.
  3276.  
  3277.           REGISTERS MODIFIED
  3278.  
  3279.           AX
  3280.  
  3281.           STATUS
  3282.  
  3283.           AH = 0     SUCCESSFUL
  3284.                      The manager has returned the array size.
  3285.  
  3286.           AH = 80h   NON-RECOVERABLE
  3287.                      The manager detected a malfunction in the memory manager
  3288.                      software.
  3289.  
  3290.           AH = 81h   NON-RECOVERABLE
  3291.                      The manager detected a malfunction in the expanded memory
  3292.                      hardware.
  3293.  
  3294.           AH = 84h   NON-RECOVERABLE
  3295.                      The function code passed to the memory manager is not
  3296.                      defined.
  3297.  
  3298.  
  3299.                                                                        50
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.           AH = 8Bh   NON-RECOVERABLE
  3308.                      The number of pages in the partial array is outside the
  3309.                      range of physical pages in the system.
  3310.  
  3311.           AH = 8Fh   NON-RECOVERABLE
  3312.                      The subfunction parameter is invalid.
  3313.  
  3314.           EXAMPLE
  3315.           
  3316.           number_of_pages_to_map             DW  ?
  3317.           size_of_partial_save_array         DB  ?
  3318.           
  3319.           MOV  BX, number_of_pages_to_map
  3320.           MOV  AX, 4F02h                     ; load function code
  3321.           INT  67h                           ; call the memory manager
  3322.           OR   AH, AH                        ; check EMM status
  3323.           JNZ  emm_err_handler               ; jump to error handler on error
  3324.           MOV  size_of_partial_save_array, AL; save array size
  3325.  
  3326.  
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.  
  3363.  
  3364.  
  3365.                                                                        51
  3366.  
  3367.  
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.      FUNCTION 17   MAP/UNAMP MULTIPLE HANDLE PAGES
  3374.  
  3375.           PURPOSE
  3376.  
  3377.           This function can, in a single invocation, map (or unmap) logical
  3378.           pages into as many physical pages as the system supports.
  3379.           Consequently, it has less execution overhead than mapping pages one at
  3380.           a time.  For applications which do a lot of page mapping, this is the
  3381.           preferred mapping method.
  3382.  
  3383.           MAPPING MULTIPLE PAGES
  3384.  
  3385.           The handle passed to this function determines what type of logical
  3386.           pages are being mapped.  Logical pages that Function 4 and Function 27
  3387.           (Allocate Standard Pages subfunction) allocate are referred to as
  3388.           pages and are 16K bytes.  Logical pages that Function 27 (Allocate Raw
  3389.           Pages subfunction) allocates are referred to as raw pages and might
  3390.           not be the same size as the pages Function 4 and Function 27 (Allocate
  3391.           Standard Pages subfunction) allocate.
  3392.  
  3393.           UNMAPPING MULTIPLE PAGES
  3394.  
  3395.           This function can make specific physical pages unavailable for reading
  3396.           or writing.  A logical page which is unmapped from a specific physical
  3397.           page cannot be read or written from that physical page.  The logical
  3398.           page which is unavailable (unmapped) can be made available again by
  3399.           mapping it, or a new logical page, at the physical page that was
  3400.           unmapped. Unmapping a physical page is accomplished by setting the
  3401.           logical page it is associated with to FFFFh.
  3402.  
  3403.           You might unmap an entire set of mapped pages, for example, before
  3404.           loading and executing a program.  This ensures that the loaded program
  3405.           won't be able to access the pages your program has mapped.  However,
  3406.           you must save the mapping context before you unmap the physical pages.
  3407.           This enables you to restore it later so that you may access the memory
  3408.           you had mapped there.  You can save the mapping context with Functions
  3409.           8, 15, or 16.  You can restore the mapping context with Functions 9,
  3410.           15, or 16.
  3411.  
  3412.           MAPPING AND UNMAPPING MULTIPLE PAGES SIMULTANEOUSLY
  3413.  
  3414.           Both mapping and unmapping pages can be done in the same invocation.
  3415.  
  3416.           Mapping or unmapping no pages is not considered an error.  If a
  3417.           request to map or unmap zero pages is made, nothing is done and no
  3418.           error is returned.
  3419.  
  3420.           ALTERNATE MAPPING AND UNMAPPING METHODS
  3421.  
  3422.           You can map or unmap pages using two methods.  Both methods produce
  3423.           identical results.
  3424.  
  3425.           1   The first method specifies both a logical page and a physical page
  3426.               at which the logical page is to be mapped.  This method is an
  3427.               extension of Function 5 (Map Handle Page).
  3428.  
  3429.  
  3430.  
  3431.                                                                        52
  3432.  
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.           2   The second method specifies both a logical page and a
  3440.               corresponding segment address at which the logical page is to be
  3441.               mapped.  While this is functionally the same as the first method,
  3442.               it may be easier to use the actual segment address of a physical
  3443.               page than to use a number which only represents its location.  The
  3444.               memory manager verifies whether the specified segment address
  3445.               falls on the boundary of a mappable physical page.  The manager
  3446.               then translates the segment address passed to it into the
  3447.               necessary internal representation to map the pages.
  3448.  
  3449.           MAP/UNMAP MULTIPLE HANDLE PAGES
  3450.  
  3451.           LOGICAL PAGE/PHYSICAL PAGE METHOD
  3452.  
  3453.           CALLING PARAMETERS
  3454.  
  3455.           AX = 5000h
  3456.                      Contains the Map/Unmap Multiple Handle Pages subfunction
  3457.                      using the logical page/physical page method.
  3458.  
  3459.           log_to_phys_map_struct   STRUC
  3460.              log_page_number       DW  ?
  3461.              phys_page_number      DW  ?
  3462.           log_to_phys_map_struct   ENDS
  3463.  
  3464.           DX = handle
  3465.                      Contains the EMM handle.
  3466.  
  3467.           CX = log_to_phys_map_len
  3468.                      Contains the number of entries in the array.  For example,
  3469.                      if the array contained four pages to map or unmap, then CX
  3470.                      would contain 4.  The number in CX should not exceed the
  3471.                      number of mappable pages in the system.
  3472.  
  3473.           DS:SI = pointer to log_to_phys_map array
  3474.                      Contains a pointer to an array of structures that contains
  3475.                      the information necessary to map the desired pages.  The
  3476.                      array is made up of the following two elements:
  3477.  
  3478.           .log_page_number
  3479.                      The first member is a word which contains the number of the
  3480.                      logical page which is to be mapped.  Logical pages are
  3481.                      numbered zero relative, so the number for a logical page
  3482.                      can only range from zero to (maximum number of logical
  3483.                      pages allocated to the handle - 1).
  3484.  
  3485.                      If the logical page number is set to FFFFh, the physical
  3486.                      page associated with it is unmapped rather than mapped.
  3487.                      Unmapping a physical page makes it inaccessible for reading
  3488.                      or writing.
  3489.  
  3490.           .phys_page_number
  3491.                      The second member is a word which contains the number of
  3492.                      the physical page at which the logical page is to be
  3493.                      mapped.  Physical pages are numbered zero relative, so the
  3494.                      number for a physical page can only range from zero to
  3495.  
  3496.  
  3497.                                                                        53
  3498.  
  3499.  
  3500.  
  3501.  
  3502.  
  3503.  
  3504.  
  3505.                      (maximum number of physical pages supported in the system -
  3506.                      1).
  3507.  
  3508.           REGISTERS MODIFIED
  3509.  
  3510.           AX
  3511.  
  3512.           STATUS
  3513.  
  3514.           AH = 0     SUCCESSFUL
  3515.                      The logical pages have been mapped, or unmapped, at the
  3516.                      specified physical pages.
  3517.  
  3518.           AH = 80h   NON-RECOVERABLE
  3519.                      The manager has detected a malfunction in the memory
  3520.                      manager software.
  3521.  
  3522.           AH = 81h   NON-RECOVERABLE
  3523.                      The manager has detected a malfunction in the expanded
  3524.                      memory hardware.
  3525.  
  3526.           AH = 83h   NON-RECOVERABLE
  3527.                      The manager couldn't find the specified EMM handle.  The
  3528.                      manager doesn't currently have any information pertaining
  3529.                      to the specified EMM handle.  The program has probably
  3530.                      corrupted its EMM handle.
  3531.  
  3532.           AH = 84h   NON-RECOVERABLE
  3533.                      The function code passed to the manager is not defined.
  3534.  
  3535.           AH = 8Ah   RECOVERABLE
  3536.                      One or more of the mapped logical pages is out of the range
  3537.                      of logical pages allocated to the EMM handle.  The program
  3538.                      can recover by attempting to map a logical page which is
  3539.                      within the bounds for the specified EMM handle.  When this
  3540.                      error occurs, the only pages mapped were the ones valid up
  3541.                      to the point that the error occurred.
  3542.  
  3543.           AH = 8Bh   RECOVERABLE
  3544.                      One or more of the physical pages is out of the range of
  3545.                      mappable physical pages, or the log_to_phys_map_len exceeds
  3546.                      the number of mappable pages in the system.  The program
  3547.                      can recover from this condition by attempting to map into
  3548.                      memory at a physical page which is in the range of the
  3549.                      physical page numbers supported by the system.  When this
  3550.                      error occurs, the only pages mapped were the ones valid up
  3551.                      to the point that the error occurred.
  3552.  
  3553.           AH = 8Fh   NON-RECOVERABLE
  3554.                      The subfunction parameter is invalid.
  3555.  
  3556.           EXAMPLE
  3557.           
  3558.           log_to_phys_map                    log_to_phys_map_struct ? DUP (?)
  3559.           emm_handle                         DW ?
  3560.           
  3561.           MOV  AX, SEG log_to_phys_map       ; DS:SI points to
  3562.  
  3563.                                                                        54
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.           MOV  DS, AX                        ; log_to_phys_map
  3572.           LEA  SI, log_to_phys_map
  3573.           MOV  CX, LENGTH log_to_phys_map    ; set length field
  3574.           MOV  DX, emm_handle                ; load handle
  3575.           MOV  AX, 5000h                     ; load function code
  3576.           INT  67h                           ; call the memory manager
  3577.           OR   AH, AH                        ; check EMM status
  3578.           JNZ  emm_err_handler               ; jump to error handler on error
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.  
  3627.  
  3628.  
  3629.                                                                        55
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.           
  3638.  
  3639.           MAP/UNMAP MULTIPLE HANDLE PAGES
  3640.  
  3641.           LOGICAL PAGE/SEGMENT ADDRESS METHOD
  3642.  
  3643.           CALLING PARAMETERS
  3644.  
  3645.           AX = 5001h
  3646.                      Contains the Map/Unmap Multiple Handle Pages subfunction
  3647.                      using the logical page/segment address method.
  3648.  
  3649.           log_to_seg_map_struct         STRUC
  3650.              log_page_number            DW  ?
  3651.              mappable_segment_address   DW  ?
  3652.           log_to_seg_map_struct         ENDS
  3653.  
  3654.           DX = handle
  3655.                      Contains the EMM handle.
  3656.  
  3657.           CX = log_to_segment_map_len
  3658.                      Contains the number of entries in the array.  For example,
  3659.                      if the array contained four pages to map or unmap, then CX
  3660.                      would contain four.
  3661.  
  3662.           DS:SI = pointer to log_to_segment_map array
  3663.                      Contains a pointer to an array of structures that contains
  3664.                      the information necessary to map the desired pages.  The
  3665.                      array is made up of the following elements:
  3666.  
  3667.           .log_page_number
  3668.                      The first member is a word which contains the number of the
  3669.                      logical pages to be mapped.  Logical pages are numbered
  3670.                      zero relative, so the number for a logical page can range
  3671.                      from zero to (maximum number of logical pages allocated to
  3672.                      the handle - 1).
  3673.  
  3674.                      If the logical page number is set to FFFFh, the physical
  3675.                      page associated with it is unmapped rather than mapped.
  3676.                      Unmapping a physical page makes it inaccessible for reading
  3677.                      or writing.
  3678.  
  3679.           .mappable_segment_address
  3680.                      The second member is a word which contains the segment
  3681.                      address at which the logical page is to be mapped.  This
  3682.                      segment address must correspond exactly to a mappable
  3683.                      segment address.  The mappable segment addresses are
  3684.                      available with Function 25 (Get Mappable Physical Address
  3685.                      Array)
  3686.  
  3687.           REGISTERS MODIFIED
  3688.  
  3689.           AX
  3690.  
  3691.           STATUS
  3692.  
  3693.  
  3694.  
  3695.                                                                        56
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.           AH = 0     SUCCESSFUL
  3704.                      The logical pages have been mapped (or unmapped), at the
  3705.                      specified physical pages.
  3706.  
  3707.           AH = 80h   NON-RECOVERABLE
  3708.                      The manager has detected a malfunction in the memory
  3709.                      manager software.
  3710.  
  3711.           AH = 81h   NON-RECOVERABLE
  3712.                      The manager has detected a malfunction in the expanded
  3713.                      memory hardware.
  3714.  
  3715.           AH = 83h   NON-RECOVERABLE
  3716.                      The manager could not find the specified EMM handle.  The
  3717.                      manager doesn't have any information pertaining to the
  3718.                      specified EMM handle.  The program has probably corrupted
  3719.                      its EMM handle.
  3720.  
  3721.           AH = 84h   NON-RECOVERABLE
  3722.                      The function code passed to the manager is not defined.
  3723.  
  3724.           AH = 8Ah   RECOVERABLE
  3725.                      One or more of the logical pages to be mapped is out of the
  3726.                      range of logical pages allocated to the EMM handle.  The
  3727.                      program can recover from this condition by mapping a
  3728.                      logical page which is within the bounds for the specified
  3729.                      EMM handle.  When this error occurs, the only pages mapped
  3730.                      or unmapped were the ones valid up to the point that the
  3731.                      error occurred.
  3732.  
  3733.           AH = 8Bh  RECOVERABLE
  3734.                      One or more of the mappable segment addresses specified is
  3735.                      not mappable, the segment address doesn't fall exactly on a
  3736.                      mappable address boundary, or the log_to_segment_map_len
  3737.                      exceeds the number of mappable segments in the system. The
  3738.                      program can recover from this condition by mapping into
  3739.                      memory on an exact mappable segment address.  When this
  3740.                      error occurs, the only pages mapped were the ones valid up
  3741.                      to the point that the error occurred.
  3742.  
  3743.           AH = 8Fh   NON-RECOVERABLE
  3744.                      The subfunction parameter is invalid.
  3745.  
  3746.           EXAMPLE
  3747.           
  3748.           log_to_seg_map                     log_to_seg_map_struct 4 DUP (?)
  3749.           emm_handle                         DW ?
  3750.           
  3751.           MOV  AX, SEG log_to_seg_map
  3752.           MOV  DS, AX
  3753.           LEA  SI, log_to_seg_map            ; DS:SI points to log_to_seg_map
  3754.           MOV  CX, LENGTH log_to_seg_map     ; load # of segments to
  3755.                                              ; map/unmap
  3756.           MOV  DX, emm_handle                ; load handle
  3757.           MOV  AX, 5001h                     ; load function code
  3758.           INT  67h                           ; call the memory manager
  3759.           OR   AH, AH                        ; check EMM status
  3760.  
  3761.                                                                        57
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.           JNZ  emm_err_handler               ; jump to error handler on error
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.  
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790.  
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.                                                                        58
  3828.  
  3829.  
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.      FUNCTION 18   REALLOCATE PAGES
  3836.  
  3837.           PURPOSE
  3838.  
  3839.           This function allows an application program to increase or decrease
  3840.           (reallocate) the number of logical pages allocated to an EMM handle.
  3841.           There are four reallocation cases of interest:
  3842.  
  3843.           1   A reallocation count of zero.  The handle assigned to application
  3844.               remains assigned and is still available for use by the
  3845.               application.  The memory manager won't reassign the handle to any
  3846.               other application.  However, the handle will have any currently
  3847.               allocated pages returned to the memory manager.  The application
  3848.               must invoke the Deallocate Pages function (Function 6) before
  3849.               returning to DOS, or the handle will remain assigned and no other
  3850.               application will be able to use it.
  3851.  
  3852.           2   A reallocation count equal to the current allocation count.  This
  3853.               is not treated as an error, and a successful status is returned.
  3854.  
  3855.           3   A reallocation count greater than the current allocation count.
  3856.               The memory manager will attempt to add new pages to those pages
  3857.               already allocated to the specified EMM handle.  The number of new
  3858.               pages added is the difference between the reallocation count and
  3859.               the current allocation count.  The sequence of logical pages
  3860.               allocated to the EMM handle remains continuous after this
  3861.               operation.  The newly allocated pages have logical page numbers
  3862.               which begin where the previously allocated pages ended, and
  3863.               continue in ascending sequence.
  3864.  
  3865.           4   A reallocation count less than the current allocation count.  The
  3866.               memory manager will attempt to subtract some of the currently
  3867.               allocated pages and return them to the memory manager.  The number
  3868.               of old pages subtracted is the difference between the current
  3869.               allocation count and the re-allocation count.  The pages are
  3870.               subtracted from the end of the sequence of pages currently
  3871.               allocated to the specified EMM handle.  The sequence of logical
  3872.               pages allocated to the EMM handle remains continuous after this
  3873.               operation.
  3874.  
  3875.           The handle determines what type of logical pages are being
  3876.           reallocated.  Logical pages which were originally allocated with
  3877.           Function 4 or Function 27 (Allocate Standard Pages subfunction) are
  3878.           called pages and are 16K bytes long.  Logical pages which were
  3879.           allocated with Function 27 (Allocate Raw Pages subfunction) are called
  3880.           raw pages and might not be the same size as pages allocated with
  3881.           Function 4 or Function 27 (Allocate Standard Pages subfunction).
  3882.  
  3883.           CALLING PARAMETERS
  3884.  
  3885.           AH = 51h
  3886.                      Contains the Reallocate Handle Pages function.
  3887.  
  3888.           DX = handle
  3889.                      Contains the EMM handle.
  3890.  
  3891.  
  3892.  
  3893.                                                                        59
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.           BX = reallocation_count
  3902.                      Contains the total number of pages this handle should have
  3903.                      allocated to it after this function is invoked.
  3904.  
  3905.           RESULTS
  3906.  
  3907.           These results are valid only if the status returned is zero.
  3908.  
  3909.           BX = number of pages allocated to handle after reallocation
  3910.                      Contains the number of pages now allocated to the EMM
  3911.                      handle after the pages have been added or subtracted.  If
  3912.                      the status returned is not zero, the value in BX is equal
  3913.                      to the number of pages allocated to the handle prior to the
  3914.                      invocation of this function.  This information can be used
  3915.                      to verify that the request generated the expected results.
  3916.  
  3917.           REGISTERS MODIFIED
  3918.  
  3919.           AX, BX
  3920.  
  3921.           STATUS
  3922.  
  3923.           AH = 00h   SUCCESSFUL
  3924.                      The pages specified have been added or subtracted to or
  3925.                      from the handle specified.
  3926.  
  3927.           AH = 80h   NON-Recoverable the manager has detected a malfunction in
  3928.                      the memory manager software.
  3929.  
  3930.           AH = 81h   NON-Recoverable the manager has detected a malfunction in
  3931.                      the expanded memory hardware.
  3932.  
  3933.           AH = 83h   NON-Recoverable the manager could not find the specified
  3934.                      EMM handle.  The manager doesn't have any information
  3935.                      pertaining to the specified EMM handle.  The program may
  3936.                      have corrupted its EMM handle.
  3937.  
  3938.           AH = 84h   NON-Recoverable the function code passed to the manager is
  3939.                      not defined.
  3940.  
  3941.           AH = 87h   Recoverable the number of pages that are available in the
  3942.                      system is insufficient for the new allocation request.  The
  3943.                      program can recover from this condition by specifying fewer
  3944.                      pages be allocated to the EMM handle.
  3945.  
  3946.           AH = 88h   Recoverable the number of unallocated pages is insufficient
  3947.                      for the new allocation request.  The program can recover
  3948.                      from this condition by either requesting again when
  3949.                      additional pages are available or specifying fewer pages.
  3950.  
  3951.           EXAMPLE
  3952.           
  3953.           emm_handle                         DW   ?
  3954.           realloc_count                      DW   ?
  3955.           current_alloc_page_count           DW   ?
  3956.           
  3957.           MOV  DX, emm_handle                ; specify EMM handle
  3958.  
  3959.                                                                        60
  3960.  
  3961.  
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.           MOV  BX, realloc_count             ; specify count
  3968.           MOV  AH, 51h                       ; load function code
  3969.           INT  67h                           ; call the memory manager
  3970.           OR   AH, AH                        ; check EMM status
  3971.           JNZ  emm_err_handler               ; jump to error handler on error
  3972.           MOV  current_alloc_page_count, BX
  3973.  
  3974.  
  3975.  
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998.  
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.  
  4008.  
  4009.  
  4010.  
  4011.  
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017.  
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.  
  4024.  
  4025.                                                                        61
  4026.  
  4027.  
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.      FUNCTION 19   GET/SET HANDLE ATTRIBUTE
  4034.  
  4035.           DESIGN CONSIDERATIONS
  4036.  
  4037.           This function is an option which will probably not be available in a
  4038.           typical expanded memory manager, system, or memory board.  Most
  4039.           personal computer systems disable memory refresh signals for a
  4040.           considerable period during a warm boot.  This can corrupt some of the
  4041.           data in memory boards, even though there is no problem with the design
  4042.           of the memory board, its operation, or the memory chips.  This memory
  4043.           refresh deficiency is present in the software design of the ROM BIOS
  4044.           in most personal computer systems.
  4045.  
  4046.           The majority of memory board designs, chip types, or personal computer
  4047.           systems won't be able to support the non-volatility feature.  The
  4048.           reason that this ROM BIOS deficiency is not evident in the
  4049.           conventional or extended memory area is that the ROM BIOS always
  4050.           initializes this area during a warm boot.  Memory data integrity is
  4051.           not a problem with the conventional or extended memory region, because
  4052.           it isn't physically possible to have data retained there across a warm
  4053.           boot event -- the ROM BIOS sets it to zero.
  4054.  
  4055.           Consequently, expanded memory board manufacturers should not supply
  4056.           this function unless their board can guarantee the integrity of data
  4057.           stored in the board's memory during a warm boot.  Generally, this
  4058.           means the memory board has an independent memory refresh controller
  4059.           which does not depend on the system board's memory refresh.
  4060.  
  4061.           If the expanded memory manager, system, or memory board cannot support
  4062.           this feature, it should return the not supported status described in
  4063.           the function.
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.  
  4088.  
  4089.  
  4090.  
  4091.                                                                        62
  4092.  
  4093.  
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.      FUNCTION 19   GET/SET HANDLE ATTRIBUTE (CONTINUED)
  4100.  
  4101.           GET HANDLE ATTRIBUTE SUBFUNCTION
  4102.  
  4103.           PURPOSE
  4104.  
  4105.           This subfunction returns the attribute associated with a handle.  The
  4106.           attributes are volatile or non-volatile.  Handles with non-volatile
  4107.           attributes enable the memory manager to save the contents of a
  4108.           handle's pages between warm boots.  However, this function may be
  4109.           disabled with a user option or may not be supported by the memory
  4110.           board or system hardware.
  4111.  
  4112.           If the handle's attribute has been set to non-volatile, the handle,
  4113.           its name (if it is assigned one), and the contents of the pages
  4114.           allocated to the handle are all maintained after a warm boot.
  4115.  
  4116.           CALLING PARAMETERS
  4117.  
  4118.           AX = 5200h
  4119.                      Contains the Get Handle Attribute subfunction.
  4120.  
  4121.           DX = handle
  4122.                      Contains the EMM handle.
  4123.  
  4124.           RESULTS
  4125.  
  4126.           These results are valid only if the status returned is zero.
  4127.  
  4128.           AL = handle attribute
  4129.                      Contains the EMM handle's attribute.  The only attributes a
  4130.                      handle may have are volatile or non-volatile.  A value of
  4131.                      zero indicates the handle is volatile.  A value of one
  4132.                      indicates that the handle is non-volatile.
  4133.  
  4134.           REGISTERS MODIFIED
  4135.  
  4136.           AX
  4137.  
  4138.           STATUS
  4139.  
  4140.           AH = 0     SUCCESSFUL
  4141.                      The handles attribute has been obtained.
  4142.  
  4143.           AH = 80h   NON-RECOVERABLE
  4144.                      The manager has detected a malfunction in the memory
  4145.                      manager software.
  4146.  
  4147.           AH = 81h   NON-RECOVERABLE
  4148.                      The manager has detected a malfunction in the expanded
  4149.                      memory hardware.
  4150.  
  4151.           AH = 83h   NON-RECOVERABLE
  4152.                      The manager couldn't find the specified EMM handle.  The
  4153.                      manager doesn't have any information pertaining to the
  4154.                      specified EMM handle.  The program may have corrupted its
  4155.                      EMM handle.
  4156.  
  4157.                                                                        63
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.           AH = 84h   NON-RECOVERABLE
  4166.                      The function code passed to the manager is not defined.
  4167.  
  4168.           AH = 8Fh   NON-RECOVERABLE
  4169.                      The subfunction parameter is invalid.
  4170.  
  4171.           AH = 91h   NON-RECOVERABLE
  4172.                      This feature is not supported.
  4173.  
  4174.           EXAMPLE
  4175.           
  4176.           emm_handle                         DW   ?
  4177.           handle_attrib                      DB   ?
  4178.           
  4179.           MOV  DX, emm_handle                ; specify EMM handle
  4180.           MOV  AX, 5200h                     ; load function code
  4181.           INT  67h                           ; call the memory manager
  4182.           OR   AH, AH                        ; check EMM status
  4183.           JNZ  emm_err_handler               ; jump to error handler on error
  4184.           MOV  handle_attrib, AL             ; save handle attribute
  4185.  
  4186.  
  4187.  
  4188.  
  4189.  
  4190.  
  4191.  
  4192.  
  4193.  
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202.  
  4203.  
  4204.  
  4205.  
  4206.  
  4207.  
  4208.  
  4209.  
  4210.  
  4211.  
  4212.  
  4213.  
  4214.  
  4215.  
  4216.  
  4217.  
  4218.  
  4219.  
  4220.  
  4221.  
  4222.  
  4223.                                                                        64
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.      FUNCTION 19   GET/SET HANDLE ATTRIBUTE (CONTINUED)
  4232.  
  4233.           SET HANDLE ATTRIBUTE SUBFUNCTION
  4234.  
  4235.           PURPOSE
  4236.  
  4237.           This subfunction can be used to modify the attribute which a handle
  4238.           has associated with it.  The attributes which a handle may have are
  4239.           volatile or non-volatile.  The non-volatile attribute enables the EMM
  4240.           to save the contents of a handle's pages between warm boots.  However,
  4241.           this function may be disabled with a user option or may not be
  4242.           supported by the memory board or system hardware.
  4243.  
  4244.           If the handle's attribute has been set to non-volatile, the handle,
  4245.           its name (if it is assigned one), and the contents of the pages
  4246.           allocated to the handle are all maintained after a warm boot.
  4247.  
  4248.           CALLING PARAMETERS
  4249.  
  4250.           AX = 5201h
  4251.                      Contains the Set Handle Attribute function.
  4252.  
  4253.           DX = handle
  4254.                      Contains the EMM handle.
  4255.  
  4256.           BL = new handle attribute
  4257.                      Contains the handle's new attribute.  A value of zero
  4258.                      indicates that the handle should be made volatile.  A value
  4259.                      of one indicates that the handle should be made non-
  4260.                      volatile.
  4261.  
  4262.                      A volatile handle attribute instructs the memory manager to
  4263.                      deallocate both the handle and the pages allocated to it
  4264.                      after a warm boot.  If all handles have the volatile
  4265.                      attribute (the default attribute) at warm boot, the handle
  4266.                      directory will be empty and all of expanded memory will be
  4267.                      initialized to zero immediately after a warm boot.
  4268.  
  4269.           REGISTERS MODIFIED
  4270.  
  4271.           AX
  4272.  
  4273.           STATUS
  4274.  
  4275.           AH = 0     SUCCESSFUL
  4276.                      The handles attribute has been modified.
  4277.  
  4278.           AH = 80h   NON-RECOVERABLE
  4279.                      The manager has detected a malfunction in the memory
  4280.                      manager software.
  4281.  
  4282.           AH = 81h   NON-RECOVERABLE
  4283.                      The manager has detected a malfunction in the expanded
  4284.                      memory hardware.
  4285.  
  4286.           AH = 83h   NON-RECOVERABLE
  4287.                      The manager could not find the specified EMM handle.  The
  4288.  
  4289.                                                                        65
  4290.  
  4291.  
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.                      manager doesn't have any information pertaining to the
  4298.                      specified EMM handle.  The program may have corrupted its
  4299.                      EMM handle.
  4300.  
  4301.           AH = 84h   NON-RECOVERABLE
  4302.                      The function code passed to the manager is not defined.
  4303.  
  4304.           AH = 8Fh   NON-RECOVERABLE
  4305.                      The subfunction parameter is invalid.
  4306.  
  4307.           AH = 90h   NON-RECOVERABLE
  4308.                      The attribute type is undefined.
  4309.  
  4310.           AH = 91h   NON-RECOVERABLE
  4311.                      This feature is not supported.
  4312.  
  4313.           EXAMPLE
  4314.           
  4315.           emm_handle                         DW   ?
  4316.           new_handle_attrib                  DB   ?
  4317.           
  4318.           MOV  DX, emm_handle                ; specify EMM handle
  4319.           MOV  BL, new_handle_attrib         ; specify the set attribute
  4320.           MOV  AX, 5201h                     ; load function code
  4321.           INT  67h                           ; call the memory manager
  4322.           OR   AH, AH                        ; check EMM status
  4323.           JNZ  emm_err_handler               ; jump to error handler on error
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334.  
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.  
  4344.  
  4345.  
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.                                                                        66
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.      FUNCTION 19   GET/SET HANDLE ATTRIBUTE (CONTINUED)
  4364.  
  4365.           GET ATTRIBUTE CAPABILITY SUBFUNCTION
  4366.  
  4367.           PURPOSE
  4368.  
  4369.           This subfunction can be used to determine whether the memory manager
  4370.           can support the non-volatile attribute.
  4371.  
  4372.           CALLING PARAMETERS
  4373.  
  4374.           AX = 5202h
  4375.                      Contains the Get Attribute Capability subfunction.
  4376.  
  4377.           RESULTS
  4378.  
  4379.           These results are valid only if the status returned is zero.
  4380.  
  4381.           AL = attribute capability
  4382.                      Contains the attribute capability.  A value of zero
  4383.                      indicates that the memory manager and hardware supports
  4384.                      only volatile handles.  A value of one indicates that the
  4385.                      memory manager/hardware supports both volatile and non-
  4386.                      volatile handles.
  4387.  
  4388.           REGISTERS MODIFIED
  4389.  
  4390.           AX
  4391.  
  4392.           STATUS
  4393.  
  4394.           AH = 0     SUCCESSFUL
  4395.                      The attribute capability has been returned.
  4396.  
  4397.           AH = 80h   NON-RECOVERABLE
  4398.                      The manager has detected a malfunction in the memory
  4399.                      manager software.
  4400.  
  4401.           AH = 81h   NON-RECOVERABLE
  4402.                      The manager has detected a malfunction in the expanded
  4403.                      memory hardware.
  4404.  
  4405.           AH = 84h   NON-RECOVERABLE
  4406.                      The function code passed to the manager is not defined.
  4407.  
  4408.           AH = 8Fh   NON-RECOVERABLE
  4409.                      The subfunction parameter is invalid.
  4410.  
  4411.           EXAMPLE
  4412.           
  4413.           attrib_capability                  DB  ?
  4414.           
  4415.           MOV  AX, 5202h                     ; load function code
  4416.           INT  67h                           ;  call the memory manager
  4417.           OR   AH, AH                        ; check EMM status
  4418.           JNZ  emm_err_handler               ; jump to error handler on error
  4419.           MOV  attrib_capability, AL         ; save attribute capability
  4420.  
  4421.                                                                        67
  4422.  
  4423.  
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.      FUNCTION 20   GET/SET HANDLE NAME
  4430.  
  4431.           GET HANDLE NAME SUBFUNCTION
  4432.  
  4433.           PURPOSE
  4434.  
  4435.           This subfunction gets the eight character name currently assigned to a
  4436.           handle.  There is no restriction on the characters which may be used
  4437.           in the handle name (that is, anything from 00h through FFh).
  4438.  
  4439.           The handle name is initialized to ASCII nulls (binary zeros) three
  4440.           times: when the memory manager is installed, when a handle is
  4441.           allocated, and when a handle is deallocated.  A handle with a name
  4442.           which is all ASCII nulls, by definition, has no name.  When a handle
  4443.           is assigned a name, at least one character in the name must be a non-
  4444.           null character in order to distinguish it from a handle without a
  4445.           name.
  4446.  
  4447.           CALLING PARAMETERS
  4448.  
  4449.           AX = 5300h
  4450.                      Contains the Get Handle Name function.
  4451.  
  4452.           DX = handle number
  4453.                      Contains the EMM handle.
  4454.  
  4455.           ES:DI = pointer to handle_name array
  4456.                      Contains a pointer to an eight-byte array into which the
  4457.                      name currently assigned to the handle will be copied.
  4458.  
  4459.           RESULTS
  4460.  
  4461.           These results are valid only if the status returned is zero.
  4462.  
  4463.           handle_name array
  4464.                      Contains the name associated with the specified handle.
  4465.  
  4466.           REGISTERS MODIFIED
  4467.  
  4468.           AX
  4469.  
  4470.           STATUS
  4471.  
  4472.           AH = 0     SUCCESSFUL
  4473.                      The handle name has been returned.
  4474.  
  4475.           AH = 80h   NON-RECOVERABLE
  4476.                      The manager has detected a malfunction in the memory
  4477.                      manager software.
  4478.  
  4479.           AH = 81h   NON-RECOVERABLE
  4480.                      The manager has detected a malfunction in the expanded
  4481.                      memory hardware.
  4482.  
  4483.           AH = 83h   NON-RECOVERABLE
  4484.                      The manager couldn't find the specified EMM handle.  The
  4485.  
  4486.  
  4487.                                                                        68
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.                      manager doesn't have any information on the specified EMM
  4496.                      handle.  The program may have corrupted its EMM handle.
  4497.  
  4498.           AH = 84h   NON-RECOVERABLE
  4499.                      The function code passed to the manager is not defined.
  4500.  
  4501.           AH = 8Fh   NON-RECOVERABLE
  4502.                      The subfunction parameter is invalid.
  4503.  
  4504.           EXAMPLE
  4505.           
  4506.           handle_name                        DB 8 DUP (?)
  4507.           emm_handle                         DW   ?
  4508.           
  4509.           MOV  AX, SEG handle_name
  4510.           MOV  ES, AX
  4511.           LEA  DI, handle_name               ; ES:DI points to handle_name
  4512.           MOV  DX, emm_handle                ; specify EMM handle
  4513.           MOV  AX, 5300h                     ; load function code
  4514.           INT  67h                           ; call the memory manager
  4515.           OR   AH, AH                        ; check EMM status
  4516.           JNZ  emm_err_handler               ; jump to error handler on error
  4517.  
  4518.  
  4519.  
  4520.  
  4521.  
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.                                                                        69
  4554.  
  4555.  
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.      FUNCTION 20   GET/SET HANDLE NAME
  4562.  
  4563.           SET HANDLE NAME SUBFUNCTION
  4564.  
  4565.           PURPOSE
  4566.  
  4567.           This subfunction assigns an eight character name to a handle.  There
  4568.           is no restriction on the characters which may be used in the handle
  4569.           name.  The full range of values may be assigned to each character in a
  4570.           name (that is, 00h through FFh).
  4571.  
  4572.           At installation, all handles have their name initialized to ASCII
  4573.           nulls (binary zeros).  A handle with a name consisting of all ASCII
  4574.           nulls has no name.  When a handle is assigned a name, at least one
  4575.           character in the name must be a non-null character in order to
  4576.           distinguish it from a handle without a name.  No two handles may have
  4577.           the same name.
  4578.  
  4579.           A handle can be renamed at any time by setting the handles name to a
  4580.           new value.  A handle can have its name removed by setting the handle's
  4581.           name to all ASCII nulls.  When a handle is deallocated, its name is
  4582.           removed (set to ASCII nulls).
  4583.  
  4584.           CALLING PARAMETERS
  4585.  
  4586.           AX = 5301h
  4587.                      Contains the Set Handle Name function.
  4588.  
  4589.           DX = handle number
  4590.                      Contains the EMM handle.
  4591.  
  4592.           DS:SI = pointer to handle_name
  4593.                      Contains a pointer to a byte array which contains the name
  4594.                      that is to be assigned to the handle.  The handle name must
  4595.                      be padded with nulls if the name is less than eight
  4596.                      characters long.
  4597.  
  4598.           REGISTERS MODIFIED
  4599.  
  4600.           AX
  4601.  
  4602.           STATUS
  4603.  
  4604.           AH = 0     SUCCESSFUL
  4605.                      The handle name has been assigned.
  4606.  
  4607.           AH = 80h   NON-RECOVERABLE
  4608.                      The manager has detected a malfunction in the memory
  4609.                      manager software.
  4610.  
  4611.           AH = 81h   NON-RECOVERABLE
  4612.                      The manager has detected a malfunction in the expanded
  4613.                      memory hardware.
  4614.  
  4615.           AH = 83h   NON-RECOVERABLE
  4616.                      The manager couldn't find the specified EMM handle.  The
  4617.                      manager doesn't currently have any information pertaining
  4618.  
  4619.                                                                        70
  4620.  
  4621.  
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.                      to the specified EMM handle.  The program may have
  4628.                      corrupted its EMM handle.
  4629.  
  4630.           AH = 84h   NON-RECOVERABLE
  4631.                      The function code passed to the manager is not defined.
  4632.  
  4633.           AH = 8Fh   NON-RECOVERABLE
  4634.                      The subfunction parameter is invalid.
  4635.  
  4636.           AH = A1h   RECOVERABLE
  4637.                      A handle with this name already exists.  The specified
  4638.                      handle was not assigned a name.
  4639.  
  4640.           EXAMPLE
  4641.           
  4642.           handle_name                        DB "AARDVARK"
  4643.           emm_handle                         DW   ?
  4644.           
  4645.           MOV  AX, SEG handle_name
  4646.           MOV  DS, AX
  4647.           LEA  SI, handle_name               ; DS:SI points to handle_name
  4648.           MOV  DX, emm_handle                ; specify EMM handle
  4649.           MOV  AX, 5301h                     ; load function code
  4650.           INT  67h                           ; call the memory manager
  4651.           OR   AH, AH                        ; check EMM status
  4652.           JNZ  emm_err_handler               ; jump to error handler on error
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.  
  4682.  
  4683.  
  4684.  
  4685.                                                                        71
  4686.  
  4687.  
  4688.  
  4689.  
  4690.  
  4691.  
  4692.  
  4693.      FUNCTION 21   GET HANDLE DIRECTORY
  4694.  
  4695.           GET HANDLE DIRECTORY SUBFUNCTION
  4696.  
  4697.           PURPOSE
  4698.  
  4699.           This function returns an array which contains all active handles and
  4700.           the names associated with each.  Handles which have not been assigned
  4701.           names have a default name of all ASCII nulls (binary zeros).  When a
  4702.           handle is first allocated, or when all the pages belonging to a handle
  4703.           are deallocated (that is, an open handle is closed), its default name
  4704.           is set to ASCII nulls.  It takes a subsequent assignment of a name for
  4705.           a handle to have a name after it has been opened.  The full range of
  4706.           values may be assigned to each character in a name (that is, 00h
  4707.           through FFh).
  4708.  
  4709.           The number of bytes required by the array is:
  4710.  
  4711.                     10 bytes * total number of handles
  4712.  
  4713.           The maximum size of this array is:
  4714.  
  4715.                     (10 bytes/entry) * 255 entries = 2550 bytes.
  4716.  
  4717.           CALLING PARAMETERS
  4718.  
  4719.           AX = 5400h
  4720.                      Contains the Get Handle Directory function.
  4721.  
  4722.           handle_dir_struct   STRUC
  4723.              handle_value     DW  ?
  4724.              handle_name      DB  8  DUP  (?)
  4725.           handle_dir_struct   ENDS
  4726.  
  4727.           ES:DI = pointer to handle_dir
  4728.                      Contains a pointer to an area of memory into which the
  4729.                      memory manager will copy the handle directory.  The handle
  4730.                      directory is an array of structures.  There are as many
  4731.                      entries in the array as there are open EMM handles.  The
  4732.                      structure consists of the following elements:
  4733.  
  4734.           .handle_value
  4735.                      The first member is a word which contains the value of the
  4736.                      open EMM handle.
  4737.  
  4738.           .handle_name
  4739.                      The second member is an 8 byte array which contains the
  4740.                      ASCII name associated with the EMM handle.  If there is no
  4741.                      name currently associated with the handle, it has a value
  4742.                      of all zeros (ASCII nulls).
  4743.  
  4744.           RESULTS
  4745.  
  4746.           These results are valid only if the status returned is zero.
  4747.  
  4748.  
  4749.  
  4750.  
  4751.                                                                        72
  4752.  
  4753.  
  4754.  
  4755.  
  4756.  
  4757.  
  4758.  
  4759.           handle_dir
  4760.                      Contains the handle values and handle names associated with
  4761.                      each handle value.
  4762.  
  4763.           AL = number of entries in the handle_dir array
  4764.                      Contains the number of entries in the handle directory
  4765.                      array.  This is also the same as the number of open
  4766.                      handles.  For example, if only one handle is active, AL
  4767.                      will contain a one.
  4768.  
  4769.           REGISTERS MODIFIED
  4770.  
  4771.           AX
  4772.  
  4773.           STATUS
  4774.  
  4775.           AH = 0     SUCCESSFUL
  4776.                      The handle directory has been returned.
  4777.  
  4778.           AH = 80h   NON-RECOVERABLE
  4779.                      The manager has detected a malfunction in the memory
  4780.                      manager software.
  4781.  
  4782.           AH = 81h   NON-RECOVERABLE
  4783.                      The manager has detected a malfunction in the expanded
  4784.                      memory hardware.
  4785.  
  4786.           AH = 84h   NON-RECOVERABLE
  4787.                      The function code passed to the manager is not defined.
  4788.  
  4789.           AH = 8Fh   NON-RECOVERABLE
  4790.                      The subfunction parameter is invalid.
  4791.  
  4792.           EXAMPLE
  4793.           
  4794.           handle_dir                         handle_dir_struct 255 DUP (?)
  4795.           num_entries_in_handle_dir          DB ?
  4796.           
  4797.           MOV  AX, SEG handle_dir
  4798.           MOV  ES, AX
  4799.           LEA  DI, handle_dir                ; ES:DI points to handle_dir
  4800.           MOV  AX, 5400h                     ; load function code
  4801.           INT  67h                           ; call the memory manager
  4802.           OR   AH, AH                        ; check EMM status
  4803.           JNZ  emm_err_handler               ; jump to error handler on error
  4804.           MOV  num_entries_in_handle_dir, AL ; save number of entries
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.                                                                        73
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.      FUNCTION 21   GET HANDLE DIRECTORY
  4826.  
  4827.           SEARCH FOR NAMED HANDLE SUBFUNCTION
  4828.  
  4829.           PURPOSE
  4830.  
  4831.           This subfunction searches the handle name directory for a handle with
  4832.           a particular name.  If the named handle is found, this subfunction
  4833.           returns the handle number associated with the name.  At the time of
  4834.           installation, all handles have their names initialized to ASCII nulls.
  4835.           A handle with a name which is all ASCII nulls has, by definition, no
  4836.           name.  When a handle is assigned a name, at least one character in the
  4837.           name must be a non-null character in order to distinguish it from a
  4838.           handle without a name.
  4839.  
  4840.           CALLING PARAMETERS
  4841.  
  4842.           AX = 5401h
  4843.                      Contains the Search for Named Handle subfunction.
  4844.  
  4845.           DS:SI = handle_name
  4846.                      Contains a pointer to an 8-byte string that contains the
  4847.                      name of the handle be searched for.
  4848.  
  4849.           RESULTS
  4850.  
  4851.           These results are valid only if the status returned is zero.
  4852.  
  4853.           DX = value of named handle
  4854.                      The value of the handle which matches the handle name
  4855.                      specified.
  4856.  
  4857.           REGISTERS MODIFIED
  4858.  
  4859.           AX, DX
  4860.  
  4861.           STATUS
  4862.  
  4863.           AH = 0     SUCCESSFUL
  4864.                      The handle value for the named handle has been found.
  4865.  
  4866.           AH = 80h   NON-RECOVERABLE
  4867.                      The manager has detected a malfunction in the memory
  4868.                      manager software.
  4869.  
  4870.           AH = 81h   NON-RECOVERABLE
  4871.                      The manager has detected a malfunction in the expanded
  4872.                      memory hardware.
  4873.  
  4874.           AH = 84h   NON-RECOVERABLE
  4875.                      The function code passed to the manager is not defined.
  4876.  
  4877.           AH = 8Fh   NON-RECOVERABLE
  4878.                      The subfunction parameter is invalid.
  4879.  
  4880.  
  4881.  
  4882.  
  4883.                                                                        74
  4884.  
  4885.  
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  
  4891.           AH = A0h   RECOVERABLE
  4892.                      No corresponding handle could be found for the handle name
  4893.                      specified.
  4894.  
  4895.           AH = A1h   NON-RECOVERABLE
  4896.                      A handle found had no name (all ASCII nulls).
  4897.  
  4898.           EXAMPLE
  4899.           
  4900.           named_handle                       DB  'AARDVARK'
  4901.           named_handle_value                 DW  ?
  4902.           
  4903.           MOV  AX, SEG named_handle
  4904.           MOV  DS, AX
  4905.           LEA  SI, named_handle              ; DS:SI points to named_handle
  4906.           MOV  AX, 5401h                     ; load function code
  4907.           INT  67h                           ; call the memory manager
  4908.           OR   AH, AH                        ; check EMM status
  4909.           JNZ  emm_err_handler               ; jump to error handler on error
  4910.           MOV  named_handle_value, DX        ; save value of named handle
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.                                                                        75
  4950.  
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.      FUNCTION 21   GET HANDLE DIRECTORY
  4958.  
  4959.           GET TOTAL HANDLES SUBFUNCTION
  4960.  
  4961.           PURPOSE
  4962.  
  4963.           This subfunction returns the total number of handles that the memory
  4964.           manager supports, including the operating system handle (handle value
  4965.           0).
  4966.  
  4967.           CALLING PARAMETERS
  4968.  
  4969.           AX = 5402h
  4970.                      Contains the Get Total Handles subfunction.
  4971.  
  4972.           RESULTS
  4973.  
  4974.           These results are valid only if the status returned is zero.
  4975.  
  4976.           BX = total_handles
  4977.                      The value returned represents the maximum number of handles
  4978.                      which a program may request the memory manager to allocate
  4979.                      memory to.  The value returned includes the operating
  4980.                      system handle (handle value 0).
  4981.  
  4982.           REGISTERS MODIFIED
  4983.  
  4984.           AX, BX
  4985.  
  4986.           STATUS
  4987.  
  4988.           AH = 0     SUCCESSFUL
  4989.                      The total number of handles supported has been returned.
  4990.  
  4991.           AH = 80h   NON-RECOVERABLE
  4992.                      The manager has detected a malfunction in the memory
  4993.                      manager software.
  4994.  
  4995.           AH = 81h   NON-RECOVERABLE
  4996.                      The manager has detected a malfunction in the expanded
  4997.                      memory hardware.
  4998.  
  4999.           AH = 84h   NON-RECOVERABLE
  5000.                      The function code passed to the manager is not defined.
  5001.  
  5002.           AH = 8Fh   NON-RECOVERABLE
  5003.                      The subfunction parameter is invalid.
  5004.  
  5005.           EXAMPLE
  5006.           
  5007.           total_handles                      DW     ?
  5008.           
  5009.           MOV  AX, 5402h                     ; load function code
  5010.           INT  67h                           ; call the memory manager
  5011.           OR   AH, AH                        ; check EMM status
  5012.           JNZ  emm_err_handler               ; jump to error handler on error
  5013.           MOV  total_handles, BX             ; save total handle count
  5014.  
  5015.                                                                        76
  5016.  
  5017.  
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.      FUNCTION 22   ALTER PAGE MAP & JUMP
  5024.  
  5025.           PURPOSE
  5026.  
  5027.           This function alters the memory mapping context and transfers control
  5028.           to the specified address.  It is analogous to the FAR JUMP in the 8086
  5029.           family architecture.  The memory mapping context which existed before
  5030.           the invocation of this function is lost.
  5031.  
  5032.           Mapping no pages and jumping is not considered an error.  If a request
  5033.           to map zero pages and jump is made, control is transferred to the
  5034.           target address, and this function performs a far jump.
  5035.  
  5036.           CALLING PARAMETERS
  5037.  
  5038.           AH = 55h
  5039.                      Contains the Alter Page Map & Jump function.
  5040.  
  5041.           log_phys_map_struct       STRUC
  5042.              log_page_number        DW ?
  5043.              phys_page_number_seg   DW ?
  5044.           log_phys_map_struct       ENDS
  5045.  
  5046.           map_and_jump_struct       STRUC
  5047.           target_address            DD ?
  5048.           log_phys_map_len          DB ?
  5049.           log_phys_map_ptr          DD ?
  5050.           map_and_jump_struct       ENDS
  5051.  
  5052.           AL = physical page number/segment selector
  5053.                      Contains a code which indicates whether the value contained
  5054.                      in the .log_phys_map.phys_page_number_seg are physical page
  5055.                      numbers or are the segment address representation of the
  5056.                      physical page numbers.  A zero in AL indicates that the
  5057.                      values are physical page numbers.  A one in AL indicates
  5058.                      that the values in these members are the segment address
  5059.                      representations of the physical page numbers.
  5060.  
  5061.           DX = handle number
  5062.                      Contains the EMM handle.
  5063.  
  5064.           DS:SI = pointer to map_and_jump structure
  5065.                      Contains a pointer to a structure that contains the
  5066.                      information necessary to map the desired physical pages and
  5067.                      jump to the target address.  The structure consists of the
  5068.                      following elements:
  5069.  
  5070.           .target_address
  5071.                      The first member is a far pointer which contains the target
  5072.                      address to which control is to be transferred.  The address
  5073.                      is represented in segment:offset format.  The offset
  5074.                      portion of the address is stored in the low portion of the
  5075.                      double word.
  5076.  
  5077.           .log_phys_map_len
  5078.                      The second member is a byte which contains the number of
  5079.                      entries in the array of structures which immediately
  5080.  
  5081.                                                                        77
  5082.  
  5083.  
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.                      follows it.  The array is as long as the application
  5090.                      developer needs to map the desired logical pages into
  5091.                      physical pages.  The number of entries cannot exceed the
  5092.                      number of mappable pages in the system.
  5093.  
  5094.           .log_phys_map_ptr
  5095.                      The third member is a pointer to an array of structures
  5096.                      which contain the logical page numbers and  Alternate DMA
  5097.                      register sets physical page numbers or segment addresses at
  5098.                      which they are to be mapped.  Each entry in the array of
  5099.                      structures contains the following two elements:
  5100.  
  5101.           .log_page_number
  5102.                      The first member of this structure is a word which contains
  5103.                      the number of the logical page to be mapped.
  5104.  
  5105.           .phys_page_number_seg
  5106.                      The second member of this structure is a word which
  5107.                      contains either the physical page number or the segment
  5108.                      address representation of the physical page number at which
  5109.                      the previous logical page number is to be mapped.  The
  5110.                      value passed in AL determines the type of representation.
  5111.  
  5112.           REGISTERS MODIFIED
  5113.  
  5114.           AX
  5115.  
  5116.           Note...............................................................
  5117.  
  5118.           Values in registers which don't contain required parameters maintain
  5119.           the values across the jump.  The values in registers (with the
  5120.           exception of AX) and the flag state at the beginning of the function
  5121.           are still in the registers and flags when the target address is
  5122.           reached.
  5123.  
  5124.           STATUS
  5125.  
  5126.           AH = 0     SUCCESSFUL
  5127.                      Control has been transferred to the target address.
  5128.  
  5129.           AH = 80h   NON-RECOVERABLE
  5130.                      The manager has detected a malfunction in the memory
  5131.                      manager software.
  5132.  
  5133.           AH = 81h   NON-RECOVERABLE
  5134.                      The manager has detected a malfunction in the expanded
  5135.                      memory hardware.
  5136.  
  5137.           AH = 83h   NON-RECOVERABLE
  5138.                      The manager could not find the specified EMM handle.  The
  5139.                      manager does not currently have any information pertaining
  5140.                      to the specified EMM handle.  The program may have
  5141.                      corrupted its EMM handle.
  5142.  
  5143.           AH = 84h   NON-RECOVERABLE
  5144.                      The function code passed to the manager is not defined.
  5145.  
  5146.  
  5147.                                                                        78
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.           AH = 8Ah   RECOVERABLE
  5156.                      One or more of the logical pages to map into a
  5157.                      corresponding physical page is out of the range of logical
  5158.                      pages which are allocated to the EMM handle.  The program
  5159.                      can recover from this condition by mapping a logical page
  5160.                      which is within the bounds for the EMM handle.
  5161.  
  5162.           AH = 8Bh   RECOVERABLE
  5163.                      One or more of the physical pages is out of the range of
  5164.                      allowable physical pages, or the log_phys_map_len exceeds
  5165.                      the number of mappable pages in the system.  Physical page
  5166.                      numbers are numbered zero relative.  The program can
  5167.                      recover from this condition by mapping into memory at a
  5168.                      physical page which is in the range of supported physical
  5169.                      pages.
  5170.  
  5171.           AH = 8Fh   RECOVERABLE
  5172.                      The subfunction parameter is invalid.
  5173.  
  5174.           EXAMPLE
  5175.           
  5176.           log_phys_map                       log_phys_map_struct (?) DUP (?)
  5177.           map_and_jump                       map_and_jump_struct (?)
  5178.           emm_handle                         DW ?
  5179.           phys_page_or_seg_mode              DB ?
  5180.           
  5181.           MOV  AX, SEG map_and_jump
  5182.           MOV  DS, AX
  5183.           LEA  SI, map_and_jump              ; DS:SI points to map_and_jump
  5184.           MOV  DX, emm_handle
  5185.           MOV  AH, 55h                       ; load function code
  5186.           MOV  AL, phys_page_or_seg_mode     ; specify physical page or seg
  5187.                                              ; mode
  5188.           INT  67h                           ; call memory manager
  5189.           OR   AH, AH                        ; check EMM status
  5190.           JNZ  emm_err_handler               ; jump to error handler on error
  5191.  
  5192.  
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.  
  5210.  
  5211.  
  5212.  
  5213.                                                                        79
  5214.  
  5215.  
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.      FUNCTION 23   ALTER PAGE MAP & CALL
  5222.  
  5223.           ALTER PAGE MAP & CALL SUBFUNCTION
  5224.  
  5225.           PURPOSE
  5226.  
  5227.           This subfunction saves the current memory mapping context, alters the
  5228.           specified memory mapping context, and transfers control to the
  5229.           specified address.  It is analogous to the FAR CALL in the 8086 family
  5230.           architecture.  Just as a return from a FAR CALL restores the original
  5231.           value in the code segment register, this subfunction restores the
  5232.           state of the specified mapping context after the return.
  5233.  
  5234.           There is no explicit expanded memory subfunction which emulates a
  5235.           return from a FAR CALL.  However, this facility is implicitly
  5236.           available through the standard return from a FAR CALL.  The following
  5237.           paragraphs describe how this works:
  5238.  
  5239.           After this function is invoked, unless an error is detected, the
  5240.           memory manager will transfer control to the address specified.  If an
  5241.           error occurs, the memory manager returns immediately with the error
  5242.           code in the AH register.  Otherwise, the memory manager pushes on the
  5243.           stack information which enables it to restore the mapping context
  5244.           after the return.
  5245.  
  5246.           When the called procedure wants to return to the calling procedure, it
  5247.           simply issues a standard FAR RETURN.  The memory manager traps this
  5248.           return, restores the specified mapping context, and returns to the
  5249.           calling procedure.  The memory manager also returns a status from a
  5250.           successful return just as it does for all functions.
  5251.  
  5252.           Developers using this subfunction must make allowances for the
  5253.           additional stack space this subfunction will use.
  5254.  
  5255.           CALLING PARAMETERS
  5256.  
  5257.           AH = 56h
  5258.                      Contains the Alter Page Map & Call function.
  5259.  
  5260.           log_phys_map_struct       STRUC
  5261.              log_page_number        DW ?
  5262.              phys_page_number_seg   DW ?
  5263.           log_phys_map_struct       ENDS
  5264.  
  5265.           map_and_call_struct       STRUC
  5266.              target_address         DD ?
  5267.              new_page_map_len       DB ?
  5268.              new_page_map_ptr       DD ?
  5269.              old_page_map_len       DB ?
  5270.              old_page_map_ptr       DD ?
  5271.              reserved               DW  4 DUP (?)
  5272.           map_and_call_struct       ENDS
  5273.  
  5274.           AL = physical page number/segment selector
  5275.                      Contains a code which indicates whether the value contained
  5276.                      in the
  5277.  
  5278.  
  5279.                                                                        80
  5280.  
  5281.  
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.           .new_page_map.phys_page_number_seg/.old_page_map.phys_page_number_seg
  5288.                      members are physical pages numbers or are the segment
  5289.                      address representation of the physical page numbers.  A
  5290.                      value of zero in AL indicates that the values in these
  5291.                      members are physical page numbers.  A value of one in AL
  5292.                      indicates that the values in these members are the segment
  5293.                      address representations of the physical page numbers.
  5294.  
  5295.           DX = handle number
  5296.                      Contains the EMM handle.
  5297.  
  5298.           DS:SI = pointer to map_and_call structure
  5299.                      Contains a pointer to a structure which contains the
  5300.                      information necessary to map the desired physical pages and
  5301.                      call the target address.  The structure members are
  5302.                      described here:
  5303.  
  5304.           .target_address
  5305.                      The first member is a far pointer which contains the target
  5306.                      address to which control is to be transferred.  The address
  5307.                      is represented in segment:offset format.  The offset
  5308.                      portion of the address is stored in the low portion of the
  5309.                      pointer.  The application must supply this value.
  5310.  
  5311.           .new_page_map_len
  5312.                      The second member is a byte which contains the number of
  5313.                      entries in the new mapping context to which
  5314.                      new_page_map_ptr points.  This number cannot exceed the
  5315.                      number of mappable pages in the system.
  5316.  
  5317.           .new_page_map_ptr
  5318.                      The third member is a far pointer that points to an array
  5319.                      of structures which contains a list of the logical page
  5320.                      numbers and the physical page numbers/segments at which
  5321.                      they are to be mapped immediately after the call.  The
  5322.                      contents of the new array of structures are described at
  5323.                      the end of the map_and_call structure.
  5324.  
  5325.           .old_page_map_len
  5326.                      The fourth member is a byte which contains the number of
  5327.                      entries in the old mapping context to which
  5328.                      old_page_map_ptr points.  This number cannot exceed the
  5329.                      number of mappable pages in the system.
  5330.  
  5331.           .old_page_map_ptr
  5332.                      The fifth member is a far pointer that points to an array
  5333.                      of structures which contains a list of the logical page
  5334.                      numbers and the physical page numbers/segments at which
  5335.                      they are to be mapped immediately after the return.  The
  5336.                      contents of the old array of structures are described at
  5337.                      the end of the map_and_call structure.
  5338.  
  5339.           .reserved
  5340.                      The sixth member is reserved for use by the memory manager.
  5341.  
  5342.           Each entry in the old and new array of structures contains two
  5343.           elements:
  5344.  
  5345.                                                                        81
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.           .log_page_number
  5354.                      The first member of this structure is a word which contains
  5355.                      a logical page number which is to be mapped at the
  5356.                      succeeding physical page number/segment immediately after
  5357.                      the CALL (in the case of the new array of structures) or
  5358.                      after the RETURN (in the case of the old array of
  5359.                      structures).
  5360.  
  5361.           .phys_page_number_seg
  5362.                      The second member of this structure is a word which
  5363.                      contains either the physical page number or the segment
  5364.                      address representation of the physical page number/segment
  5365.                      at which the preceding logical page is to be mapped
  5366.                      immediately after the CALL (in the case of the new array of
  5367.                      structures) or after the RETURN (in the case of the old
  5368.                      array of structures).
  5369.  
  5370.           REGISTERS MODIFIED
  5371.  
  5372.           AX
  5373.  
  5374.           Note..............................................................
  5375.  
  5376.           Values in registers which don't contain required parameters maintain
  5377.           the values across the call.  The values in registers (with the
  5378.           exception of AX) and the flag state at the beginning of the function
  5379.           are still in the registers and flags when the target address is
  5380.           reached.
  5381.  
  5382.           STATUS
  5383.  
  5384.           AH = 0     SUCCESSFUL
  5385.                      Control has been transferred to the target address.
  5386.  
  5387.           AH = 80h   NON-RECOVERABLE
  5388.                      The manager has detected a malfunction in the memory
  5389.                      manager software.
  5390.  
  5391.           AH = 81h   NON-RECOVERABLE
  5392.                      The manager has detected a malfunction in the expanded
  5393.                      memory hardware.
  5394.  
  5395.           AH = 83h   NON-RECOVERABLE
  5396.                      The manager couldn't find the specified EMM handle.  The
  5397.                      manager doesn't have any information pertaining to the
  5398.                      specified EMM handle.  The program may have corrupted its
  5399.                      EMM handle.
  5400.  
  5401.           AH = 84h   NON-RECOVERABLE
  5402.                      The function code passed to the manager is not defined.
  5403.  
  5404.           AH = 8Ah   RECOVERABLE
  5405.                      One or more of the logical pages to map into a
  5406.                      corresponding physical page is out of the range of logical
  5407.                      pages which are allocated to the EMM handle.  The program
  5408.                      can recover from this condition by mapping a logical page
  5409.                      which is within the bounds for the EMM handle.
  5410.  
  5411.                                                                        82
  5412.  
  5413.  
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.           AH = 8Bh   RECOVERABLE
  5420.                      One or more of the physical pages is out of the range of
  5421.                      allowable physical pages, or you've specified more physical
  5422.                      pages than exist in the system.  Physical page numbers are
  5423.                      numbered zero relative.  The program can recover from this
  5424.                      condition by mapping a physical page which is in the range
  5425.                      from zero to three.
  5426.  
  5427.           AH = 8Fh   NON-RECOVERABLE
  5428.                      The subfunction parameter is invalid.
  5429.  
  5430.           EXAMPLE
  5431.           
  5432.           new_page_map             log_phys_map_struct (?) DUP (?)
  5433.           old_page_map             log_phys_map_struct (?) DUP (?)
  5434.           map_and_call             map_and_call_struct (?)
  5435.           emm_handle               DW ?
  5436.           phys_page_or_seg_mode    DB ?
  5437.           
  5438.           MOV  AX, SEG map_and_call
  5439.           MOV  DS, AX
  5440.           LEA  SI, map_and_call              ; DS:SI points to map_and_call
  5441.           MOV  DX, emm_handle                ; specify EMM handle
  5442.           MOV  AH, 56h                       ; load function code
  5443.           MOV  AL, phys_page_or_seg_mode     ; specify physical page or seg
  5444.                                              ; mode
  5445.           INT  67h                           ; control is actually
  5446.                                              ; transferred to the called
  5447.                                              ; procedure at this point
  5448.           OR   AH, AH                        ; check EMM status
  5449.           JNZ  emm_err_handler               ; jump to error handler on error
  5450.  
  5451.  
  5452.  
  5453.  
  5454.  
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.                                                                        83
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.  
  5484.  
  5485.      FUNCTION 23   ALTER PAGE MAP & CALL
  5486.  
  5487.           GET PAGE MAP STACK SPACE SIZE SUBFUNCTION
  5488.  
  5489.           PURPOSE
  5490.  
  5491.           Since the Alter Page Map & Call function pushes additional information
  5492.           onto the stack, this subfunction returns the number of bytes of stack
  5493.           space the function requires.
  5494.  
  5495.           CALLING PARAMETERS
  5496.  
  5497.           AX = 5602h
  5498.                      Contains the Get Page Map Stack Space Size subfunction.
  5499.  
  5500.           RESULTS
  5501.  
  5502.           These results are valid only if the status returned is zero.
  5503.  
  5504.           BX = stack space required
  5505.                      Contains the number of bytes which the Alter Page Map &
  5506.                      Call function will require.  In other words, BX contains
  5507.                      the number (including the return address) which has to be
  5508.                      added to the stack pointer to remove all elements from the
  5509.                      stack.
  5510.  
  5511.           REGISTERS MODIFIED
  5512.  
  5513.           AX, BX
  5514.  
  5515.           STATUS
  5516.  
  5517.           AH = 0     SUCCESSFUL
  5518.                      The size of the array has been returned.
  5519.  
  5520.           AH = 80h   NON-RECOVERABLE
  5521.                      The manager has detected a malfunction in the memory
  5522.                      manager software.
  5523.  
  5524.           AH = 81h   NON-RECOVERABLE
  5525.                      The manager has detected a malfunction in the expanded
  5526.                      memory hardware.
  5527.  
  5528.           AH = 84h   NON-RECOVERABLE
  5529.                      The function code passed to the manager is not defined.
  5530.  
  5531.           AH = 8Fh   NON-RECOVERABLE
  5532.                      The subfunction parameter is invalid.
  5533.  
  5534.           EXAMPLE
  5535.           
  5536.           stack_space_reqd                   DW ?
  5537.           
  5538.           MOV  AX, 5602h                     ; load function code
  5539.           INT  67h                           ; call the memory manager
  5540.           OR   AH, AH                        ; check EMM status
  5541.           JNZ  emm_err_handler               ; jump to error handler on error
  5542.  
  5543.                                                                        84
  5544.  
  5545.  
  5546.  
  5547.  
  5548.  
  5549.  
  5550.  
  5551.           MOV  stack_space_reqd, BX          ; save required stack size count
  5552.  
  5553.  
  5554.  
  5555.  
  5556.  
  5557.  
  5558.  
  5559.  
  5560.  
  5561.  
  5562.  
  5563.  
  5564.  
  5565.  
  5566.  
  5567.  
  5568.  
  5569.  
  5570.  
  5571.  
  5572.  
  5573.  
  5574.  
  5575.  
  5576.  
  5577.  
  5578.  
  5579.  
  5580.  
  5581.  
  5582.  
  5583.  
  5584.  
  5585.  
  5586.  
  5587.  
  5588.  
  5589.  
  5590.  
  5591.  
  5592.  
  5593.  
  5594.  
  5595.  
  5596.  
  5597.  
  5598.  
  5599.  
  5600.  
  5601.  
  5602.  
  5603.  
  5604.  
  5605.  
  5606.  
  5607.  
  5608.  
  5609.                                                                        85
  5610.  
  5611.  
  5612.  
  5613.  
  5614.  
  5615.  
  5616.  
  5617.      FUNCTION 24   MOVE/EXCHANGE MEMORY REGION
  5618.  
  5619.           MOVE MEMORY REGION SUBFUNCTION
  5620.  
  5621.           PURPOSE
  5622.  
  5623.           This subfunction copies a region of memory in the following memory
  5624.           source/destination combinations.
  5625.  
  5626.           o   conventional memory to conventional memory
  5627.  
  5628.           o   conventional memory to expanded memory
  5629.  
  5630.           o   expanded memory to conventional memory
  5631.  
  5632.           o   expanded memory to expanded memory
  5633.  
  5634.           You do not have to save and restore the expanded memory mapping
  5635.           context to perform these move operations.  The current mapping context
  5636.           is maintained throughout this operation.
  5637.  
  5638.           The length of the region is limited by the amount of expanded memory
  5639.           allocated to the handles specified.
  5640.  
  5641.           However, in most practical applications, the region length will be
  5642.           considerably smaller.  A region length of zero is not an error, and no
  5643.           move will be performed.
  5644.  
  5645.           A region length which exceeds 16K bytes is not an error.  In this case
  5646.           the function assumes that a group of logical pages is the target for
  5647.           the move.  The logical page specified represents the first logical
  5648.           page in which the move will take place.  If the region length exceeds
  5649.           16K bytes, or if the region is less than 16K bytes but spans logical
  5650.           pages, there must be sufficient logical pages remaining after the
  5651.           first logical page for the entire region to fit.
  5652.  
  5653.           If your application needs to save a region of conventional memory in
  5654.           expanded memory, you can move it without having to perform a save or
  5655.           restore of the current mapping context.
  5656.  
  5657.           The memory manager maintains the context.  A move of up to 1M byte may
  5658.           be performed, although practical lengths are substantially less than
  5659.           this value.
  5660.  
  5661.           If the source and destination handles are identical, the source and
  5662.           destination regions are tested for overlap before the move.  If they
  5663.           overlap, the move direction is chosen so that the destination region
  5664.           receives an intact copy of the source region.  A status will be
  5665.           returned indicating that this overlap has occurred.
  5666.  
  5667.           CALLING PARAMETERS
  5668.  
  5669.           AX = 5700h
  5670.                      Contains the Move Memory Region function.
  5671.  
  5672.           move_source_dest_struct      STRUC
  5673.              region_length             DD  ?
  5674.  
  5675.                                                                        86
  5676.  
  5677.  
  5678.  
  5679.  
  5680.  
  5681.  
  5682.  
  5683.              source_memory_type        DB  ?
  5684.              source_handle             DW  ?
  5685.              source_initial_offset     DW  ?
  5686.              source_initial_seg_page   DW  ?
  5687.              dest_memory_type          DB  ?
  5688.              dest_handle               DW  ?
  5689.              dest_initial_offset       DW  ?
  5690.              dest_initial_seg_page     DW  ?
  5691.           move_source_dest_struct      ENDS
  5692.  
  5693.           DS:SI = pointer to exchange_source_dest structure
  5694.                      Contains a pointer to a data structure which contains the
  5695.                      source and destination information for the exchange.  The
  5696.                      structure members are described here:
  5697.  
  5698.           .region_length
  5699.                      The first member is a double word which specifies the
  5700.                      length of the memory region (in bytes) to be moved.
  5701.  
  5702.           .source_memory_type
  5703.                      The second member is a byte which specifies the type of
  5704.                      memory where the source region resides.  A value of zero
  5705.                      indicates that the source region resides in conventional
  5706.                      memory (excluding the page frame segment).  A value of one
  5707.                      indicates that the source region resides in expanded
  5708.                      memory.
  5709.  
  5710.           .source_handle
  5711.                      If the source region resides in expanded memory, the third
  5712.                      member is a word which specifies the handle number
  5713.                      associated with the source memory region.  If the source
  5714.                      region resides in conventional memory, this variable has no
  5715.                      meaning and should be set to zero for future compatibility.
  5716.  
  5717.           .source_initial_offset
  5718.                      The fourth member is a word which specifies the offset
  5719.                      within the source region from which to begin the move.  If
  5720.                      the source region resides in expanded memory, the
  5721.                      source_initial_offset is relative to the beginning of the
  5722.                      16K logical page.  Because the offset is relative to the
  5723.                      beginning of a 16K expanded memory page, it may only take
  5724.                      on values between 0000h and 3FFFh.
  5725.  
  5726.                      If the source region resides in conventional memory, the
  5727.                      source_initial_offset is a word which specifies the offset,
  5728.                      relative to the beginning of the source segment, from which
  5729.                      to begin the move.  Because the offset is relative to the
  5730.                      beginning of a 64K-byte conventional memory segment, it may
  5731.                      take on values between 0000h and FFFFh.
  5732.  
  5733.           .source_initial_seg_page
  5734.                      The fifth member  is a word which specifies the initial
  5735.                      segment or logical page number within the source region
  5736.                      from which to begin the move.  If the source region resides
  5737.                      in expanded memory, the value specifies the logical page
  5738.                      within the source region from which to begin the move.  If
  5739.                      the source region resides in conventional memory, the
  5740.  
  5741.                                                                        87
  5742.  
  5743.  
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.                      source_initial_seg_page specifies the initial segment
  5750.                      address within conventional memory from which to begin the
  5751.                      move.
  5752.  
  5753.           .dest_memory_type
  5754.                      The sixth member is a byte which specifies the type of
  5755.                      memory where the destination region resides.  A value of
  5756.                      zero indicates conventional memory; a value of one
  5757.                      indicates expanded memory.
  5758.  
  5759.           .dest_handle
  5760.                      If the destination region resides in expanded memory, the
  5761.                      seventh member is a word which specifies the handle number
  5762.                      associated with the destination memory region.  If the
  5763.                      destination region resides in conventional memory, this
  5764.                      variable has no meaning and should be set to zero for
  5765.                      future compatibility.
  5766.  
  5767.           .dest_initial_offset
  5768.                      The eighth member is a word which specifies the offset
  5769.                      within the destination region from which to begin the move.
  5770.  
  5771.                      If the destination region resides in expanded memory, the
  5772.                      dest_initial_offset is relative to the beginning of the
  5773.                      16K-byte logical page.  Because the offset is relative to
  5774.                      the beginning of a 16K-byte expanded memory page, it may
  5775.                      take on values between 0000h and 3FFFh.
  5776.  
  5777.                      If the destination region resides in conventional memory,
  5778.                      the dest_initial_offset is a word which specifies the
  5779.                      offset, relative to the beginning of the destination
  5780.                      segment, to begin the move.  Because the offset is relative
  5781.                      to the beginning of a 64K conventional memory segment, it
  5782.                      may take on values between 0000h and FFFFh.
  5783.  
  5784.           .dest_initial_seg_page
  5785.                      The ninth member is a word which specifies the initial
  5786.                      segment or logical page number within the destination
  5787.                      region from which to begin the move.
  5788.  
  5789.                      If the destination region resides in expanded memory then
  5790.                      the value specifies the logical page within the destination
  5791.                      region from which to begin the exchange.
  5792.  
  5793.                      If the destination region resides in conventional memory,
  5794.                      the dest_initial_seg_page specifies the initial segment
  5795.                      address within conventional memory from which to begin the
  5796.                      move.
  5797.  
  5798.           REGISTERS MODIFIED
  5799.  
  5800.           AX
  5801.  
  5802.           STATUS
  5803.  
  5804.           AH = 0     SUCCESSFUL
  5805.                      The memory regions have been moved.
  5806.  
  5807.                                                                        88
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.           AH = 80h   NON-RECOVERABLE
  5816.                      The manager has detected a malfunction in the memory
  5817.                      manager software.
  5818.  
  5819.           AH = 81h   NON-RECOVERABLE
  5820.                      The manager has detected a malfunction in the expanded
  5821.                      memory hardware.
  5822.  
  5823.           AH = 83h   NON-RECOVERABLE
  5824.                      The manager couldn't find either the source or destination
  5825.                      EMM handles.  The memory manager doesn't have any
  5826.                      information on the handles specified.  The program may have
  5827.                      corrupted its EMM handles.
  5828.  
  5829.           AH = 84h   NON-RECOVERABLE
  5830.                      The function code passed to the manager is not defined.
  5831.  
  5832.           AH = 8Ah   NON-RECOVERABLE
  5833.                      One or more of the logical pages is out of the range of
  5834.                      logical pages allocated to the source/destination handle.
  5835.  
  5836.           AH = 8Fh   NON-RECOVERABLE
  5837.                      The subfunction parameter is invalid.
  5838.  
  5839.           AH = 92h   SUCCESSFUL
  5840.                      The source and destination expanded memory regions have the
  5841.                      same handle and overlap.  This is valid for a move.  The
  5842.                      move has been completed and the destination region has a
  5843.                      full copy of the source region.  However, at least a
  5844.                      portion of the source region has been overwritten by the
  5845.                      move.  Note that the source and destination expanded memory
  5846.                      regions with different handles will never physically
  5847.                      overlap because the different handles specify totally
  5848.                      different regions of expanded memory.
  5849.  
  5850.           AH = 93h   CONDITIONALLY-RECOVERABLE
  5851.                      The length of the source or destination expanded memory
  5852.                      region specified exceeds the length of the expanded memory
  5853.                      region allocated either the source or destination handle.
  5854.                      Insufficient pages are allocated to this handle to move a
  5855.                      region of the size specified.  The program can recover from
  5856.                      this condition by allocating additional pages to the
  5857.                      destination or source handle and attempting to execute the
  5858.                      function again.  However, if the application program
  5859.                      allocated as much expanded memory as it thought it needed,
  5860.                      this may be a program error and is not recoverable.
  5861.  
  5862.           AH = 94h   NON-RECOVERABLE
  5863.                      The conventional memory region and expanded memory region
  5864.                      overlap.  This is invalid, the conventional memory region
  5865.                      cannot overlap the expanded memory region.
  5866.  
  5867.           AH = 95h   NON-RECOVERABLE
  5868.                      The offset within the logical page exceeds the length of
  5869.                      the logical page.  The initial source or destination
  5870.                      offsets within an expanded memory region must be between
  5871.                      0000h and 3FFFh (16383 or (length of a logical page - 1)).
  5872.  
  5873.                                                                        89
  5874.  
  5875.  
  5876.  
  5877.  
  5878.  
  5879.  
  5880.  
  5881.           AH = 96h   NON-RECOVERABLE
  5882.                      Region length exceeds 1M byte.
  5883.  
  5884.           AH = 98h   NON-RECOVERABLE
  5885.                      The memory source and destination types are undefined.
  5886.  
  5887.           AH = A2h   NON-RECOVERABLE
  5888.                      An attempt was made to wrap around the 1M-byte address
  5889.                      space of conventional memory during the move.  The
  5890.                      combination of source/destination starting address and
  5891.                      length of the region to be moved exceeds 1M byte.  No data
  5892.                      was moved.
  5893.  
  5894.           EXAMPLE
  5895.           
  5896.           move_source_dest                   move_source_dest_struct (?)
  5897.           
  5898.           MOV  AX, SEG move_source_dest
  5899.           MOV  DS, AX
  5900.           LEA  SI, move_source_dest          ; DS:SI points to
  5901.                                              ; move_source_dest
  5902.           MOV  AX, 5700h                     ; load function code
  5903.           INT  67h                           ; call the memory manager
  5904.           OR   AH, AH                        ; check EMM status
  5905.           JNZ  emm_err_handler               ; jump to error handler on error
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.  
  5912.  
  5913.  
  5914.  
  5915.  
  5916.  
  5917.  
  5918.  
  5919.  
  5920.  
  5921.  
  5922.  
  5923.  
  5924.  
  5925.  
  5926.  
  5927.  
  5928.  
  5929.  
  5930.  
  5931.  
  5932.  
  5933.  
  5934.  
  5935.  
  5936.  
  5937.  
  5938.  
  5939.                                                                        90
  5940.  
  5941.  
  5942.  
  5943.  
  5944.  
  5945.  
  5946.  
  5947.      FUNCTION 24   MOVE/EXCHANGE MEMORY REGION
  5948.  
  5949.           EXCHANGE MEMORY REGION SUBFUNCTION
  5950.  
  5951.           PURPOSE
  5952.  
  5953.           This subfunction exchanges (using a string move) a region of memory in
  5954.           any of the following memory source/destination combinations.
  5955.  
  5956.           o   conventional memory to conventional memory
  5957.  
  5958.           o   conventional memory to expanded memory
  5959.  
  5960.           o   expanded memory to conventional memory
  5961.  
  5962.           o   expanded memory to expanded memory
  5963.  
  5964.           The term expanded memory region refers only to the area of memory
  5965.           above 640K bytes (9FFFFh).  If a system provides mappable conventional
  5966.           memory, this function treats the mappable conventional memory regions
  5967.           as ordinary conventional memory.  The contents of the source region
  5968.           and the destination region are exchanged.
  5969.  
  5970.           The exchange operation can be performed without having to save and
  5971.           restore the expanded memory mapping context.  The current mapping
  5972.           context is maintained throughout this operation.  The length of the
  5973.           region is limited to the amount of expanded memory allocated to the
  5974.           specified EMM handles.  A length of zero is not an error; however, no
  5975.           exchange will be performed.  A region length which exceeds 16K bytes
  5976.           is not an error.  In this case the function assumes that a group of
  5977.           logical pages is the target for the exchange.  The logical page
  5978.           specified represents the first logical page in which the exchange will
  5979.           take place.  If the region length exceeds 16K bytes, or if the region
  5980.           is less than 16K bytes but spans logical pages, there must be
  5981.           sufficient logical pages remaining after the first logical page for
  5982.           the entire region to fit.
  5983.  
  5984.           If your application needs to exchange a region of conventional memory
  5985.           with expanded memory, you can simply exchange it with the region of
  5986.           interest without having to perform a save or restore of the current
  5987.           mapping context.
  5988.  
  5989.           An exchange of up to 1M byte may be performed, although practical
  5990.           lengths are obviously below that value.  Checking is done before
  5991.           starting the exchange to prevent the possibility of overlap during the
  5992.           exchange operation.  Overlapping source and destination regions for a
  5993.           exchange are invalid, and the exchange will not take place.
  5994.  
  5995.           CALLING PARAMETERS
  5996.  
  5997.           AX = 5701h
  5998.                      Contains the Exchange Memory Region function.
  5999.  
  6000.           xchg_source_dest_struct      STRUC
  6001.              region_length             DD ?
  6002.              source_memory_type        DB ?
  6003.              source_handle             DW ?
  6004.  
  6005.                                                                        91
  6006.  
  6007.  
  6008.  
  6009.  
  6010.  
  6011.  
  6012.  
  6013.              source_initial_offset     DW ?
  6014.              source_initial_seg_page   DW ?
  6015.              dest_memory_type          DB ?
  6016.              dest_handle               DW ?
  6017.              dest_initial_offset       DW ?
  6018.              dest_initial_seg_page     DW ?
  6019.           xchg_source_dest_struct      ENDS
  6020.  
  6021.           DS:SI = pointer to move_source_dest structure
  6022.                      Contains a pointer to the data structure which contains the
  6023.                      source & destination information for the exchange.  The
  6024.                      structure members are described here:
  6025.  
  6026.           .region_length
  6027.                      The first member is a double word which specifies the
  6028.                      length of the memory region to be exchanged.
  6029.  
  6030.           .source_memory_type
  6031.                      The second member is a byte which specifies the type of
  6032.                      memory where the source region resides.  A value of zero
  6033.                      indicates that the source region resides in conventional
  6034.                      memory.  A value of one indicates that the source region
  6035.                      resides in expanded memory.
  6036.  
  6037.           .source_handle
  6038.                      If the source region resides in expanded memory, the third
  6039.                      member is a word which specifies the handle number
  6040.                      associated with the source memory region.  If the source
  6041.                      region resides in conventional memory, this variable has no
  6042.                      meaning and should be set to zero for future compatibility.
  6043.  
  6044.           .source_initial_offset
  6045.                      The fourth member is a word which specifies the offset
  6046.                      within the source region from which to begin the exchange.
  6047.  
  6048.                      If the source region resides in expanded memory, the
  6049.                      source_initial_offset is relative to the beginning of the
  6050.                      16K-byte logical page.  Because the offset is relative to
  6051.                      the beginning of a 16K-byte expanded memory page, it may
  6052.                      only take on values between 0000h and 3FFFh.
  6053.  
  6054.                      If the source region resides in conventional memory, the
  6055.                      source_initial_offset is a word which specifies the offset,
  6056.                      relative to the beginning of the source segment, to begin
  6057.                      the exchange at.  Because the offset is relative to the
  6058.                      beginning of a 64K-byte conventional memory segment, it may
  6059.                      only take on values between 0000h and FFFFh.
  6060.  
  6061.           .source_initial_seg_page
  6062.                      The fifth member is a word which specifies the initial
  6063.                      segment or logical page number within the source region
  6064.                      from which to begin the exchange.
  6065.  
  6066.                      If the source region resides in expanded memory then the
  6067.                      value specifies the logical page within the source region
  6068.                      from which to begin the exchange.
  6069.  
  6070.  
  6071.                                                                        92
  6072.  
  6073.  
  6074.  
  6075.  
  6076.  
  6077.  
  6078.  
  6079.                      If the source region resides in conventional memory, the
  6080.                      source_initial_seg_page specifies the initial segment
  6081.                      address within conventional memory from which to begin the
  6082.                      exchange.
  6083.  
  6084.           .dest_memory_type
  6085.                      The sixth member is a byte which specifies the type of
  6086.                      memory where the destination region resides.  A value of
  6087.                      zero indicates that the destination region resides in
  6088.                      conventional memory (excluding the page frame segment).  A
  6089.                      value of one indicates that the destination region resides
  6090.                      in expanded memory.
  6091.  
  6092.           .dest_handle
  6093.                      If the destination region resides in expanded memory, the
  6094.                      seventh member is a word which specifies the handle number
  6095.                      associated with the destination memory region.  If the
  6096.                      destination region resides in conventional memory , then
  6097.                      this variable has no meaning and should be set to zero for
  6098.                      future compatibility.
  6099.  
  6100.           .dest_initial_offset
  6101.                      The eighth member is a word which specifies the offset
  6102.                      within the destination region from which to begin the
  6103.                      exchange.
  6104.  
  6105.                      If the destination region resides in expanded memory, the
  6106.                      dest_initial_offset is relative to the beginning of the
  6107.                      16K-byte logical page.  Because the offset is relative to
  6108.                      the beginning of a 16K-byte expanded memory page, it may
  6109.                      only take on values between 0000h and 3FFFh.
  6110.  
  6111.                      If the destination region resides in conventional memory,
  6112.                      the dest_initial_offset is a word which specifies the
  6113.                      offset, relative to the beginning of the destination
  6114.                      segment, to begin the exchange at.  Because the offset is
  6115.                      relative to the beginning of a 64K-byte conventional memory
  6116.                      segment, it may only take on values between 0000h and
  6117.                      FFFFh.
  6118.  
  6119.           .dest_initial_seg_page
  6120.                      The ninth member is a word which specifies the initial
  6121.                      segment or logical page number within the destination
  6122.                      region from which to begin the exchange.
  6123.  
  6124.                      If the destination region resides in expanded memory, the
  6125.                      value specifies the logical page within the destination
  6126.                      region from which to begin the exchange.
  6127.  
  6128.                      If the destination region resides in conventional memory,
  6129.                      the dest_initial_seg_page specifies the initial segment
  6130.                      address within conventional memory from which to begin the
  6131.                      exchange.
  6132.  
  6133.           REGISTERS MODIFIED
  6134.  
  6135.           AX
  6136.  
  6137.                                                                        93
  6138.  
  6139.  
  6140.  
  6141.  
  6142.  
  6143.  
  6144.  
  6145.           STATUS
  6146.  
  6147.           AH = 0     SUCCESSFUL
  6148.                      The memory regions have been exchanged.
  6149.  
  6150.           AH = 80h   NON-RECOVERABLE
  6151.                      The manager has detected a malfunction in the memory
  6152.                      manager software.
  6153.  
  6154.           AH = 81h   NON-RECOVERABLE
  6155.                      The manager has detected a malfunction in the expanded
  6156.                      memory hardware.
  6157.  
  6158.           AH = 83h   NON-RECOVERABLE
  6159.                      The manager could not find either the source or destination
  6160.                      EMM handles.  The memory manager does not currently have
  6161.                      any information pertaining to the handles specified.  The
  6162.                      program may have corrupted its EMM handles.
  6163.  
  6164.           AH = 84h   NON-RECOVERABLE
  6165.                      The function code passed to the manager is not defined.
  6166.  
  6167.           AH = 8Ah   NON-RECOVERABLE
  6168.                      One or more of the logical pages is out of the range of
  6169.                      logical pages allocated to the source/destination handle.
  6170.  
  6171.           AH = 8Fh   NON-RECOVERABLE
  6172.                      The subfunction parameter is invalid.
  6173.  
  6174.           AH = 93h   CONDITIONALLY RECOVERABLE
  6175.                      The length of the source or destination expanded memory
  6176.                      region specified, exceeds the length of the expanded memory
  6177.                      region allocated to the source or destination specified EMM
  6178.                      handle.  There are insufficient pages allocated to this
  6179.                      handle to exchange a region of the size specified.  The
  6180.                      program can recover from this condition by attempting to
  6181.                      allocate additional pages to the destination or source
  6182.                      handle and attempting to execute the function again.
  6183.                      However, if the application program was allocated as much
  6184.                      expanded memory as it thought it needed, this may be a
  6185.                      program error and is therefore not recoverable.
  6186.  
  6187.           AH = 94h   NON-RECOVERABLE
  6188.                      The conventional memory region and expanded memory region
  6189.                      overlap.  This is invalid, the conventional memory region
  6190.                      cannot overlap the expanded memory region.
  6191.  
  6192.           AH = 95h   NON-RECOVERABLE
  6193.                      The offset within the logical page exceeds the length of
  6194.                      the logical page.  The initial source or destination
  6195.                      offsets within an expanded memory region must be between
  6196.                      0000h and 3FFFh (16383 or (length of a logical page - 1)).
  6197.  
  6198.           AH = 96h   NON-RECOVERABLE
  6199.                      Region length exceeds 1M Byte limit.
  6200.  
  6201.  
  6202.  
  6203.                                                                        94
  6204.  
  6205.  
  6206.  
  6207.  
  6208.  
  6209.  
  6210.  
  6211.           AH = 97h   NON-RECOVERABLE
  6212.                      The source and destination expanded memory regions have the
  6213.                      same handle and overlap.  This is invalid, the source and
  6214.                      destination expanded memory regions cannot have the same
  6215.                      handle and overlap when they are being exchanged. Note that
  6216.                      the source and destination expanded memory regions which
  6217.                      have different handles will never physically overlap
  6218.                      because the different handles specify totally different
  6219.                      regions of expanded memory.
  6220.  
  6221.           AH = 98h   NON-RECOVERABLE
  6222.                      The memory source and destination types are undefined.
  6223.  
  6224.           AH = A2h   NON-RECOVERABLE
  6225.                      An attempt was made to wrap around the 1M-byte address
  6226.                      space of conventional memory during the exchange.  The
  6227.                      source starting address together with the length of the
  6228.                      region to be exchanged exceeds 1M byte.  No data was
  6229.                      exchanged.
  6230.  
  6231.           EXAMPLE
  6232.           
  6233.           xchg_source_dest                   xchg_source_dest_struct (?)
  6234.           
  6235.           MOV  AX, SEG xchg_source_dest
  6236.           MOV  DS, AX
  6237.           LEA  SI, xchg_source_dest          ; DS:SI points to
  6238.                                              ; xchg_source_dest
  6239.           MOV  AX, 5701h                     ; load function code
  6240.           INT  67h                           ; call the memory manager
  6241.           OR   AH, AH                        ; check EMM status
  6242.           JNZ  emm_err_handler               ; jump to error handler on error
  6243.  
  6244.  
  6245.  
  6246.  
  6247.  
  6248.  
  6249.  
  6250.  
  6251.  
  6252.  
  6253.  
  6254.  
  6255.  
  6256.  
  6257.  
  6258.  
  6259.  
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.  
  6266.  
  6267.  
  6268.  
  6269.                                                                        95
  6270.  
  6271.  
  6272.  
  6273.  
  6274.  
  6275.  
  6276.  
  6277.      FUNCTION 25   GET MAPPABLE PHYSICAL ADDRESS ARRAY
  6278.  
  6279.           GET MAPPABLE PHYSICAL ADDRESS ARRAY SUBFUNCTION
  6280.  
  6281.           PURPOSE
  6282.  
  6283.           This subfunction returns an array containing the segment address and
  6284.           physical page number for each mappable physical page in a system.  The
  6285.           contents of this array provide a cross reference between physical page
  6286.           numbers and the actual segment addresses for each mappable page in the
  6287.           system.  The array is sorted in ascending segment order.  This does
  6288.           not mean that the physical page numbers associated with the segment
  6289.           addresses are also in ascending order.
  6290.  
  6291.           CALLING PARAMETERS
  6292.  
  6293.           AX = 5800h
  6294.                      Contains the Get Mappable Physical Address Array
  6295.                      subfunction.
  6296.  
  6297.           mappable_phys_page_struct   STRUC
  6298.              phys_page_segment        DW ?
  6299.              phys_page_number         DW ?
  6300.           mappable_phys_page_struct   ENDS
  6301.  
  6302.           ES:DI = mappable_phys_page
  6303.                      Contains a pointer to an application-supplied memory area
  6304.                      where the memory manager will copy the physical address
  6305.                      array.  Each entry in the array is a structure containing
  6306.                      two members:
  6307.  
  6308.           .phys_page_segment
  6309.                      The first member is a word which contains the segment
  6310.                      address of the mappable physical page associated with the
  6311.                      physical page number following it.  The array entries are
  6312.                      sorted in ascending segment address order.
  6313.  
  6314.           .phys_page_number
  6315.                      The second member is a word which contains the physical
  6316.                      page number which corresponds to the previous segment
  6317.                      address.  The physical page numbers are not necessarily in
  6318.                      ascending order.
  6319.  
  6320.           EXAMPLE 1
  6321.  
  6322.           An expanded memory board has its page frame starting at address C0000h
  6323.           and has no mappable conventional memory.  For this configuration,
  6324.           physical page 0 corresponds to segment address C000h, physical page 1
  6325.           corresponds to segment address C400h, etc.  The array would contain
  6326.           the following data (in this order):
  6327.  
  6328.           C000h, 00h
  6329.           C400h, 01h
  6330.           C800h, 02h
  6331.           CC00h, 03h
  6332.  
  6333.           EXAMPLE 2
  6334.  
  6335.                                                                        96
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.           An expanded memory board has a large page frame starting at address
  6344.           C0000h and has mappable conventional memory from 90000h through
  6345.           9FFFFh.  For this configuration, physical page 0 corresponds to
  6346.           segment address C000h, physical page 1 corresponds to segment address
  6347.           C400h, etc.  The array would contain the following data in the order
  6348.           specified.  Note that the expanded memory region always has the lowest
  6349.           numerically valued physical page numbers.
  6350.  
  6351.           9000h, 0Ch
  6352.           9400h, 0Dh
  6353.           9800h, 0Eh
  6354.           9C00h, 0Fh
  6355.           C000h, 00h
  6356.           C400h, 01h
  6357.           C800h, 02h
  6358.           CC00h, 03h
  6359.           D000h, 04h
  6360.           D400h, 05h
  6361.           D800h, 06h
  6362.           DC00h, 07h
  6363.           E000h, 08h
  6364.           E400h, 09h
  6365.           E800h, 0Ah
  6366.           EC00h, 0Bh
  6367.  
  6368.           RESULTS
  6369.  
  6370.           These results are valid only if the status returned is zero.
  6371.  
  6372.           CX = number of entries in the mappable_phys_page
  6373.                      Multiply this number by (SIZE mappable_phys_page_struct) to
  6374.                      determine the number of bytes the physical page address
  6375.                      array requires.
  6376.  
  6377.           REGISTERS MODIFIED
  6378.  
  6379.           AX, CX
  6380.  
  6381.           STATUS
  6382.  
  6383.           AH = 0     SUCCESSFUL
  6384.                      The hardware configuration array has been returned.
  6385.  
  6386.           AH = 80h   NON-RECOVERABLE
  6387.                      The manager has detected a malfunction in the memory
  6388.                      manager software.
  6389.  
  6390.           AH = 81h   NON-RECOVERABLE
  6391.                      The manager has detected a malfunction in the expanded
  6392.                      memory hardware.
  6393.  
  6394.           AH = 84h   NON-RECOVERABLE
  6395.                      The function code passed to the manager is not defined.
  6396.  
  6397.           AH = 8Fh   NON-RECOVERABLE
  6398.                      The subfunction parameter is invalid.
  6399.  
  6400.  
  6401.                                                                        97
  6402.  
  6403.  
  6404.  
  6405.  
  6406.  
  6407.  
  6408.  
  6409.           EXAMPLE
  6410.           
  6411.           mappable_phys_page                 mappable_phys_page_struct (?)
  6412.           
  6413.           MOV  AX, SEG mappable_phys_page
  6414.           MOV  ES, AX
  6415.           LEA  DI, mappable_phys_page        ; ES:DI points to
  6416.                                              ; mappable_phys_page
  6417.           MOV  AX, 5800h                     ; load function code
  6418.           INT  67h                           ; call the memory manager
  6419.           OR   AH, AH                        ; check EMM status
  6420.           JNZ  emm_err_handler               ; jump to error handler on error
  6421.           MOV  mappable_page_entry_count, CX ; save mappable page entry count
  6422.  
  6423.  
  6424.  
  6425.  
  6426.  
  6427.  
  6428.  
  6429.  
  6430.  
  6431.  
  6432.  
  6433.  
  6434.  
  6435.  
  6436.  
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.  
  6443.  
  6444.  
  6445.  
  6446.  
  6447.  
  6448.  
  6449.  
  6450.  
  6451.  
  6452.  
  6453.  
  6454.  
  6455.  
  6456.  
  6457.  
  6458.  
  6459.  
  6460.  
  6461.  
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.                                                                        98
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.      FUNCTION 25   GET MAPPABLE PHYSICAL ADDRESS ARRAY
  6476.  
  6477.           GET MAPPABLE PHYSICAL ADDRESS ARRAY ENTRIES SUBFUNCTION
  6478.  
  6479.           PURPOSE
  6480.  
  6481.           This subfunction gets the number of entries which will be required for
  6482.           the array the first subfunction returns.
  6483.  
  6484.           CALLING PARAMETERS
  6485.  
  6486.           AX = 5801h
  6487.                      Contains the Get Physical Page Address Array Entry Count
  6488.                      subfunction.  This subfunction returns a word which
  6489.                      represents the number of entries in the array returned by
  6490.                      the previous subfunction.  This number also represents the
  6491.                      number of mappable physical pages in a system.
  6492.  
  6493.           RESULTS
  6494.  
  6495.           These results are valid only if the status returned is zero.
  6496.  
  6497.           CX = number of entries in the mappable_phys_page
  6498.                      Multiply this number by (SIZE mappable_phys_page_struct) to
  6499.                      determine the number of bytes the physical page address
  6500.                      array will require.
  6501.  
  6502.           REGISTERS MODIFIED
  6503.  
  6504.           AX, CX
  6505.  
  6506.           STATUS
  6507.  
  6508.           AH = 0     SUCCESSFUL
  6509.                      The physical page address array has been returned.
  6510.  
  6511.           AH = 80h   NON-RECOVERABLE
  6512.                      The manager has detected a malfunction in the memory
  6513.                      manager software.
  6514.  
  6515.           AH = 81h   NON-RECOVERABLE
  6516.                      The manager has detected a malfunction in the expanded
  6517.                      memory hardware.
  6518.  
  6519.           AH = 84h   NON-RECOVERABLE
  6520.                      The function code passed to the manager is not defined.
  6521.  
  6522.           AH = 8Fh   NON-RECOVERABLE
  6523.                      The subfunction parameter is invalid.
  6524.  
  6525.           EXAMPLE
  6526.           
  6527.           mappable_page_entry_count          DW ?
  6528.           
  6529.           MOV  AX, 5801h                     ; load function code
  6530.           INT  67h                           ; call memory manager
  6531.           OR   AH, AH                        ; check EMM status
  6532.  
  6533.                                                                        99
  6534.  
  6535.  
  6536.  
  6537.  
  6538.  
  6539.  
  6540.  
  6541.           JNZ  emm_err_handler               ; jump to error handler on error
  6542.           MOV  mappable_page_entry_count, CX ; save mappable page entry count
  6543.  
  6544.  
  6545.  
  6546.  
  6547.  
  6548.  
  6549.  
  6550.  
  6551.  
  6552.  
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.  
  6576.  
  6577.  
  6578.  
  6579.  
  6580.  
  6581.  
  6582.  
  6583.  
  6584.  
  6585.  
  6586.  
  6587.  
  6588.  
  6589.  
  6590.  
  6591.  
  6592.  
  6593.  
  6594.  
  6595.  
  6596.  
  6597.  
  6598.  
  6599.                                                                       100
  6600.  
  6601.  
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.      FUNCTION 26   GET EXPANDED MEMORY HARDWARE INFORMATION
  6608.  
  6609.           GET HARDWARE CONFIGURATION ARRAY SUBFUNCTION
  6610.  
  6611.           Note..............................................................
  6612.  
  6613.           This function is for use by operating systems only.  This function can
  6614.           be disabled at any time by the operating system.  Refer to Function 30
  6615.           for a description of how an operating system does this.
  6616.  
  6617.           PURPOSE
  6618.  
  6619.           This subfunction returns an array containing expanded memory hardware
  6620.           configuration information for use by an operating system/environment.
  6621.  
  6622.           CALLING PARAMETERS
  6623.  
  6624.           AX = 5900h
  6625.                      Contains the Get Hardware Configuration Array subfunction.
  6626.  
  6627.           hardware_info_struct         STRUC
  6628.              raw_page_size             DW ?
  6629.              alternate_register_sets   DW ?
  6630.              context_save_area_size    DW ?
  6631.              DMA_register_sets         DW ?
  6632.              DMA_channel_operation     DW ?
  6633.           hardware_info_struct         ENDS
  6634.  
  6635.           ES:DI = hardware_info
  6636.                      Contains a pointer to a memory area that the operating
  6637.                      system supplies where the memory manager will copy expanded
  6638.                      memory hardware information.  The structure contains these
  6639.                      five members:
  6640.  
  6641.           .raw_page_size
  6642.                      The first member is a word which contains the size of a raw
  6643.                      mappable physical page in paragraphs (16 bytes).  LIM
  6644.                      standard pages are always 16K bytes.  However, other
  6645.                      implementations of expanded memory boards do not
  6646.                      necessarily comply with this standard and can emulate a
  6647.                      16K-byte page by mapping in multiple smaller pages.  This
  6648.                      member specifies the size of a mappable physical page
  6649.                      viewed from the hardware implementation level.
  6650.  
  6651.           .alternate_register_sets
  6652.                      The second member is a word which specifies the number of
  6653.                      alternate mapping register sets.  The additional mapping
  6654.                      register sets are termed alternate mapping register sets in
  6655.                      this document.
  6656.  
  6657.                      All expanded memory boards have at least one set of
  6658.                      hardware registers to perform the logical to physical page
  6659.                      mapping.  Some expanded memory boards have more than one
  6660.                      set of these mapping registers.  This member specifies how
  6661.                      many of these alternate mapping register sets exist (beyond
  6662.                      the one set that all expanded memory boards have) on the
  6663.                      expanded memory boards in the system.  If an expanded
  6664.  
  6665.                                                                       101
  6666.  
  6667.  
  6668.  
  6669.  
  6670.  
  6671.  
  6672.  
  6673.                      memory card has only one set of mapping registers (that is,
  6674.                      no alternate mapping register sets) this member has a value
  6675.                      of zero.
  6676.  
  6677.           .context_save_area_size
  6678.                      The third member is a word which contains the storage
  6679.                      requirements for the array required to save a mapping
  6680.                      context.  The value returned in this member is exactly the
  6681.                      same as that returned by Function 15 (Get Size of Page Map
  6682.                      Save Array subfunction).
  6683.  
  6684.           .DMA_channels
  6685.                      The fourth member is a word which contains the number of
  6686.                      register sets that can be assigned to DMA channels.  These
  6687.                      DMA register sets, although similar in use to alternate
  6688.                      register sets, are for DMA mapping and not task mapping.
  6689.  
  6690.                      If the expanded memory hardware does not support DMA
  6691.                      register sets, care must be taken when DMA is taking place.
  6692.  
  6693.                      In a multitasking operating system, when one task is
  6694.                      waiting for DMA to complete, it is useful to be able to
  6695.                      switch to another task.  However, if the DMA is taking
  6696.                      place in memory that the second task will need to remap,
  6697.                      remapping would be disastrous.
  6698.  
  6699.                      If the expanded memory hardware can detect when DMA is
  6700.                      occurring, the OS/E should allow task switches and
  6701.                      remapping during DMA.  If no special support for DMA is
  6702.                      available, no remapping should be done when DMA is in
  6703.                      progress.
  6704.  
  6705.           .DMA_channel_operation
  6706.                      The fifth member is a word which specifies a special case
  6707.                      for the DMA register sets.  A value of zero specifies that
  6708.                      the DMA register sets behave as described in Function 28.
  6709.                      A value of one specifies that the expanded memory hardware
  6710.                      has only one DMA register set.  In addition, if any channel
  6711.                      is mapped through this register set, then all channels are
  6712.                      mapped through it.  For LIM standard boards, this value is
  6713.                      zero.
  6714.  
  6715.           RESULTS
  6716.  
  6717.           These results are valid only if the status returned is zero.
  6718.  
  6719.           hardware_info
  6720.                      Contains the expanded memory hardware specific information
  6721.                      described above.
  6722.  
  6723.           REGISTERS MODIFIED
  6724.  
  6725.           AX
  6726.  
  6727.           STATUS
  6728.  
  6729.  
  6730.  
  6731.                                                                       102
  6732.  
  6733.  
  6734.  
  6735.  
  6736.  
  6737.  
  6738.  
  6739.           AH = 0     SUCCESSFUL
  6740.                      The hardware configuration array has been returned.
  6741.  
  6742.           AH = 80h   NON-RECOVERABLE
  6743.                      The manager has detected a malfunction in the memory
  6744.                      manager software.
  6745.  
  6746.           AH = 81h   NON-RECOVERABLE
  6747.                      The manager has detected a malfunction in the expanded
  6748.                      memory hardware.
  6749.  
  6750.           AH = 84h   NON-RECOVERABLE
  6751.                      The function code passed to the manager is not defined.
  6752.  
  6753.           AH = 8Fh   NON-RECOVERABLE
  6754.                      The subfunction parameter is invalid.
  6755.  
  6756.           AH = A4h   NON-RECOVERABLE
  6757.                      Access to this function has been denied by the operating
  6758.                      system.  The function cannot be used at this time.
  6759.  
  6760.           EXAMPLE
  6761.           
  6762.           hardware_info                      hardware_info_struct (?)
  6763.           
  6764.           MOV  AX, SEG hardware_info
  6765.           MOV  ES, AX
  6766.           LEA  DI, hardware_info             ; ES:DI points to hardware_info
  6767.           MOV  AX, 5900h                     ; load function code
  6768.           INT  67h                           ; call the memory manager
  6769.           OR   AH, AH                        ; check EMM status
  6770.           JNZ  emm_err_handler               ; jump to error handler on error
  6771.  
  6772.  
  6773.  
  6774.  
  6775.  
  6776.  
  6777.  
  6778.  
  6779.  
  6780.  
  6781.  
  6782.  
  6783.  
  6784.  
  6785.  
  6786.  
  6787.  
  6788.  
  6789.  
  6790.  
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.  
  6797.                                                                       103
  6798.  
  6799.  
  6800.  
  6801.  
  6802.  
  6803.  
  6804.  
  6805.      FUNCTION 26   GET EXPANDED MEMORY HARDWARE INFORMATION
  6806.  
  6807.           GET UNALLOCATED RAW PAGE COUNT SUBFUNCTION
  6808.  
  6809.           PURPOSE
  6810.  
  6811.           The Get Unallocated Raw Page Count subfunction returns the number of
  6812.           unallocated non-standard length mappable pages as well as the total
  6813.           number of non-standard length mappable pages in expanded memory to the
  6814.           operating system.
  6815.  
  6816.           One variety of expanded memory board has a page size which is a sub-
  6817.           multiple of 16K bytes.  An expanded memory page which is a sub-
  6818.           multiple of 16K is termed a raw page.  An operating system may deal
  6819.           with mappable physical page sizes which are sub-multiples of 16K
  6820.           bytes.
  6821.  
  6822.           If the expanded memory board supplies pages in exact multiples of 16K
  6823.           bytes, the number of pages this function returns is identical to the
  6824.           number Function 3 (Get Unallocated Page Count) returns.  In this case,
  6825.           there is no difference between a page and a raw page.
  6826.  
  6827.           CALLING PARAMETERS
  6828.  
  6829.           AX = 5901h
  6830.                      Contains the Get Unallocated Raw Page Count subfunction.
  6831.  
  6832.           RESULTS
  6833.  
  6834.           These results are valid only if the status returned is zero.
  6835.  
  6836.           BX = unallocated raw pages
  6837.                      The number of raw pages that are currently available for
  6838.                      use.
  6839.  
  6840.           DX = total raw pages
  6841.                      The total number of raw pages in expanded memory.
  6842.  
  6843.           REGISTERS MODIFIED
  6844.  
  6845.           AX, BX, DX
  6846.  
  6847.           STATUS
  6848.  
  6849.           AH = 0     SUCCESSFUL
  6850.                      The manager has returned the number unallocated raw pages
  6851.                      and the number of total raw pages in expanded memory.
  6852.  
  6853.           AH = 80h   NON-RECOVERABLE
  6854.                      The manager detected a malfunction in the memory manager
  6855.                      software.
  6856.  
  6857.           AH = 81h   NON-RECOVERABLE
  6858.                      The manager detected a malfunction in the expanded memory
  6859.                      hardware.
  6860.  
  6861.  
  6862.  
  6863.                                                                       104
  6864.  
  6865.  
  6866.  
  6867.  
  6868.  
  6869.  
  6870.  
  6871.           AH = 84h   NON-RECOVERABLE
  6872.                      The function code passed to the memory manager is not
  6873.                      defined.
  6874.  
  6875.           AH = 8Fh   NON-RECOVERABLE
  6876.                      The subfunction parameter is invalid.
  6877.  
  6878.           EXAMPLE
  6879.           
  6880.           unalloc_raw_pages                  DW ?
  6881.           total_raw_pages                    DW ?
  6882.           
  6883.           MOV  AX, 5901h                     ; load function code
  6884.           INT  67h                           ; call the memory manager
  6885.           OR   AH, AH                        ; check EMM status
  6886.           JNZ  emm_err_handler               ; jump to error handler on error
  6887.           MOV  unalloc_raw_pages, BX         ; save unallocated raw page
  6888.                                              ; count
  6889.           MOV  total_raw_pages, DX           ; save total raw page count
  6890.  
  6891.  
  6892.  
  6893.  
  6894.  
  6895.  
  6896.  
  6897.  
  6898.  
  6899.  
  6900.  
  6901.  
  6902.  
  6903.  
  6904.  
  6905.  
  6906.  
  6907.  
  6908.  
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.  
  6923.  
  6924.  
  6925.  
  6926.  
  6927.  
  6928.  
  6929.                                                                       105
  6930.  
  6931.  
  6932.  
  6933.  
  6934.  
  6935.  
  6936.  
  6937.      FUNCTION 27   ALLOCATE STANDARD/RAW PAGES
  6938.  
  6939.           ALLOCATE STANDARD PAGES SUBFUNCTION
  6940.  
  6941.           PURPOSE
  6942.  
  6943.           The Allocate Standard Pages subfunction allocates the number of
  6944.           standard size (16K bytes) pages that the operating system requests and
  6945.           assigns a unique EMM handle to these pages.  The EMM handle owns these
  6946.           pages until the operating system deallocates them.  This subfunction
  6947.           allows you to allocate zero pages to a handle, unlike Function 4
  6948.           (Allocate Pages).
  6949.  
  6950.           Note..............................................................
  6951.  
  6952.           This note affects expanded memory manager implementers and operating
  6953.           system developers only.  Applications should not use the following
  6954.           characteristic of the memory manager.  An application violating this
  6955.           rule will be incompatible with future versions of Microsoft's
  6956.           operating systems and environments.
  6957.  
  6958.           To be compatible with this specification, an expanded memory manager
  6959.           will provide a special handle which is available to the operating
  6960.           system only.  This handle will have a value of 0000h and will have a
  6961.           set of pages allocated to it when the expanded memory manager driver
  6962.           installs.  The pages that the memory manager will automatically
  6963.           allocate to handle 0000h are those that backfill conventional memory.
  6964.           Typically, this backfill occurs between addresses 40000h (256K) and
  6965.           9FFFFh (640K).  However, the range can extend below and above this
  6966.           limit if the hardware and memory manager have the capability.
  6967.  
  6968.           An operating system won't have to invoke Function 27 to obtain this
  6969.           handle because it can assume the handle already exists and is
  6970.           available for use immediately after the expanded memory device driver
  6971.           installs.  When an operating system wants to use this handle, it uses
  6972.           the special handle value of 0000h. The operating system will be able
  6973.           to invoke any EMM function using this special handle value.  To
  6974.           allocate pages to this handle, the operating system need only invoke
  6975.           Function 18 (Reallocate pages).
  6976.  
  6977.           There are two special cases for this handle:
  6978.  
  6979.           1.  Function 27 (Allocate Standard Pages).  This function must never
  6980.               return zero as a handle value.  Applications must always invoke
  6981.               Function 27 to allocate pages and obtain a handle which identifies
  6982.               the pages which belong to it.  Since Function 27 never returns a
  6983.               handle value of zero, an application will never gain access to
  6984.               this special handle.
  6985.  
  6986.           2.  Function 6 (Deallocate Pages). If the operating system uses it to
  6987.               deallocate the pages which are allocated to this handle, the pages
  6988.               the handle owns will be returned to the manager for use.  But the
  6989.               handle will not be available for reassignment.  The manager should
  6990.               treat a deallocate pages function request for this handle the same
  6991.               as a reallocate pages function request, where the number of pages
  6992.               to reallocate to this handle is zero.
  6993.  
  6994.  
  6995.                                                                       106
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.           CALLING PARAMETERS
  7004.  
  7005.           AX = 5A00h
  7006.                      Contains the Allocate Standard Pages subfunction.
  7007.  
  7008.           BX = num_of_standard_pages_to_alloc
  7009.                      Contains the number of standard pages the operating system
  7010.                      wants to allocate.
  7011.  
  7012.           RESULTS
  7013.  
  7014.           These results are valid only if the status returned is zero.
  7015.  
  7016.           DX = handle
  7017.                      Contains a unique EMM handle.  The operating system must
  7018.                      use this EMM handle as a parameter in any function that
  7019.                      requires it.  Up to 255 handles may be obtained.  (Both
  7020.                      Function 27 and Function 4 must share the same 255
  7021.                      handles).
  7022.  
  7023.                      For all functions using this handle, the length of the
  7024.                      physical and logical pages allocated to it are standard
  7025.                      length (that is, 16K bytes).
  7026.  
  7027.           REGISTERS MODIFIED
  7028.  
  7029.           AX, DX
  7030.  
  7031.           STATUS
  7032.  
  7033.           AH = 0     SUCCESSFUL
  7034.                      The manager has allocated the pages to an assigned EMM raw
  7035.                      handle.
  7036.  
  7037.           AH = 80h   NON-RECOVERABLE
  7038.                      The manager detected a malfunction in the memory manager
  7039.                      software.
  7040.  
  7041.           AH = 81h   NON-RECOVERABLE
  7042.                      The manager detected a malfunction in the expanded memory
  7043.                      hardware.
  7044.  
  7045.           AH = 84h   NON-RECOVERABLE
  7046.                      The function code passed to the memory manager is not
  7047.                      defined.
  7048.  
  7049.           AH = 85h   RECOVERABLE
  7050.                      All EMM handles are being used.
  7051.  
  7052.           AH = 87h   RECOVERABLE
  7053.                      There aren't enough expanded memory pages present in the
  7054.                      system to satisfy the operating system's request.
  7055.  
  7056.           AH = 88h   RECOVERABLE
  7057.                      There aren't enough unallocated pages to satisfy the
  7058.                      operating system's request.
  7059.  
  7060.  
  7061.                                                                       107
  7062.  
  7063.  
  7064.  
  7065.  
  7066.  
  7067.  
  7068.  
  7069.           AH = 8Fh   NON-RECOVERABLE
  7070.                      The subfunction parameter is invalid.
  7071.  
  7072.           EXAMPLE
  7073.           
  7074.           num_of_standard_pages_to_alloc     DW ?
  7075.           emm_handle                         DW ?
  7076.           
  7077.           MOV  BX, num_of_standard_pages_to_alloc
  7078.           MOV  AX, 5A00h                     ; load function code
  7079.           INT  67h                           ; call the memory manager
  7080.           OR   AH, AH                        ; check EMM status
  7081.           JNZ  emm_err_handler               ; jump to error handler on error
  7082.           MOV  emm_handle, DX                ; save handle
  7083.  
  7084.  
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.  
  7092.  
  7093.  
  7094.  
  7095.  
  7096.  
  7097.  
  7098.  
  7099.  
  7100.  
  7101.  
  7102.  
  7103.  
  7104.  
  7105.  
  7106.  
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113.  
  7114.  
  7115.  
  7116.  
  7117.  
  7118.  
  7119.  
  7120.  
  7121.  
  7122.  
  7123.  
  7124.  
  7125.  
  7126.  
  7127.                                                                       108
  7128.  
  7129.  
  7130.  
  7131.  
  7132.  
  7133.  
  7134.  
  7135.      FUNCTION 27   ALLOCATE STANDARD/RAW PAGES
  7136.  
  7137.           ALLOCATE RAW PAGES SUBFUNCTION
  7138.  
  7139.           PURPOSE
  7140.  
  7141.           The Allocate Raw Pages subfunction allocates the number of non-
  7142.           standard size pages that the operating system requests and assigns a
  7143.           unique EMM handle to these pages.  The EMM handle owns these pages
  7144.           until the operating system deallocates them.  This function allows you
  7145.           to allocate zero pages to a handle, unlike Function 4 (Allocate
  7146.           Pages).
  7147.  
  7148.           A hardware vendor may design an expanded memory board that has a page
  7149.           size which is a sub-multiple of 16K bytes.  A physical page which is a
  7150.           sub-multiple of 16K is termed a raw page.  The operating system may
  7151.           deal with page sizes which are sub-multiples of 16K bytes.  The memory
  7152.           manager must treat any function using a handle with raw pages
  7153.           allocated to it by Allocate Raw Pages differently than it does a
  7154.           handle that has normal 16K-byte pages allocated to it.
  7155.  
  7156.           Handles which are assigned using Function 4 (Allocate pages) or
  7157.           Function 27 (Allocate Standard Pages subfunction) must have pages
  7158.           which are 16K bytes -- this is the length of a standard expanded
  7159.           memory page.  If the expanded memory board hardware is not able to
  7160.           supply 16K-byte pages, the memory manager must emulate pages which are
  7161.           16K bytes combining multiple non-standard size pages to form a single
  7162.           16K-byte page.
  7163.  
  7164.           Handles which are assigned using Function 27 (Allocate Raw Pages) are
  7165.           called raw handles.  All logical pages allocated to a raw handle may
  7166.           have a non-standard length (that is, not 16K bytes).  However, once
  7167.           the operating system has allocated a number of raw pages to a handle,
  7168.           it is the responsibility of the memory manager to recognize that raw
  7169.           handle as one that has non-standard size pages allocated to it.  The
  7170.           memory manager must identify these handles and treat all functions
  7171.           which use handles which have non-standard page lengths differently.
  7172.           The logical page length becomes the length of the non-standard size
  7173.           page for any raw handle that Function 27 assigns.
  7174.  
  7175.           Note..............................................................
  7176.  
  7177.           This note affects expanded memory manager implementers and operating
  7178.           system developers only.  Applications should not use the following
  7179.           characteristic of the memory manager.  An application violating this
  7180.           rule will be incompatible with future versions of Microsoft's
  7181.           operating systems and environments.
  7182.  
  7183.           To be compatible with this specification, an expanded memory manager
  7184.           will provide a special handle which is available to the operating
  7185.           system only.  This handle will have a value of 0000h and will have a
  7186.           set of pages allocated to it when the expanded memory manager driver
  7187.           installs.  The pages that the memory manager will automatically
  7188.           allocate to handle 0000h are those that backfill conventional memory.
  7189.           Typically, this backfill occurs between addresses 40000h (256K) and
  7190.           9FFFFh (640K).  However, the range can extend below and above this
  7191.           limit if the hardware and memory manager have the capability.
  7192.  
  7193.                                                                       109
  7194.  
  7195.  
  7196.  
  7197.  
  7198.  
  7199.  
  7200.  
  7201.           An operating system won't have to invoke Function 27 to obtain this
  7202.           handle because it can assume the handle already exists and is
  7203.           available for use immediately after the expanded memory device driver
  7204.           installs.  When an operating system wants to use this handle, it uses
  7205.           the special handle value of 0000h. The operating system will be able
  7206.           to invoke any EMM function using this special handle value.  To
  7207.           allocate pages to this handle, the operating system need only invoke
  7208.           Function 18 (Reallocate pages).
  7209.  
  7210.           There are two special cases for this handle:
  7211.  
  7212.           1   Function 27 (Allocate Raw Pages).  This function must never return
  7213.               zero as a handle value.  Applications must always invoke Function
  7214.               27 to allocate pages and obtain a handle which identifies the
  7215.               pages which belong to it.  Since Function 27 never returns a
  7216.               handle value of zero, an application will never gain access to
  7217.               this special handle.
  7218.  
  7219.           2   Function 6 (Deallocate Pages). If the operating system uses it to
  7220.               deallocate the pages which are allocated to this special handle,
  7221.               the pages the handle owns will be returned to the manager for use.
  7222.               But the handle will not be available for reassignment.  The
  7223.               manager should treat a deallocate pages function request for this
  7224.               handle the same as a reallocate pages function request, where the
  7225.               number of pages to reallocate to this handle is zero.
  7226.  
  7227.           CALLING PARAMETERS
  7228.  
  7229.           AX = 5A01h
  7230.                      Contains the Allocate Raw Pages subfunction.
  7231.  
  7232.           BX = num_of_raw_pages_to_alloc
  7233.                      Contains the number of raw pages the operating system wants
  7234.                      to allocate.
  7235.  
  7236.           RESULTS
  7237.  
  7238.           These results are valid only if the status returned is zero.
  7239.  
  7240.           DX = raw handle
  7241.                      Contains a unique EMM raw handle.  The operating system
  7242.                      must use this EMM raw handle as a parameter in any function
  7243.                      that requires it.  Up to 255 handles may be obtained.
  7244.                      (Both Function 4 and Function 27 must share the same 255
  7245.                      handles).
  7246.  
  7247.                      For all functions using this raw handle, the length of the
  7248.                      physical and logical pages allocated to it may be non-
  7249.                      standard (that is, not 16K bytes).
  7250.  
  7251.           REGISTERS MODIFIED
  7252.  
  7253.           AH = 0     SUCCESSFUL
  7254.                      The manager has allocated the raw pages to an assigned EMM
  7255.                      raw handle.
  7256.  
  7257.  
  7258.  
  7259.                                                                       110
  7260.  
  7261.  
  7262.  
  7263.  
  7264.  
  7265.  
  7266.  
  7267.           AH = 80h   NON-RECOVERABLE
  7268.                      The manager detected a malfunction in the memory manager
  7269.                      software.
  7270.  
  7271.           AH = 81h   NON-RECOVERABLE
  7272.                      The manager detected a malfunction in the expanded memory
  7273.                      hardware.
  7274.  
  7275.           AH = 84h   NON-RECOVERABLE
  7276.                      The function code passed to the memory manager is not
  7277.                      defined.
  7278.  
  7279.           AH = 85h   RECOVERABLE
  7280.                      All EMM handles are being used.
  7281.  
  7282.           AH = 87h   RECOVERABLE
  7283.                      There aren't enough expanded memory raw pages present in
  7284.                      the system to satisfy the operating system's request.
  7285.  
  7286.           AH = 88h   RECOVERABLE
  7287.                      There aren't enough unallocated raw pages to satisfy the
  7288.                      operating system's request.
  7289.  
  7290.           AH = 8Fh   NON-RECOVERABLE
  7291.                      The subfunction parameter is invalid.
  7292.  
  7293.           EXAMPLE
  7294.           
  7295.           num_of_raw_pages_to_alloc          DW ?
  7296.           emm_raw_handle                     DW ?
  7297.           
  7298.           MOV  BX, num_of_raw_pages_to_alloc
  7299.           MOV  AX, 5A01h                     ; load function code
  7300.           INT  67h                           ; call the memory manager
  7301.           OR   AH, AH                        ; check EMM status
  7302.           JNZ  emm_err_handler               ; jump to error handler on error
  7303.           MOV  emm_raw_handle, DX            ; save raw handle
  7304.  
  7305.  
  7306.  
  7307.  
  7308.  
  7309.  
  7310.  
  7311.  
  7312.  
  7313.  
  7314.  
  7315.  
  7316.  
  7317.  
  7318.  
  7319.  
  7320.  
  7321.  
  7322.  
  7323.  
  7324.  
  7325.                                                                       111
  7326.  
  7327.  
  7328.  
  7329.  
  7330.  
  7331.  
  7332.  
  7333.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  7334.  
  7335.           Note...............................................................
  7336.  
  7337.           This function is for use by operating systems only.  The operating
  7338.           system can disable this function at any time.  Refer to Function 30
  7339.           for a description of how an operating system can enable or disable
  7340.           this function.
  7341.  
  7342.           DESIGN CONSIDERATIONS
  7343.  
  7344.           The hardware support for the entire set of subfunctions described is
  7345.           generally not present on every expanded memory board from every vendor
  7346.           of expanded memory board products.  For some of the subfunctions,
  7347.           software emulation is provided.  For other subfunctions, a certain
  7348.           protocol in their use must be observed.  The subfunctions for which
  7349.           this is most crucial are those which address system DMA capabilities.
  7350.  
  7351.           System DMA Capabilities & Expanded Memory Support of DMA
  7352.  
  7353.           In a multitasking operating system, when one task is waiting for DMA
  7354.           to complete, it is useful to be able to switch to another task.  This
  7355.           specification describes a capability which may be designed into
  7356.           expanded memory boards to provide DMA into memory regions which may be
  7357.           mapped out while the DMA is occurring.  For expanded memory boards
  7358.           that do not provide this, it is crucial to understand that while DMA
  7359.           is in progress into a region of mappable memory, the memory mapping
  7360.           context cannot be changed.  That is, all DMA action must be complete
  7361.           before any remapping of pages can be done.
  7362.  
  7363.           Expanded Memory Support of DMA Register Sets
  7364.  
  7365.           Expanded memory boards which have DMA registers sets could support DMA
  7366.           into a region of mappable memory while the memory mapping context is
  7367.           being switched.  It is important to realize that these DMA register
  7368.           sets are separate from the alternate map register sets.  An example of
  7369.           how an OS/E might use DMA registers sets follows:
  7370.  
  7371.           EXAMPLE 1
  7372.  
  7373.           1.  Allocate a DMA register set.
  7374.  
  7375.           2.  Get current register set.
  7376.  
  7377.           3.  Set the DMA register set.
  7378.  
  7379.           4.  Map in the memory desired.
  7380.  
  7381.           5.  Get the DMA register set.
  7382.  
  7383.           6.  Set the original register set.
  7384.  
  7385.           7.  Assign the desired DMA channel to the DMA register set.
  7386.  
  7387.           The preceding set of calls makes all DMA accesses for the desired DMA
  7388.           channel get mapped through the current DMA register set regardless of
  7389.           the current register set.  In other words, the DMA register set
  7390.  
  7391.                                                                       112
  7392.  
  7393.  
  7394.  
  7395.  
  7396.  
  7397.  
  7398.  
  7399.           overrides the current mapping register set for DMA operations on the
  7400.           DMA channel specified.  A DMA channel that is not assigned to a DMA
  7401.           register set has all its DMA operations mapped through the current
  7402.           mapping register set.
  7403.  
  7404.  
  7405.  
  7406.  
  7407.  
  7408.  
  7409.  
  7410.  
  7411.  
  7412.  
  7413.  
  7414.  
  7415.  
  7416.  
  7417.  
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.  
  7427.  
  7428.  
  7429.  
  7430.  
  7431.  
  7432.  
  7433.  
  7434.  
  7435.  
  7436.  
  7437.  
  7438.  
  7439.  
  7440.  
  7441.  
  7442.  
  7443.  
  7444.  
  7445.  
  7446.  
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.                                                                       113
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.  
  7465.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  7466.  
  7467.           GET ALTERNATE MAP REGISTER SET SUBFUNCTION
  7468.  
  7469.           Note..ss...........................................................
  7470.  
  7471.           This function is for use by operating systems only.  The operating
  7472.           system can disable this function at any time.  Refer to Function 30
  7473.           for a description of how an operating system can enable or disable
  7474.           this function.
  7475.  
  7476.           PURPOSE
  7477.  
  7478.           The subfunction does one of two things depending on the map register
  7479.           set which is active at the time this function is invoked:
  7480.  
  7481.           1.  If the preceding Set Alternate Map Register Set call was done with
  7482.               the alternate map register set equal to zero (BL = 0), these
  7483.               points apply:
  7484.  
  7485.               a. The context save area pointer saved within EMM by the Set
  7486.                  Alternate Map Register Set subfunction) is returned by
  7487.                  this call.  This pointer is always returned for boards
  7488.                  which do not supply alternate mapping register sets.
  7489.  
  7490.               b. If the context save area pointer returned is not equal to
  7491.                  zero, this subfunction copies the contents of the mapping
  7492.                  registers on each expanded memory board in the system into
  7493.                  the save area specified by the pointer.  The format of
  7494.                  this save area is the same as that returned by Function 15
  7495.                  (Get Page Map subfunction).  This is intended to simulate
  7496.                  getting an alternate map register set.  Note that the
  7497.                  memory manager does not allocate the space for the
  7498.                  context: the operating system must do so.
  7499.  
  7500.               c. If the context save area pointer returned is equal to
  7501.                  zero, this subfunction does not copy the contents of the
  7502.                  mapping registers on each expanded memory board in the
  7503.                  system into the save area specified by the pointer.
  7504.  
  7505.               d. The context save area pointer must have been initialized
  7506.                  by a previous Set Alternate Map Register Set call.  Note
  7507.                  that the value of the context save area pointer saved
  7508.                  within EMM is zero immediately after installation.
  7509.  
  7510.               e. The context save area must be initialized by a previous
  7511.                  Get Page Map call (Function 15).
  7512.  
  7513.           2.  If the preceding Set Alternate Map Register Set call was done with
  7514.               the alternate map register set  greater than zero (BL > 0), then
  7515.               the number of the alternate map register set which is in use at
  7516.               the time that this function is invoked is returned.  The context
  7517.               save area pointer is not returned in this case.
  7518.  
  7519.           CALLING PARAMETERS
  7520.  
  7521.  
  7522.  
  7523.                                                                       114
  7524.  
  7525.  
  7526.  
  7527.  
  7528.  
  7529.  
  7530.  
  7531.           AX = 5B00h
  7532.                      Contains the Get Alternate Map Register Set subfunction.
  7533.  
  7534.           RESULTS
  7535.  
  7536.           These results are valid only if the status returned is zero.
  7537.  
  7538.           IF (BL <> 0) current active alternate map register set number
  7539.                      Contains the alternate map register set which was active at
  7540.                      the time that this function was invoked.
  7541.  
  7542.           ES:DI
  7543.                      Unaffected.
  7544.  
  7545.           IF (BL = 0)
  7546.                      Indicates that a pointer to an area which contains the
  7547.                      state of all the map registers on all boards in the system,
  7548.                      and any additional information necessary to restore the
  7549.                      boards to their original state, has been returned.
  7550.  
  7551.           ES:DI = pointer to a map register context save area
  7552.                      Contains a pointer to an operating system supplied context
  7553.                      save area.  The pointer is in standard segment:offset
  7554.                      format.  This pointer is always returned if the expanded
  7555.                      memory hardware does not supply alternate mapping register
  7556.                      sets.
  7557.  
  7558.           The operating system first passes this pointer to the memory manager
  7559.           whenever it invokes a Set Alternate Map Register Set subfunction (the
  7560.           description follows).  If the OS/E invokes this function before
  7561.           invoking a Set Alternate Map Register Set subfunction, this function
  7562.           returns a pointer value of zero.  The OS/E must have allocated the
  7563.           space for the save area.  However, the OS must request that the memory
  7564.           manager initialize the contents of this save area before it contains
  7565.           any useful information.
  7566.  
  7567.           The OS/E must initialize the save area it has allocated by invoking
  7568.           Function 15 (Get Page Map subfunction).  After the OS/E has done this,
  7569.           the save area will contain the state of all the map registers on all
  7570.           boards in the system.  The save area will also contain any additional
  7571.           information necessary to restore the boards to their original state
  7572.           when the operating system invokes a Set Alternate Map Register Set
  7573.           subfunction.
  7574.  
  7575.           REGISTERS MODIFIED
  7576.  
  7577.           AX, BX, ES:DI
  7578.  
  7579.           STATUS
  7580.  
  7581.           AH = 0     SUCCESSFUL
  7582.                      The manager got the alternate map register set.
  7583.  
  7584.           AH = 80h   NON-RECOVERABLE
  7585.                      The manager detected a malfunction in the memory manager
  7586.                      software.
  7587.  
  7588.  
  7589.                                                                       115
  7590.  
  7591.  
  7592.  
  7593.  
  7594.  
  7595.  
  7596.  
  7597.           AH = 81h   NON-RECOVERABLE
  7598.                      The manager detected a malfunction in the expanded memory
  7599.                      hardware.
  7600.  
  7601.           AH = 84h   NON-RECOVERABLE
  7602.                      The function code passed to the memory manager is not
  7603.                      defined.
  7604.  
  7605.           AH = 8Fh   NON-RECOVERABLE
  7606.                      The subfunction parameter is invalid.
  7607.  
  7608.           AH = A4h   NON-RECOVERABLE
  7609.                      The operating system denied access to this function.  The
  7610.                      function cannot be used at this time.
  7611.  
  7612.           EXAMPLE
  7613.           
  7614.           alt_map_reg_set                    DB ?
  7615.           context_save_area_ptr_seg          DW ?
  7616.           context_save_area_ptr_offset       DW ?
  7617.           
  7618.           MOV  AX, 5B00h                     ; load function code
  7619.           INT  67h                           ; call the memory manager
  7620.           OR   AH, AH                        ; check EMM status
  7621.           JNZ  emm_err_handler               ; jump to error handler on error
  7622.           MOV  alt_map_reg_set, BL
  7623.           TEST BL, BL
  7624.           JNZ  no_ptr_returned
  7625.           MOV  context_save_area_ptr_seg, ES ; save pointer values
  7626.           MOV  context_save_area_ptr_offset,  DI
  7627.           
  7628.           no_ptr_returned:
  7629.  
  7630.  
  7631.  
  7632.  
  7633.  
  7634.  
  7635.  
  7636.  
  7637.  
  7638.  
  7639.  
  7640.  
  7641.  
  7642.  
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.  
  7650.  
  7651.  
  7652.  
  7653.  
  7654.  
  7655.                                                                       116
  7656.  
  7657.  
  7658.  
  7659.  
  7660.  
  7661.  
  7662.  
  7663.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  7664.  
  7665.           SET ALTERNATE MAP REGISTER SET SUBFUNCTION
  7666.  
  7667.           Notes..............................................................
  7668.  
  7669.           This function is for use by operating systems only.  The operating
  7670.           system can disable this function at any time.  Refer to Function 30
  7671.           for a description of how an operating system can enable or disable
  7672.           this function.
  7673.  
  7674.           PURPOSE
  7675.  
  7676.           The subfunction does one of two things, depending on the map register
  7677.           set specified:
  7678.  
  7679.           1   If the alternate map register set specified is zero, map register
  7680.               set zero is activated.  If the map register context restore area
  7681.               pointer is not equal to zero, the contents of the restore area
  7682.               pointed to by ES:DI are copied into register set zero on each
  7683.               expanded memory board in the system.  If the pointer is equal to
  7684.               zero, the contents are not copied.
  7685.  
  7686.               Regardless of its value, the map register context restore area
  7687.               pointer is saved within the memory manager.  It will be used
  7688.               during the Get Alternate Map Register Set subfunction.
  7689.  
  7690.               The operating system must supply the pointer to the area.  This
  7691.               subfunction is intended to simulate setting an alternate map
  7692.               register set.  Note that the operating system must allocate the
  7693.               space for the context.  The memory manager saves the context save
  7694.               area pointer internally.
  7695.  
  7696.           2   If the alternate map register set specified is not zero, the
  7697.               alternate map register set specified is activated.  The restore
  7698.               area, which the operating system is pointing to, is not used.
  7699.  
  7700.           CALLING PARAMETERS
  7701.  
  7702.           AX = 5B01h
  7703.                      Contains the Set Alternate Map subfunction.
  7704.  
  7705.           BL = new alternate map register set number
  7706.                      Contains the number of the alternate map register set which
  7707.                      is to be activated.
  7708.  
  7709.           If BL <> 0
  7710.                      A pointer to a map register context restore area is not
  7711.                      required and the contents of ES:DI are unaffected and
  7712.                      ignored.  The alternate map register set specified in BL is
  7713.                      activated if the board supports it.
  7714.  
  7715.           If BL = 0
  7716.                      A pointer to an area which contains the state of all the
  7717.                      map registers on all boards in the system, and any
  7718.                      additional information necessary to restore the boards to
  7719.                      their original state, has been passed in ES:DI.
  7720.  
  7721.                                                                       117
  7722.  
  7723.  
  7724.  
  7725.  
  7726.  
  7727.  
  7728.  
  7729.           ES:DI = pointer to a map register context restore area
  7730.                      Contains a pointer to an OS/E supplied map register context
  7731.                      restore area.  The pointer is in standard segment:offset
  7732.                      format.  This pointer must always be passed if the expanded
  7733.                      memory hardware does not supply alternate mapping register
  7734.                      sets.
  7735.  
  7736.                      The memory manager must save this pointer whenever the OS/E
  7737.                      invokes this function.  The OS/E must have allocated the
  7738.                      space for the restore area.  Additionally, the contents of
  7739.                      this restore area must have been initialized by the memory
  7740.                      manager before it will contain any useful information.  The
  7741.                      OS/E initializes the restore area it has allocated by
  7742.                      invoking Function 15 (Get Page Map subfunction).  After the
  7743.                      OS/E has done this, the restore area will contain the state
  7744.                      of the map registers on all boards in the system, and any
  7745.                      additional information necessary to restore the boards to
  7746.                      their original state when the operating system invokes a
  7747.                      Set Alternate Map Register Set subfunction.
  7748.  
  7749.           REGISTERS MODIFIED
  7750.  
  7751.           AX
  7752.  
  7753.           STATUS
  7754.  
  7755.           AH = 0     SUCCESSFUL
  7756.                      The manager set the alternate map register set.
  7757.  
  7758.           AH = 80h   NON-RECOVERABLE
  7759.                      The manager detected a malfunction in the memory manager
  7760.                      software.
  7761.  
  7762.           AH = 81h   NON-RECOVERABLE
  7763.                      The manager detected a malfunction in the expanded memory
  7764.                      hardware.
  7765.  
  7766.           AH = 84h   NON-RECOVERABLE
  7767.                      The function code passed to the memory manager is not
  7768.                      defined.
  7769.  
  7770.           AH = 8Fh   NON-RECOVERABLE
  7771.                      The subfunction parameter is invalid.
  7772.  
  7773.           AH = 9Ah   NON-RECOVERABLE
  7774.                      Alternate map register sets are supported, but the
  7775.                      alternate map register set specified is not supported.
  7776.  
  7777.           AH = 9Ch   NON-RECOVERABLE
  7778.                      Alternate map register sets are not supported, and the
  7779.                      alternate map register set specified is not zero.
  7780.  
  7781.           AH = 9Dh   NON-RECOVERABLE
  7782.                      Alternate map register sets are supported, but the
  7783.                      alternate map register set specified is either not defined
  7784.                      or not allocated.
  7785.  
  7786.  
  7787.                                                                       118
  7788.  
  7789.  
  7790.  
  7791.  
  7792.  
  7793.  
  7794.  
  7795.           AH = A3h   NON-RECOVERABLE
  7796.                      The contents of the source array have been corrupted, or
  7797.                      the pointer passed to the subfunction is invalid.
  7798.  
  7799.           AH = A4h   NON-RECOVERABLE
  7800.                      The operating system has denied access to this function.
  7801.                      The function cannot be used at this time.
  7802.  
  7803.           EXAMPLE
  7804.           
  7805.           alt_map_reg_set                    DB ?
  7806.           context_restore_area_ptr_seg       DW ?
  7807.           context_restore_area_ptr_offset    DW ?
  7808.           
  7809.           MOV  AX, 5B01h                     ; load function code
  7810.           MOV  BL, alt_map_reg_set
  7811.           TEST BL, BL
  7812.           JZ   no_ptr_passed
  7813.           MOV  ES, context_restore_area_ptr_seg
  7814.           MOV  DI, context_restore_area_ptr_offset
  7815.           
  7816.           no_ptr_passed:
  7817.           
  7818.           INT  67h                           ; call the memory manager
  7819.           OR   AH, AH                        ; check EMM status
  7820.           JNZ  emm_err_handler               ; jump to error handler on error
  7821.  
  7822.  
  7823.  
  7824.  
  7825.  
  7826.  
  7827.  
  7828.  
  7829.  
  7830.  
  7831.  
  7832.  
  7833.  
  7834.  
  7835.  
  7836.  
  7837.  
  7838.  
  7839.  
  7840.  
  7841.  
  7842.  
  7843.  
  7844.  
  7845.  
  7846.  
  7847.  
  7848.  
  7849.  
  7850.  
  7851.  
  7852.  
  7853.                                                                       119
  7854.  
  7855.  
  7856.  
  7857.  
  7858.  
  7859.  
  7860.  
  7861.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  7862.  
  7863.           GET ALTERNATE MAP SAVE ARRAY SIZE SUBFUNCTION
  7864.  
  7865.           Note...............................................................
  7866.  
  7867.           This function is for use by operating systems only.  The operating
  7868.           system can disable this function at any time.  Refer to Function 30
  7869.           for a description of how an operating system can enable or disable
  7870.           this function.
  7871.  
  7872.           PURPOSE
  7873.  
  7874.           This subfunction returns the storage requirements for the map register
  7875.           context save area referenced by the other subfunctions.
  7876.  
  7877.           CALLING PARAMETERS
  7878.  
  7879.           AX = 5B02h
  7880.                      Contains the Get Alternate Map Save Array Size subfunction.
  7881.  
  7882.           RESULTS
  7883.  
  7884.           These results are valid only if the status returned is zero.
  7885.  
  7886.           DX = size_of_array
  7887.                      Contains the number of bytes that will be transferred to
  7888.                      the memory area supplied by an operating system whenever an
  7889.                      operating system requests the Get, Set, or Get and Set
  7890.                      subfunction.
  7891.  
  7892.           REGISTERS MODIFIED
  7893.  
  7894.           AX, DX
  7895.  
  7896.           STATUS
  7897.  
  7898.           AH = 0     SUCCESSFUL
  7899.                      The manager has returned the array size.
  7900.  
  7901.           AH = 80h   NON-RECOVERABLE
  7902.                      The manager detected a malfunction in the memory manager
  7903.                      software.
  7904.  
  7905.           AH = 81h   NON-RECOVERABLE
  7906.                      The manager detected a malfunction in the expanded memory
  7907.                      hardware.
  7908.  
  7909.           AH = 84h   NON-RECOVERABLE
  7910.                      The function code passed to the memory manager is not
  7911.                      defined.
  7912.  
  7913.           AH = 8Fh   NON-RECOVERABLE
  7914.                      The subfunction parameter is invalid.
  7915.  
  7916.  
  7917.  
  7918.  
  7919.                                                                       120
  7920.  
  7921.  
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.           AH = A4h   NON-RECOVERABLE
  7928.                      The operating system has denied access to this function.
  7929.                      The function cannot be used at this time.
  7930.  
  7931.           EXAMPLE
  7932.           
  7933.           size_of_array                      DW ?
  7934.           
  7935.           MOV  AX, 5B02h                     ; load function code
  7936.           INT  67h                           ; call the memory manager
  7937.           OR   AH, AH                        ; check EMM status
  7938.           JNZ  emm_err_handler               ; jump to error handler on error
  7939.           MOV  size_of_array, DX             ; save size of array
  7940.  
  7941.  
  7942.  
  7943.  
  7944.  
  7945.  
  7946.  
  7947.  
  7948.  
  7949.  
  7950.  
  7951.  
  7952.  
  7953.  
  7954.  
  7955.  
  7956.  
  7957.  
  7958.  
  7959.  
  7960.  
  7961.  
  7962.  
  7963.  
  7964.  
  7965.  
  7966.  
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.  
  7973.  
  7974.  
  7975.  
  7976.  
  7977.  
  7978.  
  7979.  
  7980.  
  7981.  
  7982.  
  7983.  
  7984.  
  7985.                                                                       121
  7986.  
  7987.  
  7988.  
  7989.  
  7990.  
  7991.  
  7992.  
  7993.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  7994.  
  7995.           ALLOCATE ALTERNATE MAP REGISTER SET SUBFUNCTION
  7996.  
  7997.           Note...............................................................
  7998.  
  7999.           This function is for use by operating systems only.  The operating
  8000.           system can disable this function at any time.   Refer to Function 30
  8001.           for a description of how an operating system can enable or disable
  8002.           this function.
  8003.  
  8004.           PURPOSE
  8005.  
  8006.           The Allocate Alternate Map Register Set subfunction gets the number of
  8007.           an alternate map register set for an operating system if an alternate
  8008.           map register set is currently available for use.  If the hardware does
  8009.           not support alternate map register sets, an alternate map register set
  8010.           number of zero will be returned.
  8011.  
  8012.           The alternate map register set allocated may be referred to by this
  8013.           number when using the Get or Set Alternate Map Register Set
  8014.           subfunctions.  The operating system can use these subfunctions to
  8015.           switch map contexts very rapidly on expanded memory boards with
  8016.           alternate map register sets.
  8017.  
  8018.           This subfunction copies the currently active alternate map register
  8019.           sets contents into the newly allocated alternate map register set's
  8020.           mapping registers.  This is done so that when the OS/E performs a Set
  8021.           Alternate Map Register Set subfunction the memory mapped before the
  8022.           allocation of the new alternate map will be available for reading and
  8023.           writing.  This function does not actually change the alternate map
  8024.           register set in use, but in addition to allocating a new alternate map
  8025.           register set, it prepares the new alternate map register set for a
  8026.           subsequent Set Alternate Map Register Set subfunction.
  8027.  
  8028.           CALLING PARAMETERS
  8029.  
  8030.           AX = 5B03h
  8031.                      Contains the Allocate Alternate Map Register Set
  8032.                      subfunction.
  8033.  
  8034.           RESULTS
  8035.  
  8036.           These results are valid only if the status returned is zero.
  8037.  
  8038.           BL = alternate map register set number
  8039.                      Contains the number of an alternate map register set.  If
  8040.                      there are no alternate map register sets supported by the
  8041.                      hardware, a zero will be returned.  In this case, the Get
  8042.                      Alternate Map function (Function 28) should be invoked in
  8043.                      order to obtain a pointer to a map register context save
  8044.                      area.  The OS/E must supply this save area.  The save area
  8045.                      is necessary because the hardware doesn't support alternate
  8046.                      map register sets.
  8047.  
  8048.           REGISTERS MODIFIED
  8049.  
  8050.  
  8051.                                                                       122
  8052.  
  8053.  
  8054.  
  8055.  
  8056.  
  8057.  
  8058.  
  8059.           AX, BX
  8060.  
  8061.           STATUS
  8062.  
  8063.           AH = 0     SUCCESSFUL
  8064.                      The manager has returned the array size.
  8065.  
  8066.           AH = 80h   NON-RECOVERABLE
  8067.                      The manager detected a malfunction in the memory manager
  8068.                      software.
  8069.  
  8070.           AH = 81h   NON-RECOVERABLE
  8071.                      The manager detected a malfunction in the expanded memory
  8072.                      hardware.
  8073.  
  8074.           AH = 84h   NON-RECOVERABLE
  8075.                      The function code passed to the memory manager is not
  8076.                      defined.
  8077.  
  8078.           AH = 8Fh   NON-RECOVERABLE
  8079.                      The subfunction parameter is invalid.
  8080.  
  8081.           AH = 9Bh   NON-RECOVERABLE
  8082.                      Alternate map register sets are supported.  However, all
  8083.                      alternate map register sets are currently allocated.
  8084.  
  8085.           AH = A4h   NON-RECOVERABLE
  8086.                      The operating system has denied access to this function.
  8087.                      The function cannot be used at this time.
  8088.  
  8089.           EXAMPLE
  8090.           
  8091.           alt_map_reg_num                    DB ?
  8092.           
  8093.           MOV  AX, 5B03h                     ; load function code
  8094.           INT  67h                           ; call the memory manager
  8095.           OR   AH, AH                        ; check EMM status
  8096.           JNZ  emm_err_handler               ; jump to error handler on error
  8097.           MOV  alt_map_reg_num, BL           ; save # of alternate map reg
  8098.                                              ; set
  8099.  
  8100.  
  8101.  
  8102.  
  8103.  
  8104.  
  8105.  
  8106.  
  8107.  
  8108.  
  8109.  
  8110.  
  8111.  
  8112.  
  8113.  
  8114.  
  8115.  
  8116.  
  8117.                                                                       123
  8118.  
  8119.  
  8120.  
  8121.  
  8122.  
  8123.  
  8124.  
  8125.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  8126.  
  8127.           DEALLOCATE ALTERNATE MAP REGISTER SET SUBFUNCTION
  8128.  
  8129.           Note...............................................................
  8130.  
  8131.           This function is for use by operating systems only.  The operating
  8132.           system can disable this function at any time.  Refer to Function 30
  8133.           for a description of how an operating system can enable or disable
  8134.           this function.
  8135.  
  8136.           PURPOSE
  8137.  
  8138.           The Deallocate Alternate Map Register Set subfunction returns the
  8139.           alternate map register set to the memory manager for future use.  The
  8140.           memory manager may reallocate the alternate map register set when
  8141.           needed.
  8142.  
  8143.           This subfunction also makes the mapping context of the alternate map
  8144.           register specified unavailable for reading or writing (unmapping).
  8145.           This protects the pages previously mapped in an alternate map register
  8146.           set by making them inaccessible.  Note that the current alternate map
  8147.           register set cannot be deallocated.  This makes all memory which was
  8148.           currently mapped into conventional and expanded memory inaccessible.
  8149.  
  8150.           CALLING PARAMETERS
  8151.  
  8152.           AX = 5B04h
  8153.                      Contains the Deallocate Alternate Map Register Set
  8154.                      subfunction.
  8155.  
  8156.           BL = alternate register set number
  8157.                      Contains the number of the alternate map register set to
  8158.                      deallocate.  Map register set zero cannot be allocated or
  8159.                      deallocated.  However, if alternate map register set zero
  8160.                      is specified and this subfunction is invoked, no error will
  8161.                      be returned.  The function invocation is ignored in this
  8162.                      case.
  8163.  
  8164.           REGISTERS MODIFIED
  8165.  
  8166.           AX
  8167.  
  8168.           STATUS
  8169.  
  8170.           AH = 0     SUCCESSFUL
  8171.                      The manager has returned the array size.
  8172.  
  8173.           AH = 80h   NON-RECOVERABLE
  8174.                      The manager detected a malfunction in the memory manager
  8175.                      software.
  8176.  
  8177.           AH = 81h   NON-RECOVERABLE
  8178.                      The manager detected a malfunction in the expanded memory
  8179.                      hardware.
  8180.  
  8181.  
  8182.  
  8183.                                                                       124
  8184.  
  8185.  
  8186.  
  8187.  
  8188.  
  8189.  
  8190.  
  8191.           AH = 84h   NON-RECOVERABLE
  8192.                      The function code passed to the memory manager is not
  8193.                      defined.
  8194.  
  8195.           AH = 8Fh   NON-RECOVERABLE
  8196.                      The subfunction parameter is invalid.
  8197.  
  8198.           AH = 9Ch   NON-RECOVERABLE
  8199.                      Alternate map register sets are not supported and the
  8200.                      alternate map register set specified is not zero.
  8201.  
  8202.           AH = 9Dh   NON-RECOVERABLE
  8203.                      Alternate map register sets are supported, but the
  8204.                      alternate map register set specified is either not defined
  8205.                      or not allocated.
  8206.  
  8207.           AH = A4h   NON-RECOVERABLE
  8208.                      The operating system has denied access to this function.
  8209.                      The function cannot be used at this time.
  8210.  
  8211.           EXAMPLE
  8212.           
  8213.           alternate_map_reg_set              DB ?
  8214.           
  8215.           MOV  AL, alternate_map_reg_set     ; specify alternate map reg set
  8216.           MOV  AX, 5B04h                     ; load function code
  8217.           INT  67h                           ; call the memory manager
  8218.           OR   AH, AH                        ; check EMM status
  8219.           JNZ  emm_err_handler               ; jump to error handler on error
  8220.  
  8221.  
  8222.  
  8223.  
  8224.  
  8225.  
  8226.  
  8227.  
  8228.  
  8229.  
  8230.  
  8231.  
  8232.  
  8233.  
  8234.  
  8235.  
  8236.  
  8237.  
  8238.  
  8239.  
  8240.  
  8241.  
  8242.  
  8243.  
  8244.  
  8245.  
  8246.  
  8247.  
  8248.  
  8249.                                                                       125
  8250.  
  8251.  
  8252.  
  8253.  
  8254.  
  8255.  
  8256.  
  8257.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  8258.  
  8259.           ALLOCATE DMA REGISTER SET SUBFUNCTION
  8260.  
  8261.           Note...............................................................
  8262.  
  8263.           This function is for use by operating systems only.  The operating
  8264.           system can disable this function at any time.  Refer to Function 30
  8265.           for a description of how an operating system can enable or disable
  8266.           this function.
  8267.  
  8268.           PURPOSE
  8269.  
  8270.           The Allocate DMA Register Set subfunction gets the number of a DMA
  8271.           register set for an OS/E, if a DMA register set is currently available
  8272.           for use.  If the hardware does not support DMA register sets, a DMA
  8273.           register set number of zero will be returned.
  8274.  
  8275.           In a multitasking operating system, when one task is waiting for DMA
  8276.           to complete, it is useful to be able to switch to another task.
  8277.           However, if the DMA is being mapped through the current register set,
  8278.           the switching cannot occur.  That is, all DMA action must be complete
  8279.           before any remapping of pages can be done.
  8280.  
  8281.           The operating system would initiate a DMA operation on a specific DMA
  8282.           channel using a specific alternate map register set.  This alternate
  8283.           map register set would not be used again, by the operating system or
  8284.           an application, until after the DMA operation is complete.  The
  8285.           operating system guarantees this by not changing the contents of the
  8286.           alternate map register set, or allowing an application to change the
  8287.           contents of the alternate map register set, for the duration of the
  8288.           DMA operation.
  8289.  
  8290.           CALLING PARAMETERS
  8291.  
  8292.           AX = 5B05h
  8293.                      Contains the Allocate DMA Register Set subfunction.
  8294.  
  8295.           RESULTS
  8296.  
  8297.           These results are valid only if the status returned is zero.
  8298.  
  8299.           BL = DMA register set number
  8300.                      Contains the number of a DMA register set.  If there are no
  8301.                      DMA register sets supported by the hardware, a zero will be
  8302.                      returned.
  8303.  
  8304.           REGISTERS MODIFIED
  8305.  
  8306.           AX, BX
  8307.  
  8308.           STATUS
  8309.  
  8310.           AH = 0     SUCCESSFUL
  8311.                      The manager has allocated the DMA register set.
  8312.  
  8313.  
  8314.  
  8315.                                                                       126
  8316.  
  8317.  
  8318.  
  8319.  
  8320.  
  8321.  
  8322.  
  8323.           AH = 80h   NON-RECOVERABLE
  8324.                      The manager detected a malfunction in the memory manager
  8325.                      software.
  8326.  
  8327.           AH = 81h   NON-RECOVERABLE
  8328.                      The manager detected a malfunction in the expanded memory
  8329.                      hardware.
  8330.  
  8331.           AH = 84h   NON-RECOVERABLE
  8332.                      The function code passed to the memory manager is not
  8333.                      defined.
  8334.  
  8335.           AH = 8Fh   NON-RECOVERABLE
  8336.                      The subfunction parameter is invalid.
  8337.  
  8338.           AH = 9Bh   NON-RECOVERABLE
  8339.                      DMA register sets are supported.  However, all DMA register
  8340.                      sets are currently allocated.
  8341.  
  8342.           AH = A4h   NON-RECOVERABLE
  8343.                      Access to this function has been denied by the operating
  8344.                      system.  The function cannot be used at this time.
  8345.  
  8346.           EXAMPLE
  8347.           
  8348.           DMA_reg_set_number                 DB ?
  8349.           
  8350.           MOV  AX, 5B05h                     ; load function code
  8351.           INT  67h                           ; call memory manager
  8352.           OR   AH, AH                        ; check EMM status
  8353.           JNZ  emm_err_handler               ; jump to error handler on error
  8354.           MOV  DMA_reg_set_number, BL        ; save number of DMA register
  8355.                                              ; set
  8356.  
  8357.  
  8358.  
  8359.  
  8360.  
  8361.  
  8362.  
  8363.  
  8364.  
  8365.  
  8366.  
  8367.  
  8368.  
  8369.  
  8370.  
  8371.  
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.  
  8378.  
  8379.  
  8380.  
  8381.                                                                       127
  8382.  
  8383.  
  8384.  
  8385.  
  8386.  
  8387.  
  8388.  
  8389.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  8390.  
  8391.           ENABLE DMA ON ALTERNATE MAP REGISTER SET SUBFUNCTION
  8392.  
  8393.           Note...............................................................
  8394.  
  8395.           This function is for use by operating systems only.  The operating
  8396.           system can disable this function at any time.  Refer to Function 30
  8397.           for a description of how an operating system can enable or disable
  8398.           this function.
  8399.  
  8400.           PURPOSE
  8401.  
  8402.           This subfunction allows DMA accesses on a specific DMA channel to be
  8403.           associated with a specific alternate map register set.  In a
  8404.           multitasking operating system, when a task is waiting for the
  8405.           completion of DMA, it is useful to be able to switch to another task
  8406.           until the DMA operation completes.
  8407.  
  8408.           Any DMA on the specified channel will go through the specified DMA
  8409.           register set regardless of the current register set.  If a DMA channel
  8410.           is not assigned to a DMA register set, DMA for that channel will be
  8411.           mapped through the current register set.
  8412.  
  8413.           CALLING PARAMETERS
  8414.  
  8415.           AX = 5B06h
  8416.                      Contains the Enable DMA on Alternate Map Register Set
  8417.                      subfunction.
  8418.  
  8419.           BL = DMA register set number
  8420.                      Contains the number of the alternate map register set to be
  8421.                      used for DMA operations on the DMA channel specified by DL.
  8422.                      If the alternate map register set specified is zero, no
  8423.                      special action will be taken on DMA accesses for the DMA
  8424.                      channel specified.
  8425.  
  8426.           DL = DMA channel number
  8427.                      Contains the DMA channel which is to be associated with the
  8428.                      DMA map register set specified in BL.
  8429.  
  8430.           REGISTERS MODIFIED
  8431.  
  8432.           AX
  8433.  
  8434.           STATUS
  8435.  
  8436.           AH = 0     SUCCESSFUL
  8437.                      The manager has enabled DMA on the DMA register set and the
  8438.                      DMA channel specified.
  8439.  
  8440.           AH = 80h   NON-RECOVERABLE
  8441.                      The manager detected a malfunction in the memory manager
  8442.                      software.
  8443.  
  8444.  
  8445.  
  8446.  
  8447.                                                                       128
  8448.  
  8449.  
  8450.  
  8451.  
  8452.  
  8453.  
  8454.  
  8455.           AH = 81h   NON-RECOVERABLE
  8456.                      The manager detected a malfunction in the expanded memory
  8457.                      hardware.
  8458.  
  8459.           AH = 84h   NON-RECOVERABLE
  8460.                      The function code passed to the memory manager is not
  8461.                      defined.
  8462.  
  8463.           AH = 8Fh   NON-RECOVERABLE
  8464.                      The subfunction parameter is invalid.
  8465.  
  8466.           AH = 9Ah   NON-RECOVERABLE
  8467.                      Alternate DMA register sets are supported, but the
  8468.                      alternate DMA register set specified is not supported.
  8469.  
  8470.           AH = 9Ch   NON-RECOVERABLE
  8471.                      Alternate DMA register sets are not supported, and the DMA
  8472.                      register set specified is not zero.
  8473.  
  8474.           AH = 9Dh   NON-RECOVERABLE
  8475.                      DMA register sets are supported, but the DMA register set
  8476.                      specified is either not defined or not allocated.
  8477.  
  8478.           AH = 9Eh   NON-RECOVERABLE
  8479.                      Dedicated DMA channels are not supported.
  8480.  
  8481.           AH = 9Fh   NON-RECOVERABLE
  8482.                      Dedicated DMA channels are supported.  But the DMA channel
  8483.                      specified is not supported.
  8484.  
  8485.           AH = A4h   NON-RECOVERABLE
  8486.                      The operating system has denied access to this function.
  8487.                      The function cannot be used at this time.
  8488.  
  8489.           EXAMPLE
  8490.           
  8491.           alt_map_reg_set                    DB ?
  8492.           DMA_channel_num                    DB ?
  8493.           
  8494.           MOV  BL, alt_map_reg_set
  8495.           MOV  DL, DMA_channel_num
  8496.           MOV  AX, 5B06h                     ; load function code
  8497.           INT  67h                           ; call the memory manager
  8498.           OR   AH, AH                        ; check EMM status
  8499.           JNZ  emm_err_handler               ; jump to error handler on error
  8500.  
  8501.  
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.  
  8508.  
  8509.  
  8510.  
  8511.  
  8512.  
  8513.                                                                       129
  8514.  
  8515.  
  8516.  
  8517.  
  8518.  
  8519.  
  8520.  
  8521.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  8522.  
  8523.           DISABLE DMA ON ALTERNATE MAP REGISTER SET SUBFUNCTION
  8524.  
  8525.           Note...............................................................
  8526.  
  8527.           This function is for use by operating systems only.  The operating
  8528.           system can disable this function at any time.  Refer to Function 30
  8529.           for a description of how an operating system can enable or disable
  8530.           this function.
  8531.  
  8532.           PURPOSE
  8533.  
  8534.           This subfunction disables DMA accesses for all DMA channels which were
  8535.           associated with a specific alternate map register set.
  8536.  
  8537.           CALLING PARAMETERS
  8538.  
  8539.           AX = 5B07h
  8540.                      Contains the Disable DMA on Alternate Map Register Set
  8541.                      subfunction.
  8542.  
  8543.           BL = alternate register set number
  8544.                      Contains the number of the DMA register set for which all
  8545.                      operations are to be disabled.  If the alternate map
  8546.                      register set specified is zero, no action will be taken.
  8547.  
  8548.           REGISTERS MODIFIED
  8549.  
  8550.           AX
  8551.  
  8552.           STATUS
  8553.  
  8554.           AH = 0     SUCCESSFUL
  8555.                      The manager has returned the array size.
  8556.  
  8557.           AH = 80h   NON-RECOVERABLE
  8558.                      The manager detected a malfunction in the memory manager
  8559.                      software.
  8560.  
  8561.           AH = 81h   NON-RECOVERABLE
  8562.                      The manager detected a malfunction in the expanded memory
  8563.                      hardware.
  8564.  
  8565.           AH = 84h   NON-RECOVERABLE
  8566.                      The function code passed to the memory manager is not
  8567.                      defined.
  8568.  
  8569.           AH = 8Fh   NON-RECOVERABLE
  8570.                      The subfunction parameter is invalid.
  8571.  
  8572.           AH = 9Ah   NON-RECOVERABLE
  8573.                      Alternate DMA register sets are supported, but the
  8574.                      alternate DMA register set specified is not supported.
  8575.  
  8576.  
  8577.  
  8578.  
  8579.                                                                       130
  8580.  
  8581.  
  8582.  
  8583.  
  8584.  
  8585.  
  8586.  
  8587.           AH = 9Ch   NON-RECOVERABLE
  8588.                      Alternate DMA register sets are not supported, and the DMA
  8589.                      register set specified is not zero.
  8590.  
  8591.           AH = 9Dh   NON-RECOVERABLE
  8592.                      DMA register sets are supported, but the DMA register set
  8593.                      specified is either not defined or not allocated.
  8594.  
  8595.           AH = 9Eh   NON-RECOVERABLE
  8596.                      Dedicated DMA channels are not supported.
  8597.  
  8598.           AH = 9Fh   NON-RECOVERABLE
  8599.                      Dedicated DMA channels are supported, but the DMA channel
  8600.                      specified is not supported.
  8601.  
  8602.           AH = A4h   NON-RECOVERABLE
  8603.                      The operating system has denied access to this function.
  8604.                      The function cannot be used at this time.
  8605.  
  8606.           EXAMPLE
  8607.           
  8608.           DMA_reg_set                        DB ?
  8609.           
  8610.           MOV  BL, DMA_reg_set
  8611.           MOV  AX, 5B07h                     ; load function code
  8612.           INT  67h                           ; call the memory manager
  8613.           OR   AH, AH                        ; check EMM status
  8614.           JNZ  emm_err_handler               ; jump to error handler on error
  8615.  
  8616.  
  8617.  
  8618.  
  8619.  
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.  
  8626.  
  8627.  
  8628.  
  8629.  
  8630.  
  8631.  
  8632.  
  8633.  
  8634.  
  8635.  
  8636.  
  8637.  
  8638.  
  8639.  
  8640.  
  8641.  
  8642.  
  8643.  
  8644.  
  8645.                                                                       131
  8646.  
  8647.  
  8648.  
  8649.  
  8650.  
  8651.  
  8652.  
  8653.      FUNCTION 28   ALTERNATE MAP REGISTER SET
  8654.  
  8655.           DEALLOCATE DMA REGISTER SET SUBFUNCTION
  8656.  
  8657.           Note...............................................................
  8658.  
  8659.           This function is for use by operating systems only.  The operating
  8660.           system can disable this function at any time.  Refer to Function 30
  8661.           for a description of how an operating system can enable or disable
  8662.           this function.
  8663.  
  8664.           PURPOSE
  8665.  
  8666.           The Deallocate DMA Register Set subfunction deallocates the specified
  8667.           DMA register set.
  8668.  
  8669.           CALLING PARAMETERS
  8670.  
  8671.           AX = 5B08h
  8672.                      Contains the Deallocate DMA Register Set subfunction.
  8673.  
  8674.           BL = DMA register set number
  8675.                      Contains the number of the DMA register set which should
  8676.                      not be used for DMA operations any longer.  The DMA
  8677.                      register set would have been previously allocated and
  8678.                      enabled for DMA operations on a specific DMA channel.  If
  8679.                      the DMA register set specified is zero, no action will be
  8680.                      taken.
  8681.  
  8682.           REGISTERS MODIFIED
  8683.  
  8684.           AX
  8685.  
  8686.           STATUS
  8687.  
  8688.           AH = 0     SUCCESSFUL
  8689.                      The manager has deallocated the DMA register set.
  8690.  
  8691.           AH = 80h   NON-RECOVERABLE
  8692.                      The manager detected a malfunction in the memory manager
  8693.                      software.
  8694.  
  8695.           AH = 81h   NON-RECOVERABLE
  8696.                      The manager detected a malfunction in the expanded memory
  8697.                      hardware.
  8698.  
  8699.           AH = 84h   NON-RECOVERABLE
  8700.                      The function code passed to the memory manager is not
  8701.                      defined.
  8702.  
  8703.           AH = 8Fh   NON-RECOVERABLE
  8704.                      The subfunction parameter is invalid.
  8705.  
  8706.           AH = 9Ch   NON-RECOVERABLE
  8707.                      DMA register sets are not supported, and the DMA register
  8708.                      set specified is not zero.
  8709.  
  8710.  
  8711.                                                                       132
  8712.  
  8713.  
  8714.  
  8715.  
  8716.  
  8717.  
  8718.  
  8719.           AH = 9Dh   NON-RECOVERABLE
  8720.                      DMA register sets are supported, but the DMA register set
  8721.                      specified is either not defined or not allocated.
  8722.  
  8723.           AH = A4h   NON-RECOVERABLE
  8724.                      The operating system has denied access to this function.
  8725.                      The function cannot be used at this time.
  8726.  
  8727.           EXAMPLE
  8728.           
  8729.           DMA_reg_set_num                    DB  ?
  8730.           
  8731.           MOV  DMA_reg_set_num, BL
  8732.           MOV  AX, 5B08h                     ; load function code
  8733.           INT  67h                           ; call memory manager
  8734.           OR   AH, AH                        ; check EMM status
  8735.           JNZ  emm_err_handler               ; jump to error handler on error
  8736.  
  8737.  
  8738.  
  8739.  
  8740.  
  8741.  
  8742.  
  8743.  
  8744.  
  8745.  
  8746.  
  8747.  
  8748.  
  8749.  
  8750.  
  8751.  
  8752.  
  8753.  
  8754.  
  8755.  
  8756.  
  8757.  
  8758.  
  8759.  
  8760.  
  8761.  
  8762.  
  8763.  
  8764.  
  8765.  
  8766.  
  8767.  
  8768.  
  8769.  
  8770.  
  8771.  
  8772.  
  8773.  
  8774.  
  8775.  
  8776.  
  8777.                                                                       133
  8778.  
  8779.  
  8780.  
  8781.  
  8782.  
  8783.  
  8784.  
  8785.      FUNCTION 29   PREPARE EXPANDED MEMORY HARDWARE FOR WARM BOOT
  8786.  
  8787.           PURPOSE
  8788.  
  8789.           This function prepares the expanded memory hardware for an impending
  8790.           warm boot.  This function assumes that the next operation that the
  8791.           operating system performs is a warm boot of the system.  In general,
  8792.           this function will effect the current mapping context, the alternate
  8793.           register set in use, and any other expanded memory hardware
  8794.           dependencies which need to be initialized at boot time.  If an
  8795.           application decides to map memory below 640K, the application must
  8796.           trap all possible conditions leading to a warm boot and invoke this
  8797.           function before performing the warm boot itself.
  8798.  
  8799.           CALLING PARAMETERS
  8800.  
  8801.           AH = 5Ch
  8802.                      Contains the Prepare for Warmboot function.
  8803.  
  8804.           REGISTERS MODIFIED
  8805.  
  8806.           AX
  8807.  
  8808.           STATUS
  8809.  
  8810.           AH = 0     SUCCESSFUL
  8811.                      The manager has prepared the expanded memory hardware for a
  8812.                      warm boot.
  8813.  
  8814.           AH = 80h   NON-RECOVERABLE
  8815.                      The manager detected a malfunction in the memory manager
  8816.                      software.
  8817.  
  8818.           AH = 81h   NON-RECOVERABLE
  8819.                      The manager detected a malfunction in the expanded memory
  8820.                      hardware.
  8821.  
  8822.           AH = 84h   NON-RECOVERABLE
  8823.                      The function code passed to the memory manager is not
  8824.                      defined.
  8825.  
  8826.           EXAMPLE
  8827.           
  8828.           MOV  AH, 5Ch                       ; load function code
  8829.           INT  67h                           ; call the memory manager
  8830.           OR   AH, AH                        ; check EMM status
  8831.           JNZ  emm_err_handler               ; jump to error handler on error
  8832.  
  8833.  
  8834.  
  8835.  
  8836.  
  8837.  
  8838.  
  8839.  
  8840.  
  8841.  
  8842.  
  8843.                                                                       134
  8844.  
  8845.  
  8846.  
  8847.  
  8848.  
  8849.  
  8850.  
  8851.      FUNCTION 30   ENABLE/DISABLE OS/E FUNCTION SET FUNCTIONS
  8852.  
  8853.           ENABLE OS/E FUNCTION SET SUBFUNCTION
  8854.  
  8855.           Note...............................................................
  8856.  
  8857.           This function is for use by operating systems only.  The operating
  8858.           system can disable this function at any time.
  8859.  
  8860.           PURPOSE
  8861.  
  8862.           This subfunction provides an OS/E with the ability to enable all
  8863.           programs or device drivers to use the OS/E specific functions.  The
  8864.           capability is provided only for an OS/E which manages regions of
  8865.           mappable conventional memory and cannot permit programs to use any of
  8866.           the functions which affect mappable conventional memory regions, but
  8867.           must be able to use these functions itself.  When an OS/E disables
  8868.           these functions and a program attempts to use them, the memory manager
  8869.           returns a status to the program indicating that the OS/E has denied
  8870.           the program access to the function.  In other words, the functions
  8871.           will not work when disabled.  However, all programs may use them when
  8872.           enabled.  The OS/E (Operating System/Environment) functions this
  8873.           subfunction enables are:
  8874.  
  8875.           Function 26.  Get Expanded Memory Hardware Information.
  8876.  
  8877.           Function 28.  Alternate Map Register Sets.
  8878.  
  8879.           Function 30.  Enable/Disable Operating System Functions.
  8880.  
  8881.           It appears contradictory that the OS/E can re-enable these functions
  8882.           when the function which re-enables them is itself disabled.  An
  8883.           overview of the process follows.
  8884.  
  8885.           The memory manager enables all the OS/E specific functions, including
  8886.           this one, when it is loaded.  The OS/E gets exclusive access to these
  8887.           functions by invoking either of the Enable/Disable OS/E Function Set
  8888.           subfunctions before any other software does.
  8889.  
  8890.           On the first invocation of either of these subfunctions, the memory
  8891.           manager returns an access_key which the OS/E must use in all future
  8892.           invocations of either of these subfunctions.  The memory manager does
  8893.           not require the access_key on the first invocation of the
  8894.           Enable/Disable OS/E Function Set subfunctions.
  8895.  
  8896.           ENABLE OS/E FUNCTION SET SUBFUNCTION
  8897.  
  8898.           On all subsequent invocations, the access_key is required for either
  8899.           the Enable or Disable OS/E Function Set subfunctions.  Since the
  8900.           access_key is returned only on the first invocation of the
  8901.           Enable/Disable OS/E Function Set subfunctions, and presumably the OS/E
  8902.           is the first software to invoke this function, only the OS/E obtains a
  8903.           copy of this key.  The memory manager must return an access key with a
  8904.           random value, a fixed value key defeats the purpose of providing this
  8905.           level of security for an OS/E.
  8906.  
  8907.           CALLING PARAMETERS
  8908.  
  8909.                                                                       135
  8910.  
  8911.  
  8912.  
  8913.  
  8914.  
  8915.  
  8916.  
  8917.           AX = 5D00h
  8918.                      Contains the Enable OS/E Function Set subfunction.
  8919.  
  8920.           BX,CX = access_key
  8921.                      Required on all function invocations after the first.  The
  8922.                      access_key value returned by the first function invocation
  8923.                      is required.
  8924.  
  8925.           RESULTS
  8926.  
  8927.           These results are valid only if the status returned is zero.
  8928.  
  8929.           BX,CX = access_key
  8930.                      Returned only on the first function invocation, the memory
  8931.                      manager returns a random valued key which will be required
  8932.                      thereafter for the execution of this function.  On all
  8933.                      invocations after the first, this key is not returned.
  8934.                      Neither BX or CX is affected after the first time this
  8935.                      function is invoked.
  8936.  
  8937.           REGISTERS MODIFIED
  8938.  
  8939.           AX, BX, CX
  8940.  
  8941.           STATUS
  8942.  
  8943.           AH = 0     SUCCESSFUL
  8944.                      The operating system function set has been enabled.
  8945.  
  8946.           AH = 80h   NON-RECOVERABLE
  8947.                      The manager detected a malfunction in the memory manager
  8948.                      software.
  8949.  
  8950.           AH = 81h   NON-RECOVERABLE
  8951.                      The manager detected a malfunction in the expanded memory
  8952.                      hardware.
  8953.  
  8954.           AH = 84h   NON-RECOVERABLE
  8955.                      The function code passed to the memory manager is not
  8956.                      defined.
  8957.  
  8958.           AH = 8Fh   NON-RECOVERABLE
  8959.                      The subfunction parameter is invalid.
  8960.  
  8961.           AH = A4h   NON-RECOVERABLE
  8962.                      The operating system has denied access to this function.
  8963.                      The function cannot be used at this time.  The value of the
  8964.                      key which was passed to this function does not entitle the
  8965.                      program to execute this function.
  8966.  
  8967.           EXAMPLE
  8968.  
  8969.           First invocation
  8970.           
  8971.           access_key                         DW 2 DUP (?)
  8972.           
  8973.           MOV  AX, 5D00h                     ; load function code
  8974.  
  8975.                                                                       136
  8976.  
  8977.  
  8978.  
  8979.  
  8980.  
  8981.  
  8982.  
  8983.           INT  67h                           ; call the memory manager
  8984.           OR   AH, AH                        ; check EMM status
  8985.           JNZ  emm_err_handler               ; jump to error handler on error
  8986.           MOV  access_key[0], BX
  8987.           MOV  access_key[2], CX
  8988.  
  8989.           All invocations after the first
  8990.           
  8991.           access_key                         DW 2 DUP (?)
  8992.           
  8993.           MOV  BX, access_key[0]
  8994.           MOV  CX, access_key[2]
  8995.           MOV  AX, 5D00h                     ; load function code
  8996.           INT  67h                           ; call the memory manager
  8997.           OR   AH, AH                        ; check EMM status
  8998.           JNZ  emm_err_handler               ; jump to test handler on error
  8999.  
  9000.  
  9001.  
  9002.  
  9003.  
  9004.  
  9005.  
  9006.  
  9007.  
  9008.  
  9009.  
  9010.  
  9011.  
  9012.  
  9013.  
  9014.  
  9015.  
  9016.  
  9017.  
  9018.  
  9019.  
  9020.  
  9021.  
  9022.  
  9023.  
  9024.  
  9025.  
  9026.  
  9027.  
  9028.  
  9029.  
  9030.  
  9031.  
  9032.  
  9033.  
  9034.  
  9035.  
  9036.  
  9037.  
  9038.  
  9039.  
  9040.  
  9041.                                                                       137
  9042.  
  9043.  
  9044.  
  9045.  
  9046.  
  9047.  
  9048.  
  9049.      FUNCTION 30   ENABLE/DISABLE OS/E FUNCTION SET FUNCTIONS
  9050.  
  9051.           DISABLE OS/E FUNCTION SET SUBFUNCTION
  9052.  
  9053.           Note...............................................................
  9054.  
  9055.           This function is for use by operating systems only.  The operating
  9056.           system can disable this function at any time.
  9057.  
  9058.           PURPOSE
  9059.  
  9060.           This subfunction provides an OS/E with the ability to disable all
  9061.           programs or device drivers from using the OS/E specific functions.
  9062.           The capability is provided only for an OS/E which manages regions of
  9063.           mappable conventional memory and cannot permit programs to use any of
  9064.           the functions which would affect mappable conventional memory regions.
  9065.           When an OS/E disables these functions and a program attempts to use
  9066.           them, the memory manager returns a status to the program indicating
  9067.           that the OS/E has denied the program access to the function.  In other
  9068.           words, the functions will not work when disabled.
  9069.  
  9070.           The OS/E (Operating System) functions which are disabled by this
  9071.           subfunction are:
  9072.  
  9073.           Function 26.  Get Expanded Memory Hardware Information.
  9074.  
  9075.           Function 28.  Alternate Map Register Sets.
  9076.  
  9077.           Function 30.  Enable/Disable Operating System Functions.
  9078.  
  9079.           CALLING PARAMETERS
  9080.  
  9081.           AX = 5D01h
  9082.                      Contains the Disable OS/E Function Set subfunction.
  9083.  
  9084.           BX,CX = access_key
  9085.                      Required on all function invocations after the first.  The
  9086.                      access_key value returned by the first function invocation
  9087.                      is required.
  9088.  
  9089.           RESULTS
  9090.  
  9091.           These results are valid only if the status returned is zero.
  9092.  
  9093.           BX,CX = access_key
  9094.                      Returned only on the first function invocation, the memory
  9095.                      manager returns a random valued key which will be required
  9096.                      thereafter for the execution of this function.  On all
  9097.                      invocations after the first, this key is not returned.
  9098.                      Neither BX nor CX is affected after the first time this
  9099.                      function is invoked.
  9100.  
  9101.           REGISTERS MODIFIED
  9102.  
  9103.           AX, BX, CX
  9104.  
  9105.           STATUS
  9106.  
  9107.                                                                       138
  9108.  
  9109.  
  9110.  
  9111.  
  9112.  
  9113.  
  9114.  
  9115.           AH = 0     SUCCESSFUL
  9116.                      The operating system function set has been disabled.
  9117.  
  9118.           AH = 80h   NON-RECOVERABLE
  9119.                      The manager detected a malfunction in the memory manager
  9120.                      software.
  9121.  
  9122.           AH = 81h   NON-RECOVERABLE
  9123.                      The manager detected a malfunction in the expanded memory
  9124.                      hardware.
  9125.  
  9126.           AH = 84h   NON-RECOVERABLE
  9127.                      The function code passed to the memory manager is not
  9128.                      defined.
  9129.  
  9130.           AH = 8Fh   NON-RECOVERABLE
  9131.                      The subfunction parameter is invalid.
  9132.  
  9133.           AH = A4h   NON-RECOVERABLE
  9134.                      The operating system has denied access to this function.
  9135.                      The function cannot be used at this time.  The value of the
  9136.                      key which was passed to this function does not entitle the
  9137.                      program to execute this function.
  9138.  
  9139.           EXAMPLE
  9140.  
  9141.           First Function invocation:
  9142.           
  9143.           access_key                         DW 2 DUP (?)
  9144.           
  9145.           MOV  AX, 5D01h                     ; load function code
  9146.           INT  67h                           ; call the memory manager
  9147.           OR   AH, AH                        ; check EMM status
  9148.           JNZ  emm_err_handler               ; jump to error handler on error
  9149.           MOV  access_key[0], BX
  9150.           MOV  access_key[2], CX
  9151.  
  9152.           All invocations after the first:
  9153.           
  9154.           access_key                         DW 2 DUP (?)
  9155.           
  9156.           MOV  BX, access_key[0]
  9157.           MOV  CX, access_key[2]
  9158.           MOV  AX, 5D01h                     ; load function code
  9159.           INT  67h                           ; call the memory manager
  9160.           OR   AH, AH                        ; check EMM status
  9161.           JNZ  emm_err_handler               ; jump to error handler on error
  9162.  
  9163.  
  9164.  
  9165.  
  9166.  
  9167.  
  9168.  
  9169.  
  9170.  
  9171.  
  9172.  
  9173.                                                                       139
  9174.  
  9175.  
  9176.  
  9177.  
  9178.  
  9179.  
  9180.  
  9181.      FUNCTION 30   ENABLE/DISABLE OS/E FUNCTION SET FUNCTIONS
  9182.  
  9183.           RETURN ACCESS KEY SUBFUNCTION
  9184.  
  9185.           Note.............................................................
  9186.  
  9187.           This function is for use by operating systems only.  The operating
  9188.           system can disable this function at any time.
  9189.  
  9190.           PURPOSE
  9191.  
  9192.           This subfunction provides an OS/E with the ability to return the
  9193.           access key to the memory manager.  Returning the access key to the
  9194.           memory manager places the memory manager in the state it is in at
  9195.           installation time (regarding the use of the OS/E function set and the
  9196.           access key).  That is, access to the OS/E function set is enabled.
  9197.           Upon execution of the next enable/disable OS/E function set
  9198.           subfunction, the access key will once again be returned.
  9199.  
  9200.           CALLING PARAMETERS
  9201.  
  9202.           AX = 5D02h
  9203.                      Contains the Return Access Key subfunction.
  9204.  
  9205.           BX,CX = access_key
  9206.                      Required on all function invocations.  The access_key value
  9207.                      returned by the first function invocation of the enable or
  9208.                      disable subfunctions is required.
  9209.  
  9210.           REGISTERS MODIFIED
  9211.  
  9212.           AX
  9213.  
  9214.           STATUS
  9215.  
  9216.           AH = 0     SUCCESSFUL
  9217.                      The access key has been returned to the memory manager.
  9218.  
  9219.           AH = 80h   NON-RECOVERABLE
  9220.                      The manager detected a malfunction in the memory manager
  9221.                      software.
  9222.  
  9223.           AH = 81h   NON-RECOVERABLE
  9224.                      The manager detected a malfunction in the expanded memory
  9225.                      hardware.
  9226.  
  9227.           AH = 84h   NON-RECOVERABLE
  9228.                      The function code passed to the memory manager is not
  9229.                      defined.
  9230.  
  9231.           AH = 8Fh   NON-RECOVERABLE
  9232.                      The subfunction parameter is invalid.
  9233.  
  9234.           AH = A4h   NON-RECOVERABLE
  9235.                      Access to this function has been denied by the operating
  9236.                      system.  The function cannot be used at this time.  The
  9237.  
  9238.  
  9239.                                                                       140
  9240.  
  9241.  
  9242.  
  9243.  
  9244.  
  9245.  
  9246.  
  9247.                      value of the key which was passed to this function does not
  9248.                      entitle the program to execute this function.
  9249.  
  9250.           EXAMPLE
  9251.           
  9252.           access_key                         DW 2 DUP (?)
  9253.           
  9254.           MOV  BX, access_key[0]
  9255.           MOV  CX, access_key[2]
  9256.           MOV  AX, 5D02h                     ; load function code
  9257.           INT  67h                           ; call the memory manager
  9258.           OR   AH, AH                        ; check EMM status
  9259.           JNZ  emm_err_handler               ; jump to error handler on error
  9260.  
  9261.  
  9262.  
  9263.  
  9264.  
  9265.  
  9266.  
  9267.  
  9268.  
  9269.  
  9270.  
  9271.  
  9272.  
  9273.  
  9274.  
  9275.  
  9276.  
  9277.  
  9278.  
  9279.  
  9280.  
  9281.  
  9282.  
  9283.  
  9284.  
  9285.  
  9286.  
  9287.  
  9288.  
  9289.  
  9290.  
  9291.  
  9292.  
  9293.  
  9294.  
  9295.  
  9296.  
  9297.  
  9298.  
  9299.  
  9300.  
  9301.  
  9302.  
  9303.  
  9304.  
  9305.                                                                       141
  9306.  
  9307.  
  9308.  
  9309.  
  9310.  
  9311.  
  9312.  
  9313.      APPENDIX A    FUNCTION AND STATUS CODE CROSS REFERENCE TABLES
  9314.  
  9315.           This appendix contains two cross reference tables: one lists this
  9316.           function codes and the status codes they return; the other lists the
  9317.           status codes and the functions that return them.
  9318.  
  9319.           TABLE A-1.  FUNCTION AND STATUS CODE CROSS REFERENCE
  9320.  
  9321.           ----------------------------------------------------------------------
  9322.           Function   Status       Description
  9323.           ----------------------------------------------------------------------
  9324.  
  9325.           40h   00h 80h 81h 84h   Get memory manager status
  9326.  
  9327.           41h   00h 80h 81h 84h   Get Page Frame Segment Address
  9328.  
  9329.           42h   00h 80h 81h 84h   Get Unallocated Page Count
  9330.  
  9331.           43h   00h 80h 81h 84h   Allocate Pages
  9332.                 85h 87h 88h
  9333.  
  9334.           44h   00h 80h 81h 83h   Map/Unmap Handle Page
  9335.                 84h 8Ah 8Bh
  9336.  
  9337.           45h   00h 80h 81h 83h   Deallocate Pages
  9338.                 84h 86h
  9339.  
  9340.           46h   00h 80h 81h 84h   Get EMM Version
  9341.  
  9342.           47h   00h 80h 81h 83h   Save Page Map
  9343.                 84h 8Ch 8Dh
  9344.  
  9345.           48h   00h 80h 81h 83h   Restore Page Map
  9346.                 84h 8Eh
  9347.  
  9348.           49h                     Reserved
  9349.  
  9350.           4Ah                     Reserved
  9351.  
  9352.           4Bh   00h 80h 81h 84h   Get EMM Handle Count
  9353.  
  9354.           4Ch   00h 80h 81h 83h   Get EMM Handle Pages
  9355.                 84h
  9356.  
  9357.           4Dh   00h 80h 81h 84h   Get All EMM Handle Pages
  9358.  
  9359.           4E00h 00h 80h 81h 84h   Get Page Map
  9360.                 8Fh
  9361.  
  9362.           4E01h 00h 80h 81h 84h   Set Page Map
  9363.                 8Fh A3h
  9364.  
  9365.           4E02h 00h 80h 81h 84h   Get & Set Page Map
  9366.                 8Fh A3h
  9367.  
  9368.           4E03h 00h 80h 81h 84h   Get Size of Page Map Save Array
  9369.                 8Fh
  9370.  
  9371.                                                                       142
  9372.  
  9373.  
  9374.  
  9375.  
  9376.  
  9377.  
  9378.  
  9379.           4F00h 00h 80h 81h 84h   Get Partial Page Map
  9380.                 8Bh 8Fh A3h
  9381.  
  9382.           4F01h 00h 80h 81h 84h   Set Partial Page Map
  9383.                 8Fh A3h
  9384.  
  9385.           4F02h 00h 80h 81h 84h   Get Size of Partial Page Map Array
  9386.                 8Bh 8Fh
  9387.  
  9388.           5000h 00h 80h 81h 83h   Map/Unmap Multiple Handle Pages
  9389.                 84h 8Ah 8Bh 8Fh   (Physical page mode)
  9390.  
  9391.           5001h 00h 80h 81h 83h   Map/Unmap Multiple Handle Pages
  9392.                 84h 8Ah 8Bh 8Fh   (Segment address mode)
  9393.  
  9394.           51h   00h 80h 81h 83h   Reallocate Pages
  9395.                 84h 87h 88h
  9396.  
  9397.           5200h 00h 80h 81h 83h   Get Handle Attribute
  9398.                 84h 8Fh 91h
  9399.  
  9400.           5201h 00h 80h 81h 83h   Set Handle Attribute
  9401.                 84h 8Fh 90h 91h
  9402.  
  9403.           5202h 00h 80h 81h 84h   Get Handle Attribute Capability
  9404.                 8Fh
  9405.  
  9406.           5300h 00h 80h 81h 83h   Get Handle Name
  9407.                 84h 8Fh
  9408.  
  9409.           5301h 00h 80h 81h 83h   Set Handle Name
  9410.                 84h 8FH A1h
  9411.  
  9412.           5400h 00h 80h 81h 84h   Get Handle Directory
  9413.                 8Fh
  9414.  
  9415.           5401h 00h 80h 81h 84h   Search for Named Handle
  9416.                 8Fh A0h A1h
  9417.  
  9418.           5402h 00h 80h 81h 84h   Get Total Handles
  9419.                 8Fh
  9420.  
  9421.           5500h 00h 80h 81h 83h   Alter Page Map & Jump
  9422.                 84h 8Ah 8Bh 8Fh   (Physical page mode)
  9423.  
  9424.           5501h 00h 80h 81h 83h   Alter Page Map & Jump
  9425.                 84h 8Ah 8Bh 8Fh   (Segment address mode)
  9426.  
  9427.           5600h 00h 80h 81h 83h   Alter Page Map & Call
  9428.                 84h 8Ah 8Bh 8Fh   (Physical page mode)
  9429.  
  9430.           5601h 00h 80h 81h 83h   Alter Page Map & Call
  9431.                 84h 8Ah 8Bh 8Fh   (Segment address mode)
  9432.  
  9433.           5602h 00h 80h 81h 84h   Get Alter Page Map & Call Stack Space Size
  9434.                 8Fh
  9435.  
  9436.  
  9437.                                                                       143
  9438.  
  9439.  
  9440.  
  9441.  
  9442.  
  9443.  
  9444.  
  9445.           5700h 00h 80h 81h 83h   Move Memory Region
  9446.                 84h 8Ah 8Fh 92h
  9447.                 93h 94h 95h 96h
  9448.                 98h A2h
  9449.  
  9450.           5701h 00h 80h 81h 83h   Exchange Memory Region
  9451.                 84h 8Ah 8Fh 93h
  9452.                 94h 95h 96h 97h
  9453.                 98h A2h
  9454.  
  9455.           5800h 00h 80h 81h 84h   Get Mappable Physical Address Array
  9456.                 8Fh
  9457.  
  9458.           5801h 00h 80h 81h 84h   Get Mappable Physical Address Array Entries
  9459.                 8Fh
  9460.  
  9461.           5900h 00h 80h 81h 84h   Get Expanded Memory Hardware Information
  9462.                 8Fh A4h
  9463.  
  9464.           5901h 00h 80h 81h 84h   Get Unallocated Raw Page Count
  9465.                 8Fh
  9466.  
  9467.           5A00h 00h 80h 81h 84h   Allocate Standard Pages
  9468.                 85h 87h 88h 8Fh
  9469.  
  9470.           5A01h 00h 80h 81h 84h   Allocate Raw Pages
  9471.                 85h 87h 88h 8Fh
  9472.  
  9473.           5B00h 00h 80h 81h 84h   Get Alternate Map Register Set
  9474.                 8Fh A4h
  9475.  
  9476.           5B01h 00h 80h 81h 84h   Set Alternate Map Register Set
  9477.                 8Fh 9Ah 9Ch 9Dh
  9478.                 A3h A4h
  9479.  
  9480.           5B02h 00h 80h 81h 84h   Get Alternate Map Save Array Size
  9481.                 8Fh A4h
  9482.  
  9483.           5B03h 00h 80h 81h 84h   Allocate Alternate Map Register Set
  9484.                 8Fh 9Bh A4h
  9485.  
  9486.           5B04h 00h 80h 81h 84h   Deallocate Alternate Map Register Set
  9487.                 8Fh 9Ch 9Dh A4h
  9488.  
  9489.           5B05h 00h 80h 81h 84h   Allocate DMA Register Set
  9490.                 8Fh 9Bh A4h
  9491.  
  9492.           5B06h 00h 80h 81h 84h   Enable DMA on Alternate Map Register Set
  9493.                 8Fh 9Ah 9Ch 9Dh
  9494.                 9Eh 9Fh A4h
  9495.  
  9496.           5B07h 00h 80h 81h 84h   Disable DMA on Alternate Map Register Set
  9497.                 8Fh 9Ah 9Ch 9Dh
  9498.                 9Eh 9Fh A4h
  9499.  
  9500.           5B08h 00h 80h 81h 84h   Deallocate DMA Register Set
  9501.                 8Fh 9Ch 9Dh A4h
  9502.  
  9503.                                                                       144
  9504.  
  9505.  
  9506.  
  9507.  
  9508.  
  9509.  
  9510.  
  9511.           5Ch   00h 80h 81h 84h   Prepare Expanded Memory Hardware for
  9512.                                   Warmboot
  9513.  
  9514.           5D00h 00h 80h 81h 84h   Enable Operating System Function Set
  9515.                 8Fh A4h
  9516.  
  9517.           5D01h 00h 80h 81h 84h   Disable Operating System Function Set
  9518.                 8Fh A4h
  9519.  
  9520.           5D02h 00h 80h 81h 84h   Return Operating System Access Key
  9521.                 8Fh A4h
  9522.  
  9523.  
  9524.  
  9525.  
  9526.  
  9527.  
  9528.  
  9529.  
  9530.  
  9531.  
  9532.  
  9533.  
  9534.  
  9535.  
  9536.  
  9537.  
  9538.  
  9539.  
  9540.  
  9541.  
  9542.  
  9543.  
  9544.  
  9545.  
  9546.  
  9547.  
  9548.  
  9549.  
  9550.  
  9551.  
  9552.  
  9553.  
  9554.  
  9555.  
  9556.  
  9557.  
  9558.  
  9559.  
  9560.  
  9561.  
  9562.  
  9563.  
  9564.  
  9565.  
  9566.  
  9567.  
  9568.  
  9569.                                                                       145
  9570.  
  9571.  
  9572.  
  9573.  
  9574.  
  9575.  
  9576.  
  9577.           TABLE A-2.  STATUS AND FUNCTION CODE CROSS REFERENCE
  9578.  
  9579.           ----------------------------------------------------------------------
  9580.           Status     Functions            Description
  9581.           ----------------------------------------------------------------------
  9582.  
  9583.           00h   All                       The function completed normally.
  9584.  
  9585.           80h   All                       The memory manager has detected a
  9586.                                           malfunction in the expanded memory
  9587.                                           software.
  9588.  
  9589.           81h   All                       The memory manager has detected a
  9590.                                           malfunction in the expanded memory
  9591.                                           hardware.
  9592.  
  9593.           82h   None                      This error code is not returned in
  9594.                                           version 3.2 of the memory manager
  9595.                                           or above.  In earlier versions of
  9596.                                           the memory manager this code meant
  9597.                                           a "busy" status.  This status
  9598.                                           indicated that the memory manager
  9599.                                           was already processing an expanded
  9600.                                           memory request when the current
  9601.                                           request was made and is unable to
  9602.                                           process another request.  In
  9603.                                           versions 3.2 of the memory manager
  9604.                                           and above, the memory manager is
  9605.                                           never "busy" and can always honor
  9606.                                           requests.
  9607.  
  9608.           83h   44h   45h   47h   48h     The memory manager can not find
  9609.                 4Ch   5000h 5001h 51h     the handle specified.
  9610.                 5200h 5201h 5300h 5301h
  9611.                 5500h 5501h 5600h 5601h
  9612.                 5700h 5701h
  9613.  
  9614.           84h   All                       The function code passed to the
  9615.                                           manager is not currently defined.
  9616.  
  9617.           85h   43h   5A00h 5A01h         No handles are currently available.
  9618.                                           All assignable handles are
  9619.                                           currently in use.
  9620.  
  9621.           86h   45h                       A mapping context restoration error
  9622.                                           has been detected.  This error
  9623.                                           occurs when a program attempts to
  9624.                                           return a handle and there is still
  9625.                                           a "mapping context" on the context
  9626.                                           stack for the indicated handle.
  9627.  
  9628.           87h   43h   51h   5A00h 5A01h   The number of total pages that are
  9629.                                           available in the system is
  9630.                                           insufficient to honor the request.
  9631.  
  9632.  
  9633.  
  9634.  
  9635.                                                                       146
  9636.  
  9637.  
  9638.  
  9639.  
  9640.  
  9641.  
  9642.  
  9643.           88h   43h   51h   5A00h 5A01h   The number of unallocated pages
  9644.                                           currently available is insufficient
  9645.                                           to honor the allocation request.
  9646.  
  9647.           89h   43h                       Zero pages could not be assigned to
  9648.                                           a handle.
  9649.  
  9650.           8Ah   44h   5000h 5001h 5500h   The logical page to map into memory
  9651.                 5501h 5600h 5601h 5700h   is out of the range of logical
  9652.                 5701h                     pages which are allocated to the
  9653.                                           handle.
  9654.  
  9655.           8Bh   44h   4F00h 4F02h 5000h   One or more of the physical pages
  9656.                 5001h 5600h 5601h 5500h   is out of the range of allowable
  9657.                 5501h                     physical pages.
  9658.  
  9659.           8Ch   47h                       The mapping register context save
  9660.                                           area is full.
  9661.  
  9662.           8Dh   47h                       The mapping register context stack
  9663.                                           already has a context associated
  9664.                                           with the handle.  The program has
  9665.                                           attempted to save the mapping
  9666.                                           register context when there was
  9667.                                           already a context for the handle on
  9668.                                           the stack.
  9669.  
  9670.           8Eh   48h                       The mapping register context stack
  9671.                                           does not have a context associated
  9672.                                           with the handle.  The program has
  9673.                                           attempted to restore the mapping
  9674.                                           register context when there was no
  9675.                                           context for the handle on the
  9676.                                           stack.
  9677.  
  9678.           8Fh   All                       The subfunction parameter passed to
  9679.                                           the function requiring a
  9680.                                           subfunction code is not defined.
  9681.  
  9682.           90h   5201h                     The attribute type is undefined.
  9683.  
  9684.           91h   5200h 5201h               The system configuration does not
  9685.                                           support non-volatility.
  9686.  
  9687.           92h    5700h                    The source and destination expanded
  9688.                                           memory regions have the same handle
  9689.                                           and overlap.  This is valid for a
  9690.                                           move.  The move has been completed
  9691.                                           and the destination region has a
  9692.                                           full copy of the source region.
  9693.                                           However, at least a portion of the
  9694.                                           source region has been overwritten
  9695.                                           by the move.
  9696.  
  9697.           93h   5700h 5701h               The length of the specified source
  9698.                                           or destination expanded memory
  9699.                                           region exceeds the length of the
  9700.  
  9701.                                                                       147
  9702.  
  9703.  
  9704.  
  9705.  
  9706.  
  9707.  
  9708.  
  9709.                                           expanded memory region allocated to
  9710.                                           the specified source or destination
  9711.                                           handle.  There are insufficient
  9712.                                           pages allocated to this handle to
  9713.                                           move/exchange a region of the size
  9714.                                           specified.
  9715.  
  9716.           94h   5700h 5701h               The conventional memory region and
  9717.                                           expanded memory region overlap.
  9718.                                           This is invalid, the conventional
  9719.                                           memory region cannot overlap the
  9720.                                           expanded memory region.
  9721.  
  9722.           95h   5700h 5701h               The offset within the logical page
  9723.                                           exceeds the length of the logical
  9724.                                           page.  The initial source or
  9725.                                           destination offsets within an
  9726.                                           expanded memory region must be
  9727.                                           between 0 and the (length of a
  9728.                                           logical page - 1) or 16383 (3FFFh).
  9729.  
  9730.           96h   5700h 5701h               Region length exceeds 1M-byte
  9731.                                           limit.
  9732.  
  9733.           97h   5701h                     The source and destination expanded
  9734.                                           memory regions have the SAME handle
  9735.                                           AND overlap.  This is invalid; the
  9736.                                           source and destination expanded
  9737.                                           memory regions cannot have the same
  9738.                                           handle and overlap when they are
  9739.                                           being exchanged.
  9740.  
  9741.           98h   5700h 5701h               The memory source and destination
  9742.                                           types are undefined/not supported.
  9743.  
  9744.           9Ah   5B01h 5B06h 5B07h         Alternate map register sets are
  9745.                                           supported, but the alternate map
  9746.                                           register set specified is not
  9747.                                           supported.
  9748.  
  9749.           9Bh   5B03h 5B05h               Alternate map/DMA register sets are
  9750.                                           supported.  However, all alternate
  9751.                                           map/DMA register sets are currently
  9752.                                           allocated.
  9753.  
  9754.           9Ch   5B01h 5B04h 5B06h 5B07h   Alternate map/DMA register sets are
  9755.                 5B08h                     not supported, and the alternate
  9756.                                           map/DMA register set specified is
  9757.                                           not zero.
  9758.  
  9759.           9Dh   5B01h 5B04h 5B06h 5B07h   Alternate map/DMA register sets are
  9760.                 5B08h                     supported, but the alternate map
  9761.                                           register set specified is not
  9762.                                           defined, not allocated, or is the
  9763.                                           currently allocated map register
  9764.                                           set.
  9765.  
  9766.  
  9767.                                                                       148
  9768.  
  9769.  
  9770.  
  9771.  
  9772.  
  9773.  
  9774.  
  9775.           9Eh   5B06h 5B07h               Dedicated DMA channels are not
  9776.                                           supported.
  9777.  
  9778.           9Fh   5B06h 5B07h               Dedicated DMA channels are
  9779.                                           supported.  But the DMA channel
  9780.                                           specified is not supported.
  9781.  
  9782.           A0h   5401h                     No corresponding handle value could
  9783.                                           be found for the handle name
  9784.                                           specified.
  9785.  
  9786.           A1h   5301h 5401h               A handle with this name already
  9787.                                           exists.  The specified handle was
  9788.                                           not assigned a name.
  9789.  
  9790.           A2h   5700h 5701h               An attempt was made to "wrap
  9791.                                           around" the 1M-byte address space
  9792.                                           during the move/exchange.  The
  9793.                                           source starting address together
  9794.                                           with the length of the region to be
  9795.                                           moved/exchanged exceeds 1M-byte.  No
  9796.                                           data was moved/exchanged.
  9797.  
  9798.           A3h   4E01h 4E02h 4F00h 4F01h   The contents of the data  structure
  9799.                 5B01h                     passed to the function have either
  9800.                                           been corrupted or are meaningless.
  9801.  
  9802.           A4h   5900h 5B00h 5B01h 5B02h   The operating system has denied
  9803.                 5B03h 5B04h 5B05h 5B06h   access to this function.  The
  9804.                 5B07h 5B08h 5D00h 5D01h   function cannot be used at this
  9805.                 5D02h                     time.
  9806.  
  9807.  
  9808.  
  9809.  
  9810.  
  9811.  
  9812.  
  9813.  
  9814.  
  9815.  
  9816.  
  9817.  
  9818.  
  9819.  
  9820.  
  9821.  
  9822.  
  9823.  
  9824.  
  9825.  
  9826.  
  9827.  
  9828.  
  9829.  
  9830.  
  9831.  
  9832.  
  9833.                                                                       149
  9834.  
  9835.  
  9836.  
  9837.  
  9838.  
  9839.  
  9840.  
  9841.      APPENDIX B
  9842.  
  9843.           TESTING FOR THE PRESENCE OF THE EXPANDED MEMORY MANAGER
  9844.  
  9845.           Before an application program can use the Expanded Memory Manager, it
  9846.           must determine whether DOS has loaded the manager.  This appendix
  9847.           describes two methods your program can use to test for the presence of
  9848.           the memory manager and how to choose the correct one for your
  9849.           situation.
  9850.  
  9851.           The first method uses the DOS "open handle" technique; the second
  9852.           method uses the DOS "get interrupt vector" technique.
  9853.  
  9854.           WHICH METHOD SHOULD YOUR PROGRAM USE?
  9855.  
  9856.           The majority of application programs can use either the "open handle"
  9857.           or the "get interrupt vector" method.  However, if your program is a
  9858.           device driver or if it interrupts DOS during file system operations,
  9859.           you must use only the "get interrupt vector" method.
  9860.  
  9861.           Device drivers execute from within DOS and can't access the DOS file
  9862.           system; programs that interrupt DOS during file system operations have
  9863.           a similar restriction.  During their interrupt processing procedures,
  9864.           they can't access the DOS file system because another program may be
  9865.           using the system.
  9866.  
  9867.           Since the "get interrupt vector" method doesn't require the DOS file
  9868.           system, you must use it for these types of programs.
  9869.  
  9870.           THE "OPEN HANDLE" TECHNIQUE
  9871.  
  9872.           Most application programs can use the DOS "open handle" technique to
  9873.           test for the presence of the memory manager.  This section describes
  9874.           how to use the technique and gives an example.
  9875.  
  9876.           Caution..........................................................
  9877.  
  9878.           Don't use this technique if your program is a device driver or if it
  9879.           interrupts DOS during file system operations.  Use the "get interrupt
  9880.           vector" technique described later in this chapter.
  9881.  
  9882.           USING THE "OPEN HANDLE" TECHNIQUE
  9883.  
  9884.           This section describes how to use the DOS "open handle" technique to
  9885.           test for the presence of the memory manager. Follow these steps in
  9886.           order:
  9887.  
  9888.           1.  Issue an "open handle" command (DOS function 3Dh) in "read only"
  9889.               access mode (register AL = 0).  This function requires your
  9890.               program to point to an ASCII string which contains the path name
  9891.               of the file or device in which you're interested (register set
  9892.               DS:DX contains the pointer).  In this case the file is actually
  9893.               the name of the memory manager.
  9894.  
  9895.               You should format the ASCII string as follows:
  9896.  
  9897.               ASCII_device_name   DB   "EMMXXXX0", 0
  9898.  
  9899.                                                                       150
  9900.  
  9901.  
  9902.  
  9903.  
  9904.  
  9905.  
  9906.  
  9907.               The ASCII codes for the capital letters EMMXXXX0 are terminated by
  9908.               a byte containing a value of zero.
  9909.  
  9910.           2.  If DOS returns no error status code, skip Steps 3 and 4 and go to
  9911.               Step 5.  If DOS returns a "Too many open files" error status code,
  9912.               go to Step 3. If DOS returns a "File/Path not found" error status
  9913.               code, skip Step 3 and go to Step 4.
  9914.  
  9915.           3.  If DOS returns a "Too many open files" (not enough handles),
  9916.               status code, your program should invoke the "open file" command
  9917.               before it opens any other files.  This will guarantee that at
  9918.               least one file handle will be available to perform the function
  9919.               without causing this error.
  9920.  
  9921.               After the program performs the "open file" command, it should
  9922.               perform the test described in Step 6 and close the "file handle"
  9923.               (DOS function 3Eh).  Don't keep the manager "open" after this
  9924.               status test is performed since "manager" functions are not
  9925.               available thru DOS.  Go to Step 6.
  9926.  
  9927.           4.  If DOS returns a "File/Path not found", the memory manager is not
  9928.               installed.  If your application requires the memory manager, the
  9929.               user will have to reboot the system with a disk containing the
  9930.               memory manager and the appropriate CONFIG.SYS file before
  9931.               proceeding.
  9932.  
  9933.           5.  If DOS doesn't return an error status code you can assume that
  9934.               either a device with the name EMMXXXX0 is resident in the system,
  9935.               or a file with this name is on disk in the current disk drive.  Go
  9936.               to Step 6.
  9937.  
  9938.           6.  Issue an "I/O Control for Devices" command (DOS function 44h) with
  9939.               a "get device information" command (register AL = 0h).  DOS
  9940.               function 44h determines whether EMMXXXX0 is a device or a file.
  9941.  
  9942.               You must use the file handle (register BX) which you obtained in
  9943.               Step 1 to access the "EMM" device.  This function returns the
  9944.               "device information" in a word (register DX).  Go to step 7.
  9945.  
  9946.           7.  If DOS returns any error status code, you should assume that the
  9947.               memory manager device driver is not installed.  If your
  9948.               application requires the memory manager, the user will have to
  9949.               reboot the system with a disk containing the memory manager and
  9950.               the appropriate CONFIG.SYS file before proceeding.
  9951.  
  9952.           8.  If DOS didn't return an error status, test the contents of bit 7
  9953.               (counting from 0) of the "device information" word (register DX)
  9954.               the function returned.  Go to Step 9.
  9955.  
  9956.           9.  If bit 7 of the "device information" word contains a zero, then
  9957.               EMMXXXX0 is a file, and the memory manager device driver is not
  9958.               present.  If your application requires its presence, the user will
  9959.               have to reboot the system with a disk containing the memory
  9960.               manager and the appropriate CONFIG.SYS file before proceeding.  If
  9961.               bit 7 contains a one, then EMMXXXX0 is a device. Go to Step 10.
  9962.  
  9963.  
  9964.  
  9965.                                                                       151
  9966.  
  9967.  
  9968.  
  9969.  
  9970.  
  9971.  
  9972.  
  9973.           10. Issue an "I/O Control for Devices" command (DOS function 44h) with
  9974.               a "get output status" command (register AL = 7h).
  9975.  
  9976.               You must use the file handle you obtained in Step 1 to access the
  9977.               "EMM" device (register BX).  Go to Step 11.
  9978.  
  9979.           11. If the expanded memory device driver is "ready," the memory
  9980.               manager passes a status value of "0FFh" in register AL.  The
  9981.               status value is "00h" if the device driver is "not ready."
  9982.  
  9983.               If the memory manager device driver is "not ready" and your
  9984.               application requires its presence, the user will have to reboot
  9985.               the system with a disk containing the memory manager and the
  9986.               appropriate CONFIG.SYS file before proceeding.
  9987.  
  9988.               If the memory manager device driver is "ready", go to Step 12.
  9989.  
  9990.           12. Issue a "Close File Handle" command (DOS function 3Eh) to close
  9991.               the expanded memory device driver.  You must use the file handle
  9992.               you obtained in Step 1 to close the "EMM" device (register BX)
  9993.  
  9994.           AN EXAMPLE OF THE "OPEN HANDLE" TECHNIQUE
  9995.  
  9996.           The following procedure is an example of the "open handle" technique
  9997.           outlined in the previous section.
  9998.  
  9999.           ;---------------------------------------------------------------;
  10000.           ;   The following procedure tests for the presence of the EMM   ;
  10001.           ;   in the system.  It returns the CARRY FLAG SET if the EMM is ;
  10002.           ;   present.  If the EMM is not present, this procedure returns ;
  10003.           ;   the CARRY FLAG CLEAR.                                       ;
  10004.           ;---------------------------------------------------------------;
  10005.           
  10006.           first_test_for_EMM  PROC  NEAR
  10007.           
  10008.           PUSH DS
  10009.           PUSH CS
  10010.           POP  DS
  10011.           MOV  AX, 3D00h                     ; issue device open in
  10012.           LEA  DX, ASCII_device_name         ; read only mode
  10013.           INT  21h
  10014.           JC   first_test_for_EMM_error_exit ; test for error during open
  10015.           
  10016.           MOV  BX, AX                        ; get file handle returned by DOS
  10017.           MOV  AX, 4400h                     ; issue IOCTL get device info
  10018.           INT  21h
  10019.           JC   first_test_for_EMM_err_exit   ; test for get device info error
  10020.           
  10021.           TEST DX, 0080h                     ; test to determine
  10022.           JZ   first_test_for_EMM_err_exit   ; if ASCII_device_name
  10023.                                              ; is a device or a file
  10024.           MOV  AX, 4407h                     ; issue "IOCTL"
  10025.           INT  21h
  10026.           JC   first_test_for_EMM_error_exit ; test for IOCTL error
  10027.           PUSH AX                            ; save "IOCTL" status
  10028.           MOV  AH, 3Eh                       ; issue "close
  10029.           INT  21h                           ; file handle"
  10030.  
  10031.                                                                       152
  10032.  
  10033.  
  10034.  
  10035.  
  10036.  
  10037.  
  10038.  
  10039.           POP  AX                            ; restore "IOCTL" status
  10040.           CMP  AL, 0FFh                      ; test for "device ready" status
  10041.           JNE  first_test_for_EMM_error_exit ; returned by the driver
  10042.           first_test_for_EMM_exit:
  10043.           
  10044.           POP  DS                            ; EMM is present in the system
  10045.           STC
  10046.           RET
  10047.           
  10048.           first_test_for_EMM_error_exit:
  10049.           
  10050.           POP  DS                            ; EMM is NOT present in the system
  10051.           CLC
  10052.           RET
  10053.           
  10054.           ASCII_device_name                  DB  "EMMXXXX0", 0
  10055.           
  10056.           first_test_for_EMM ENDP
  10057.  
  10058.  
  10059.  
  10060.  
  10061.  
  10062.  
  10063.  
  10064.  
  10065.  
  10066.  
  10067.  
  10068.  
  10069.  
  10070.  
  10071.  
  10072.  
  10073.  
  10074.  
  10075.  
  10076.  
  10077.  
  10078.  
  10079.  
  10080.  
  10081.  
  10082.  
  10083.  
  10084.  
  10085.  
  10086.  
  10087.  
  10088.  
  10089.  
  10090.  
  10091.  
  10092.  
  10093.  
  10094.  
  10095.  
  10096.  
  10097.                                                                       153
  10098.  
  10099.  
  10100.  
  10101.  
  10102.  
  10103.  
  10104.  
  10105.           THE "GET INTERRUPT VECTOR" TECHNIQUE
  10106.  
  10107.           Any type of program can use the DOS "get interrupt vector" technique
  10108.           to test for the presence of the memory manager.  This section
  10109.           describes how to use the technique and gives an example.
  10110.  
  10111.           Caution..........................................................
  10112.  
  10113.           Be sure to use this technique (and not the "open handle technique) if
  10114.           your program is a device driver or if it interrupts DOS during file
  10115.           system operations.
  10116.  
  10117.           USING THE "GET INTERRUPT VECTOR" TECHNIQUE
  10118.  
  10119.           This section describes how to use the DOS "get interrupt vector"
  10120.           technique to test for the presence of the memory manager.  Follow
  10121.           these steps in order:
  10122.  
  10123.           1.  Issue a "get vector" command (DOS function 35h) to obtain the
  10124.               contents of interrupt vector array entry number 67h (addresses
  10125.               0000:019C thru 0000:019F).
  10126.  
  10127.               The memory manager uses this interrupt vector to perform all
  10128.               manager functions.  The Offset portion of this interrupt service
  10129.               routine address is stored in the word located at address
  10130.               0000:019Ch;  the Segment portion is stored in the word located at
  10131.               address 0000:019Eh.
  10132.  
  10133.           2.  Compare the "device name field" with the contents of the ASCII
  10134.               string which starts at the address specified by the segment
  10135.               portion of the contents of interrupt vector address 67h and a
  10136.               fixed offset of 000Ah.  If DOS loaded the memory manager at boot
  10137.               time this name field will have the name of the device in it.
  10138.  
  10139.               Since the memory manager is implemented as a character device
  10140.               driver, its program origin is 0000h.  Device drivers are required
  10141.               to have a "device header" located at the program origin.  Within
  10142.               the "device header" is an 8 byte "device name field."  For a
  10143.               character mode device driver this name field is always located at
  10144.               offset 000Ah within the device header.  The device name field
  10145.               contains the name of the device which DOS uses when it references
  10146.               the device.
  10147.  
  10148.               If the result of the "string compare" in this technique is
  10149.               positive, the memory manager driver is present.
  10150.  
  10151.           AN EXAMPLE OF THE "GET INTERRUPT VECTOR" TECHNIQUE
  10152.  
  10153.           The following procedure is an example of the "get interrupt vector"
  10154.           technique outlined in the previous section.
  10155.  
  10156.           ;---------------------------------------------------------------;
  10157.           ;   The following procedure tests for the presence of the EMM   ;
  10158.           ;   in the system.  It returns the CARRY FLAG SET if the EMM is ;
  10159.           ;   present.  If the EMM is not present, this procedure returns ;
  10160.           ;    the CARRY FLAG CLEAR.                                      ;
  10161.           ;---------------------------------------------------------------;
  10162.  
  10163.                                                                       154
  10164.  
  10165.  
  10166.  
  10167.  
  10168.  
  10169.  
  10170.  
  10171.           
  10172.           second_test_for_EMM                PROC    NEAR
  10173.           
  10174.           PUSH DS
  10175.           PUSH CS
  10176.           POP  DS
  10177.           MOV  AX, 3567h                     ; issue "get interrupt vector"
  10178.           INT  21h
  10179.           MOV  DI, 000Ah                     ; use the SEGMENT in ES returned by
  10180.                                              ; DOS, place the "device name
  10181.                                              ; field" OFFSET in DI
  10182.           LEA  SI, ASCII_device_name         ; place the OFFSET of the device
  10183.                                              ; name string in SI, the SEGMENT
  10184.                                              ; is already in DS
  10185.           MOV  CX, 8                         ; compare the name strings
  10186.           CLD
  10187.           REPE CMPSB
  10188.           JNE  second_test_for_EMM_error_exit
  10189.           
  10190.           second_test_for_EMM_exit:
  10191.           
  10192.           POP  DS                            ; EMM is present in the system
  10193.           STC
  10194.           RET
  10195.           
  10196.           second_test_for_EMM_error_exit:
  10197.           
  10198.           POP  DS                            ; EMM is NOT present in the system
  10199.           CLC
  10200.           RET
  10201.           
  10202.           ASCII_device_name                  DB "EMMXXXX0"
  10203.           
  10204.           second_test_for_EMM                ENDP
  10205.  
  10206.  
  10207.  
  10208.  
  10209.  
  10210.  
  10211.  
  10212.  
  10213.  
  10214.  
  10215.  
  10216.  
  10217.  
  10218.  
  10219.  
  10220.  
  10221.  
  10222.  
  10223.  
  10224.  
  10225.  
  10226.  
  10227.  
  10228.  
  10229.                                                                       155
  10230.  
  10231.  
  10232.  
  10233.  
  10234.  
  10235.  
  10236.  
  10237.      APPENDIX C
  10238.  
  10239.           EXPANDED MEMORY MANAGER IMPLEMENTATION GUIDELINES
  10240.  
  10241.           
  10242.           In addition to the functional specification, the expanded memory
  10243.           manager should provide certain resources.  The following guidelines
  10244.           are provided so required resources are present in expanded memory
  10245.           managers which comply with this version of the LIM specification.
  10246.  
  10247.           o   The amount of expanded memory supported:
  10248.  
  10249.               Up to a maximum of 32M bytes of expanded memory should be
  10250.               supported.
  10251.  
  10252.           o   The number of handles supported:
  10253.  
  10254.               The maximum number expanded memory handles provided should be 255,
  10255.               the minimum should be 64.
  10256.  
  10257.           o   Handle Numbering:
  10258.  
  10259.               Although a handle is a word quantity, there is a maximum of 255
  10260.               handles, including the operating system handle.  This
  10261.               specification defines the handle word as follows: the low byte of
  10262.               the word is the actual handle value, the high byte of the handle
  10263.               is set to 00 by the memory manager.  Previous versions of this
  10264.               specification did not specify the value of handles.
  10265.  
  10266.           o   New handle type: Handles versus Raw Handles:
  10267.  
  10268.               The difference between a raw handle and a regular handle is
  10269.               slight. If you use Function 27 to "Allocate raw pages to a
  10270.               handle", what is returned in DX is termed a raw handle. The raw
  10271.               handle does not necessarily refer to 16 Kbyte pages. Instead it
  10272.               refers to the "raw" page size, which depends on the expanded
  10273.               memory hardware.
  10274.  
  10275.               An application program can use Function 26 to find the raw page
  10276.               size, and by using the raw handle Function 27 returns, it can
  10277.               access them with the finer resolution that a particular expanded
  10278.               memory board may allow.
  10279.  
  10280.               On the other hand, applications which use Function 4 to "allocate
  10281.               pages to handle" receive a handle which always refers to 16K-byte
  10282.               pages. On expanded memory boards with smaller raw pages, the EMM
  10283.               driver will allocate and maintain the number of raw pages it takes
  10284.               to create a single composite 16K-byte page.  The difference
  10285.               between the expanded memory boards raw page size and the 16K-byte
  10286.               LIM page size is transparent to the application when it is using a
  10287.               handle obtained with Function 4.
  10288.  
  10289.               The memory manager must differentiate between pages allocated to
  10290.               handles and pages allocated to raw handles.  The meaning of a call
  10291.               to the driver changes depending on whether a handle or a raw
  10292.               handle is passed to the memory manager. If, for example, a handle
  10293.               is passed to Function 18 (Reallocate), the memory manager will
  10294.  
  10295.                                                                       156
  10296.  
  10297.  
  10298.  
  10299.  
  10300.  
  10301.  
  10302.  
  10303.               increase or decrease the number of 16K-byte pages allocated to the
  10304.               handle.  If Function 18 is passed a raw handle, the memory manager
  10305.               will increase or decrease the number of raw (non-16K-byte) pages
  10306.               allocated to the raw handle.  For LIM standard boards, there is no
  10307.               difference between pages and raw pages.
  10308.  
  10309.           o   The system Raw Handle (Raw Handle = 0000):
  10310.  
  10311.               For expanded memory boards that can remap the memory in the lower
  10312.               640K-byte address space, managing the pages of memory which are
  10313.               used to fill in the lower 640K can be a problem.  To solve this
  10314.               problem, the memory manager will create a raw handle with a value
  10315.               of 0000 when DOS loads the manager.  This raw handle is called the
  10316.               system handle.
  10317.  
  10318.               At power up, the memory manager will allocate all of the pages
  10319.               that are mapped into the lower 640K bytes to the system handle.
  10320.               These pages should be mapped in their logical order.  For example,
  10321.               if the system board supplies 256K bytes of RAM, and the 384K bytes
  10322.               above it is mappable, the system handle should have its logical
  10323.               page zero mapped into the first physical page at 256K, its logical
  10324.               page one mapped into the next physical page, and so on.
  10325.  
  10326.               The system handle should deal with raw pages.  To release some of
  10327.               these pages so application programs can use them, an operating
  10328.               system could decrease the number of pages allocated to the system
  10329.               handle with the "Reallocate" function.  Invoking the "Deallocate"
  10330.               function would decrease the system handle to zero size, but it
  10331.               must not deallocate the raw handle itself.  The "Deallocate"
  10332.               function treats the system handle differently than it treats other
  10333.               raw handles.  If the operating system can ever be "exited" (for
  10334.               example, the way Windows can be exited), it must increase the size
  10335.               of the system handle back to what is needed to fill 640K and map
  10336.               these logical pages back into physical memory before returning to
  10337.               DOS.
  10338.  
  10339.  
  10340.  
  10341.  
  10342.  
  10343.  
  10344.  
  10345.  
  10346.  
  10347.  
  10348.  
  10349.  
  10350.  
  10351.  
  10352.  
  10353.  
  10354.  
  10355.  
  10356.  
  10357.  
  10358.  
  10359.  
  10360.  
  10361.                                                                       157
  10362.  
  10363.  
  10364.  
  10365.  
  10366.  
  10367.  
  10368.  
  10369.               There are two functional special cases for this handle:
  10370.  
  10371.               -  The first special case deals with Function 4 (Allocate
  10372.                  Pages).  This function must never return zero as a handle
  10373.                  value.  Applications must always invoke Function 4 to
  10374.                  allocate pages and obtain a handle which identifies its
  10375.                  pages.  Since Function 4 will never return a handle value
  10376.                  of zero, an application will never gain access to this
  10377.                  special handle.
  10378.  
  10379.               -  The second special case deals with Function 6 (Deallocate
  10380.                  Pages). If the operating system uses Function 6 to
  10381.                  deallocate the pages which are allocated to the system
  10382.                  handle, the pages will be returned to the manager for use,
  10383.                  but the handle will not be available for reassignment.
  10384.                  The manager should treat a "deallocate pages" function
  10385.                  request for this handle the same as a "reallocate pages"
  10386.                  function request, where the number of pages to reallocate
  10387.                  to this handle is zero.
  10388.  
  10389.           o   Terminate and Stay Resident (TSR) Program Cooperation In order for
  10390.               TSR's to cooperate with each other and with other applications,
  10391.               TSR's must follow this rule:  a program may only remap the DOS
  10392.               partition it lives in.
  10393.  
  10394.               This rule applies at all times, even when no expanded memory is
  10395.               present.
  10396.  
  10397.           o   Accelerator Cards: To support generic accelerator cards, the
  10398.               support of Function 34, as defined by AST, is encouraged.
  10399.  
  10400.  
  10401.  
  10402.  
  10403.  
  10404.  
  10405.  
  10406.  
  10407.  
  10408.  
  10409.  
  10410.  
  10411.  
  10412.  
  10413.  
  10414.  
  10415.  
  10416.  
  10417.  
  10418.  
  10419.  
  10420.  
  10421.  
  10422.  
  10423.  
  10424.  
  10425.  
  10426.  
  10427.                                                                       158
  10428.  
  10429.  
  10430.  
  10431.  
  10432.  
  10433.  
  10434.  
  10435.      APPENDIX D
  10436.  
  10437.           OPERATING SYSTEM/ENVIRONMENT USE OF FUNCTION 28
  10438.  
  10439.           All expanded memory boards have a set of registers that "remember" the
  10440.           logical to physical page mappings.  Some boards have extra (or
  10441.           alternate) sets of these mapping registers.  Because no expanded
  10442.           memory board can supply an infinite number of alternate map register
  10443.           sets, this specification provides a way to simulate them using
  10444.           Function 28 (Alternate Map Register Set).
  10445.  
  10446.           EXAMPLES
  10447.  
  10448.           For the examples in this section, assume the hardware supports
  10449.           alternate map register sets.  First Windows is brought up, then
  10450.           "Reversi" is started.  Then control is switched back to the MS-DOS
  10451.           Executive.  For this procedure, here are the calls to the expanded
  10452.           memory manager:
  10453.  
  10454.           EXAMPLE 1
  10455.  
  10456.           Allocate alt reg set               ; Start up the MS-DOS
  10457.           (for the MS-DOS executive)         ; Executive
  10458.  
  10459.           Set alt reg set
  10460.           (for MS-DOS Executive)
  10461.  
  10462.           Allocate alt reg set               ; Start up Reversi
  10463.           (for Reversi)
  10464.  
  10465.           Set alt reg set
  10466.           (for Reversi)
  10467.  
  10468.           Map pages
  10469.           (for Reversi)
  10470.  
  10471.           Set alt reg set                    ; Switch back to MS-DOS
  10472.           (for MS-DOS Executive)             ; Executive
  10473.  
  10474.           Notice this procedure needed no "get" calls because the register set
  10475.           contained all the information needed to save a context.  However,
  10476.           using "Get" calls would have no ill effects.
  10477.  
  10478.  
  10479.  
  10480.  
  10481.  
  10482.  
  10483.  
  10484.  
  10485.  
  10486.  
  10487.  
  10488.  
  10489.  
  10490.  
  10491.  
  10492.  
  10493.                                                                       159
  10494.  
  10495.  
  10496.  
  10497.  
  10498.  
  10499.  
  10500.  
  10501.           EXAMPLE 2
  10502.  
  10503.           Allocate alt reg set               ; Start up MS-DOS
  10504.           (for MS-DOS Executive)             ; Executive
  10505.  
  10506.           Set alt reg set
  10507.           (for MS-DOS Executive)
  10508.  
  10509.           Get alt reg set
  10510.           (for MS-DOS Executive)
  10511.  
  10512.           Allocate alt reg set               ; Start up Reversi
  10513.           (for Reversi)
  10514.  
  10515.           Set alt reg set
  10516.           (for Reversi)
  10517.  
  10518.           Map pages
  10519.           (for Reversi)
  10520.  
  10521.           Get alt reg set
  10522.           (for Reversi)
  10523.  
  10524.           Set alt reg set                    ; Switch back to MS-DOS
  10525.           (for MS-DOS Executive)             ; Executive
  10526.  
  10527.           The important point to follow is that a Set must always precede a Get.
  10528.           The model of Set then Get is the inverse of what interrupt handlers
  10529.           use, which is Get then Set (Get the old map context and Set the new
  10530.           one).  Another crucial point is that an alternate map register set
  10531.           must have the current mapping when allocated; otherwise, the Set will
  10532.           create chaos.
  10533.  
  10534.           What happens if this is simulated in software?  The same Set and Get
  10535.           model applies.  The main difference is where the context is saved.
  10536.  
  10537.           Since the allocate call is dynamic and there is no limit on the number
  10538.           of sets allocated, the OS/E must supply the space required.  Device
  10539.           drivers cannot allocate space dynamically, since the request would
  10540.           fail.  If the Allocate register set call returns a status indicating
  10541.           the alternate map register sets aren't supported, the OS/E must
  10542.           allocate space for the context.  It must also initialize the context
  10543.           using Function 15.  At that point it can do the Set, passing a pointer
  10544.           to the map context space.  On the Get call, the EMM driver is to
  10545.           return a pointer to the same context space.
  10546.  
  10547.           EXAMPLE 3
  10548.  
  10549.           Allocate alt reg set               ; Start up MS-DOS
  10550.           (for the MS-DOS executive)         ;Executive
  10551.  
  10552.           Get Page Map
  10553.           (for the MS-DOS executive)
  10554.  
  10555.           Set alt reg set
  10556.           (for MS-DOS Executive)
  10557.  
  10558.  
  10559.                                                                       160
  10560.  
  10561.  
  10562.  
  10563.  
  10564.  
  10565.  
  10566.  
  10567.           Allocate alt reg set               ; Start up Reversi
  10568.           (for Reversi)
  10569.  
  10570.           Set alt reg set
  10571.           (for Reversi)
  10572.  
  10573.           Map pages
  10574.           (for Reversi)
  10575.  
  10576.           Get Page Map
  10577.           (for Reversi)
  10578.  
  10579.           Set alt reg set                    ; Switch back to MS-DOS
  10580.           (for MS-DOS Executive)             ; Executive
  10581.  
  10582.  
  10583.  
  10584.  
  10585.  
  10586.  
  10587.  
  10588.  
  10589.  
  10590.  
  10591.  
  10592.  
  10593.  
  10594.  
  10595.  
  10596.  
  10597.  
  10598.  
  10599.  
  10600.  
  10601.  
  10602.  
  10603.  
  10604.  
  10605.  
  10606.  
  10607.  
  10608.  
  10609.  
  10610.  
  10611.  
  10612.  
  10613.  
  10614.  
  10615.  
  10616.  
  10617.  
  10618.  
  10619.  
  10620.  
  10621.  
  10622.  
  10623.  
  10624.  
  10625.                                                                       161
  10626.  
  10627.  
  10628.  
  10629.  
  10630.  
  10631.  
  10632.  
  10633.      GLOSSARY
  10634.  
  10635.           The following terms are used frequently in this specification:
  10636.  
  10637.           Allocate
  10638.                To reserve a specified amount of expanded memory pages.
  10639.  
  10640.           Application Program
  10641.                An application program is the program you write and your customer
  10642.                uses.  Some categories of application software are word
  10643.                processors, database managers, spreadsheet managers, and project
  10644.                managers.
  10645.  
  10646.           Conventional Memory
  10647.                The memory between 0 and 640K bytes, address range 00000h thru
  10648.                9FFFFh.
  10649.  
  10650.           Deallocate
  10651.                To return previously allocated expanded memory to the memory
  10652.                manager.
  10653.  
  10654.           EMM
  10655.                See Expanded Memory Manager.
  10656.  
  10657.           Expanded Memory
  10658.                Expanded memory is memory outside DOS's 640K-byte limit (usually
  10659.                in the range of C0000h through EFFFFH).
  10660.  
  10661.           Expanded Memory Manager (EMM)
  10662.                A device driver that controls the interface between DOS
  10663.                application programs and expanded memory.
  10664.  
  10665.           Extended Memory
  10666.                The 15M-byte address range between 100000h thru FFFFFFh available
  10667.                on an 80286 processor when it is operating in protected virtual
  10668.                address mode.
  10669.  
  10670.           Handle
  10671.                A value that the EMM assigns and uses to identify a block of
  10672.                memory requested by an application program.  All allocated
  10673.                logical pages are associated with a particular handle.
  10674.  
  10675.           Logical Page
  10676.                The EMM allocates expanded memory in units (typically 16K-bytes)
  10677.                called logical pages.
  10678.  
  10679.           Mappable Segment
  10680.                A 16K-byte region of memory which can have a logical page mapped
  10681.                at it.
  10682.  
  10683.           Map Registers
  10684.                The set of registers containing the current mapping context of
  10685.                the EMM hardware.
  10686.  
  10687.           Mapping
  10688.                The process of making a logical page of memory appear at a
  10689.                physical page.
  10690.  
  10691.                                                                       162
  10692.  
  10693.  
  10694.  
  10695.  
  10696.  
  10697.  
  10698.  
  10699.           Mapping Context
  10700.                The contents of the mapping registers at a specific instant.
  10701.                This context represents a map state.
  10702.  
  10703.           Page Frame
  10704.                A collection of 16K-byte contiguous physical pages from which an
  10705.                application program accesses expanded memory.
  10706.  
  10707.           Page Frame Base Address
  10708.                A page frame base address is the location (in segment format) of
  10709.                the first byte of the page frame.
  10710.  
  10711.           Physical Page
  10712.                A physical page is the range of memory addresses occupied by a
  10713.                single 16K-byte page.
  10714.  
  10715.           Raw Page
  10716.                The smallest unit of mappable memory that an expanded memory
  10717.                board can supply.
  10718.  
  10719.           Resident Application Program
  10720.                A resident application program is loaded by DOS, executes, and
  10721.                remains resident in the system after it returns control to DOS.
  10722.                This type of program occupies memory and is usually invoked by
  10723.                the operating system, an application program, or the hardware.
  10724.                Some examples of resident application programs are RAM disks,
  10725.                print spoolers, and "pop-up" desktop programs.
  10726.  
  10727.           Status Code
  10728.                A code that an EMM function returns which indicates something
  10729.                about the result of running the function.  Some status codes
  10730.                indicate whether the function worked correctly and others may
  10731.                tell you something about he expanded memory hardware or software.
  10732.  
  10733.           Transient Application
  10734.                A transient application program is loaded Program by DOS,
  10735.                executes, and doesn't remain in the system after it returns
  10736.                control to DOS.  After a transient application program returns
  10737.                control to DOS, the memory it used is available for other
  10738.                programs.
  10739.  
  10740.           Unmap
  10741.                To make a logical page inaccessible for reading or writing.
  10742.  
  10743.  
  10744.  
  10745.  
  10746.  
  10747.  
  10748.  
  10749.  
  10750.  
  10751.  
  10752.  
  10753.  
  10754.  
  10755.  
  10756.  
  10757.                                                                       163
  10758.  
  10759.