home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / e / ems4spec.zip / EMS4SPEC.DOC next >
Text File  |  1990-03-24  |  449KB  |  13,223 lines

  1.  
  2.  
  3.           The associated file (LIMEMS41.DOC) is a complete transcription of
  4.           the Lotus/Intel/Microsoft (LIM) Expanded Memory Specification
  5.           (EMS) Version 4.0, updated October 1987.  It can be printed by
  6.           "COPY LIMEMS41.DOC PRN:"
  7.  
  8.           I created this transcription because of the difficulty I origin-
  9.           ally had finding a copy of the document, because of the number of
  10.           people who have subsequently expressed an interest in having
  11.           access to a machine-readable copy of the specification, and,
  12.           finally, because of the annoying number of typographical errors
  13.           contained in the original and updated documents.
  14.  
  15.           This transcription is not an exact letter-for-letter duplicate of
  16.           the original document.  Some minor changes were necessitated by
  17.           the simple fact that the document's proportionally-spaced, multi-
  18.           fonted typography and line drawings did not lend themselves to
  19.           the generic fixed-spacing, single-fonted, non-graphical ASCII
  20.           transcription I wanted to produce for general dissemination.
  21.  
  22.           Other minor changes were made to correct obvious typographical
  23.           and grammatical errors, or to simply improve the visual aes-
  24.           thetics of the presented material.
  25.  
  26.           In one area, however, I simply trashed their original material
  27.           and substituted my own.  This area is the Index.  The original
  28.           document contains an Index that is little more than a reformatt-
  29.           ing of the Table of Contents.  As anyone who has ever indexed a
  30.           large document knows, it is very difficult to produce an Index
  31.           that is both complete AND easy to use.  I didn't have time to
  32.           produce one that was both, so I aimed for the former.  In fact,
  33.           the Index I have provided is more of an alphabetical listing of
  34.           key words and phrases and the pages where they are referenced,
  35.           than it is a more typical Index with its multi-level headings and
  36.           subheadings.
  37.  
  38.           You should be able obtain a printed, 3-hole-punched, 5.5 x 8.5"
  39.           copy of the original (and uncorrected) document directly from
  40.           Intel by calling their "Information Department" at 1-800-538-3373
  41.           and asking for a copy of the "LIM EMS 4.0 Developer's Kit."  It
  42.           is available free of charge and mine arrived in about two weeks. 
  43.           (European availability, however, is reported to be from poor to
  44.           non-existent.)
  45.  
  46.           It is my intent to provide this transcription as a public
  47.           service.  I am, therefore, releasing it into the public domain. 
  48.           The original document has also been released into the public
  49.           domain by Lotus, Intel, and Microsoft, though it remains their
  50.           copyrighted property (I'm not quite sure how they manage to do
  51.           that).
  52.  
  53.           I have tried as best I can to provide an accurate and corrected
  54.           transcription of the original document.  It is inevitable,
  55.           however, that some typographical errors have slipped through in
  56.           spite of my hours of bleary-eyed proof reading.  For these errors
  57.           I apologize and plead simple human frailty.
  58.  
  59.                THIS TRANSCRIPTION IS PROVIDED WITHOUT ANY GUARANTEES
  60.                OR WARRANTIES OF ANY KIND, AND I ASSUME ABSOLUTELY NO
  61.                LIABILITY FOR ITS ACCURACY, CONTENT, OR SUBSEQUENT USE.
  62.  
  63.           Dick Flanagan, W6OLD, Ben Lomond, California        November 1987
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.                            LOTUS(R)/INTEL(R)/MICROSOFT(R)
  76.  
  77.                           EXPANDED MEMORY SPECIFICATION [1]
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.                                      Version 4.0
  91.                                      300275-005
  92.                                     October, 1987
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.           Copyright (C) 1987
  106.  
  107.           Lotus Development Corporation
  108.           55 Cambridge Parkway
  109.           Cambridge, MA  02142
  110.  
  111.           Intel Corporation
  112.           5200 NE Elam Young Parkway
  113.           Hillsboro, OR  97124
  114.  
  115.           Microsoft Corporation
  116.           16011 NE 35th Way
  117.           Box 97017
  118.           Redmond, WA  98073
  119.  
  120.  
  121.                [1] Transcribed into machine-readable form by Dick Flanagan,
  122.           Ben Lomond, California.  This transcription is released into the
  123.           public domain without warranty or assumption of liability.
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                This specification was jointly developed by Lotus Develop-
  130.                ment Corporation, Intel Corporation, and Microsoft Corpora-
  131.                tion.  Although it has been released into the public domain
  132.                and is not confidential or proprietary, the specification is
  133.                still the copyright and property of Lotus Development
  134.                Corporation, Intel Corporation, and Microsoft Corporation.
  135.  
  136.  
  137.           DISCLAIMER OF WARRANTY
  138.  
  139.                LOTUS DEVELOPMENT CORPORATION, INTEL CORPORATION, AND MICRO-
  140.                SOFT CORPORATION EXCLUDE ANY AND ALL IMPLIED WARRANTIES,
  141.                INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  142.                PARTICULAR PURPOSE.  NEITHER LOTUS NOR INTEL NOR MICROSOFT
  143.                MAKE ANY WARRANTY OF REPRESENTATION, EITHER EXPRESS OR
  144.                IMPLIED, WITH RESPECT TO THIS SPECIFICATION, ITS QUALITY,
  145.                PERFORMANCE, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR
  146.                PURPOSE.  NEITHER LOTUS NOR INTEL NOR MICROSOFT SHALL HAVE
  147.                ANY LIABILITY FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  148.                DAMAGES ARISING OUT OF OR RESULTING FROM THE USE OR MODIF-
  149.                ICATION OF THIS SPECIFICATION.
  150.  
  151.  
  152.  
  153.           This specification uses the following trademarks:
  154.  
  155.           Intel is a trademark of Intel Corporation
  156.           Lotus is a trademark of Lotus Development Corporation
  157.           Microsoft is a trademark of Microsoft Corporation
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.                                                                          ii
  183.  
  184.  
  185.  
  186.  
  187.  
  188.           CONTENTS
  189.  
  190.  
  191.  
  192.           Chapter 1
  193.           INTRODUCTION
  194.             What is Expanded Memory? . . . . . . . . . . . . . . . . .    1
  195.             How Expanded Memory Works  . . . . . . . . . . . . . . . .    1
  196.  
  197.           Chapter 2
  198.           WRITING PROGRAMS THAT USE EXPANDED MEMORY
  199.             What Every Program Must Do . . . . . . . . . . . . . . . .    4
  200.             Advanced Programming . . . . . . . . . . . . . . . . . . .    5
  201.               Saving The State of Mapping Hardware . . . . . . . . . .    6
  202.               Retrieving Handle and Page Counts  . . . . . . . . . . .    6
  203.               Mapping and Unmapping Multiple Pages . . . . . . . . . .    6
  204.               Reallocating Pages . . . . . . . . . . . . . . . . . . .    6
  205.               Using Handles and Assigning Names to Handles . . . . . .    6
  206.               Using Handle Attributes  . . . . . . . . . . . . . . . .    7
  207.               Altering Page Maps and Jumping/Calling . . . . . . . . .    7
  208.               Moving or Exchanging Memory Regions  . . . . . . . . . .    7
  209.               Getting the Amount of Mappable Memory  . . . . . . . . .    8
  210.               Operating System Functions . . . . . . . . . . . . . . .    8
  211.             Programming Guidelines . . . . . . . . . . . . . . . . . .   12
  212.             Examples . . . . . . . . . . . . . . . . . . . . . . . . .   14
  213.               Example 1  . . . . . . . . . . . . . . . . . . . . . . .   14
  214.               Example 2  . . . . . . . . . . . . . . . . . . . . . . .   19
  215.               Example 3  . . . . . . . . . . . . . . . . . . . . . . .   30
  216.               Example 4  . . . . . . . . . . . . . . . . . . . . . . .   32
  217.  
  218.           Chapter 3
  219.           EMM FUNCTIONS
  220.             Function 1. Get Status . . . . . . . . . . . . . . . . . .   37
  221.             Function 2. Get Page Frame Address . . . . . . . . . . . .   38
  222.             Function 3. Get Unallocated Page Count . . . . . . . . . .   40
  223.             Function 4. Allocate Pages . . . . . . . . . . . . . . . .   42
  224.             Function 5. Map/Unmap Handle Pages . . . . . . . . . . . .   46
  225.             Function 6. Deallocate Pages . . . . . . . . . . . . . . .   49
  226.             Function 7. Get Version  . . . . . . . . . . . . . . . . .   51
  227.             Function 8. Save Page Map  . . . . . . . . . . . . . . . .   53
  228.             Function 9. Restore Page Map . . . . . . . . . . . . . . .   55
  229.             Function 10. Reserved  . . . . . . . . . . . . . . . . . .   57
  230.             Function 11. Reserved  . . . . . . . . . . . . . . . . . .   58
  231.             Function 12. Get Handle Count  . . . . . . . . . . . . . .   59
  232.             Function 13. Get Handle Pages  . . . . . . . . . . . . . .   61
  233.             Function 14. Get All Handle Pages  . . . . . . . . . . . .   63
  234.             Function 15. Get/Set Page Map  . . . . . . . . . . . . . .   65
  235.               Get Page Map subfunction . . . . . . . . . . . . . . . .   65
  236.               Set Page Map subfunction . . . . . . . . . . . . . . . .   67
  237.               Get & Set Page Map subfunction . . . . . . . . . . . . .   69
  238.               Get Size of Page Map Save Array subfunction  . . . . . .   71
  239.  
  240.  
  241.                                                                         iii
  242.  
  243.  
  244.  
  245.  
  246.  
  247.             Function 16. Get/Set Partial Page Map  . . . . . . . . . .   73
  248.               Get Partial Page Map subfunction . . . . . . . . . . . .   73
  249.               Set Partial Page Map subfunction . . . . . . . . . . . .   76
  250.               Get Size of Partial Page Map Save Array subfunction  . .   78
  251.             Function 17. Map/Unmap Multiple Handle Pages . . . . . . .   80
  252.               Mapping Multiple Pages . . . . . . . . . . . . . . . . .   80
  253.               Unmapping Multiple Pages . . . . . . . . . . . . . . . .   80
  254.               Mapping and Unmapping Multiple Pages Simultaneously  . .   80
  255.               Alternate Mapping and Unmapping Methods  . . . . . . . .   81
  256.               Logical Page/Physical Page Method  . . . . . . . . . . .   82
  257.               Logical Page/Segment Address Method  . . . . . . . . . .   85
  258.             Function 18. Reallocate Pages  . . . . . . . . . . . . . .   88
  259.             Function 19. Get/Set Handle Attribute  . . . . . . . . . .   91
  260.               Design Considerations  . . . . . . . . . . . . . . . . .   91
  261.               Get Handle Attribute subfunction . . . . . . . . . . . .   92
  262.               Set Handle Attribute subfunction . . . . . . . . . . . .   94
  263.               Get Attribute Capability subfunction . . . . . . . . . .   96
  264.             Function 20. Get/Set Handle Name . . . . . . . . . . . . .   98
  265.               Get Handle Name subfunction  . . . . . . . . . . . . . .   98
  266.               Set Handle Name subfunction  . . . . . . . . . . . . . .  100
  267.             Function 21. Get Handle Directory  . . . . . . . . . . . .  102
  268.               Get Handle Directory subfunction . . . . . . . . . . . .  102
  269.               Search For Named Handle subfunction  . . . . . . . . . .  105
  270.               Get Total Handles subfunction  . . . . . . . . . . . . .  107
  271.             Function 22. Alter Page Map & Jump . . . . . . . . . . . .  109
  272.             Function 23. Alter Page Map & Call . . . . . . . . . . . .  113
  273.               Alter Page Map & Call subfunction  . . . . . . . . . . .  113
  274.               Get Page Map Stack Space Size subfunction  . . . . . . .  118
  275.             Function 24. Move/Exchange Memory Region . . . . . . . . .  120
  276.               Move Memory Region subfunction . . . . . . . . . . . . .  120
  277.               Exchange Memory Region subfunction . . . . . . . . . . .  126
  278.             Function 25. Get Mappable Physical Address Array . . . . .  132
  279.               Get Mappable Physical Address Array subfunction  . . . .  132
  280.               Get Mappable Physical Address Array Entries subfunction   136
  281.             Function 26. Get Expanded Memory Hardware Information  . .  138
  282.               Get Hardware Configuration Array subfunction . . . . . .  138
  283.               Get Unallocated Raw Page Count subfunction . . . . . . .  142
  284.             Function 27. Allocate Standard/Raw Pages . . . . . . . . .  144
  285.               Allocate Standard Pages subfunction  . . . . . . . . . .  144
  286.               Allocate Raw Pages subfunction . . . . . . . . . . . . .  147
  287.             Function 28. Alternate Map Register Set  . . . . . . . . .  151
  288.               Design Considerations  . . . . . . . . . . . . . . . . .  151
  289.               System DMA Capabilities & Expanded Memory Support of DMA  151
  290.               Expanded Memory Support of DMA Register Sets . . . . . .  151
  291.               Get Alternate Map Register Set subfunction . . . . . . .  153
  292.               Set Alternate Map Register Set subfunction . . . . . . .  157
  293.               Get Alternate Map Save Array Size subfunction  . . . . .  161
  294.               Allocate Alternate Map Register Set subfunction  . . . .  163
  295.               Deallocate Alternate Map Register Set subfunction  . . .  166
  296.               Allocate DMA Register Set subfunction  . . . . . . . . .  168
  297.               Enable DMA on Alternate Map Register Set subfunction . .  170
  298.               Disable DMA on Alternate Map Register Set subfunction  .  173
  299.  
  300.                                                                          iv
  301.  
  302.  
  303.  
  304.  
  305.  
  306.               Deallocate DMA Register Set subfunction  . . . . . . . .  175
  307.             Function 29. Prepare Expanded Memory Hardware For Warm Boot 177
  308.             Function 30. Enable/Disable OS/E Function Set Functions  .  179
  309.               Enable OS/E Function Set subfunction . . . . . . . . . .  179
  310.               Disable OS/E Function Set subfunction  . . . . . . . . .  182
  311.               Return Access Key subfunction  . . . . . . . . . . . . .  185
  312.  
  313.           Appendix A
  314.           FUNCTION AND STATUS CODE CROSS REFERENCE TABLES
  315.             Function and Status Code Cross Reference . . . . . . . . .  187
  316.             Status and Function Code Cross Reference . . . . . . . . .  192
  317.  
  318.           Appendix B
  319.           TESTING FOR THE PRESENCE OF THE EXPANDED MEMORY MANAGER
  320.             Which method should your program use?  . . . . . . . . . .  199
  321.             The "open handle" technique  . . . . . . . . . . . . . . .  199
  322.             The "get interrupt vector" technique . . . . . . . . . . .  204
  323.  
  324.           Appendix C
  325.           EXPANDED MEMORY MANAGER IMPLEMENTATION GUIDELINES
  326.             The amount of expanded memory supported  . . . . . . . . .  206
  327.             The number of handles supported  . . . . . . . . . . . . .  206
  328.             Handle Numbering . . . . . . . . . . . . . . . . . . . . .  206
  329.             New handle type:  Handles versus Raw Handles . . . . . . .  206
  330.             The system Raw Handle (Raw Handle = 0000h) . . . . . . . .  207
  331.             Terminate and Stay Resident (TSR) Program Cooperation  . .  208
  332.             Accelerator Cards  . . . . . . . . . . . . . . . . . . . .  208
  333.  
  334.           Appendix D
  335.           OPERATING SYSTEM/ENVIRONMENT USE OF FUNCTION 28
  336.             Examples . . . . . . . . . . . . . . . . . . . . . . . . .  209
  337.               Example 1  . . . . . . . . . . . . . . . . . . . . . . .  209
  338.               Example 2  . . . . . . . . . . . . . . . . . . . . . . .  210
  339.               Example 3  . . . . . . . . . . . . . . . . . . . . . . .  211
  340.  
  341.           GLOSSARY
  342.  
  343.           INDEX
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.                                                                           v
  360.  
  361.  
  362.  
  363.  
  364.  
  365.           Chapter 1
  366.           INTRODUCTION
  367.  
  368.  
  369.                Because even the maximum amount (640K bytes) of conventional
  370.                memory isn't always enough for large application programs,
  371.                Lotus Development Corporation, Intel Corporation, and Micro-
  372.                soft Corporation created the Lotus/Intel/Microsoft (LIM)
  373.                Expanded Memory Specification.
  374.  
  375.                The LIM Expanded Memory Specification defines the software
  376.                interface between the Expanded Memory Manager (EMM) -- a
  377.                device driver that controls and manages expanded memory --
  378.                and application programs that use expanded memory.
  379.  
  380.  
  381.           What is Expanded Memory?
  382.  
  383.                Expanded memory is memory beyond DOS's 640K-byte limit.  The
  384.                LIM specification supports up to 32M bytes of expanded
  385.                memory.  Because the 8086, 8088, and 80286 (in real mode)
  386.                microprocessors can physically address only 1M bytes of
  387.                memory, they access expanded memory through a window in
  388.                their physical address range.  The next section explains how
  389.                this is done.
  390.  
  391.  
  392.           How Expanded Memory Works
  393.  
  394.                Expanded memory is divided into segments called logical
  395.                pages.  These pages are typically 16K bytes of memory.  Your
  396.                computer accesses logical pages through a physical block of
  397.                memory called a page frame.  The page frame contains
  398.                multiple physical pages, pages that the microprocessor can
  399.                address directly.  Physical pages are also typically 16K
  400.                bytes of memory.
  401.  
  402.                This page frame serves as a window into expanded memory. 
  403.                Just as your computer screen is a window into a large
  404.                spreadsheet, so the page frame is a window into expanded
  405.                memory.
  406.  
  407.                A logical page of expanded memory can be mapped into (made
  408.                to appear in) any one of the physical pages in the page
  409.                frame.  Thus, a read or write to the physical page actually
  410.                becomes a read or write to the associated logical page.  One
  411.                logical page can be mapped into the page frame for each
  412.                physical page.
  413.  
  414.                Figure 1-1 shows the relationship among the page frame,
  415.                physical pages, and logical pages.
  416.  
  417.  
  418.           Introduction                                                    1
  419.  
  420.  
  421.  
  422.  
  423.  
  424.                                                        32M +--------------+
  425.                                                           /|              |
  426.                                                            |              |
  427.                                                      /     |              |
  428.                                                            |              |
  429.                                                 /          |              |
  430.                                                            |              |
  431.                                            /               |              |
  432.                                                            |   Expanded   |
  433.                                       /                    |    Memory    |
  434.           1024K +--------------+                           |              |
  435.                 | / / / / / /  | /                         |              |
  436.            960K +--------------+                           |              |
  437.                 |  Page Frame  |                           |              |
  438.                 |              |                           |              |
  439.                 | 12 16K-Byte  |                           |              |
  440.                 |   Physical   |                           |              |
  441.                 |    Pages     |                           |              |
  442.            768K +--------------+                           | Divided into |
  443.                 | / / / / / /  | \                         |   logical    |
  444.            640K +--------------+                           |    pages     |
  445.                 |              |   \                       |              |
  446.                 |              |                           |              |
  447.                 |              |     \                     |              |
  448.                 |              |                           |              |
  449.                 | 24 16K-Byte  |       \                   |              |
  450.                 |   Physical   |                           |              |
  451.                 |    Pages*    |         \                 |              |
  452.                 |              |                           |              |
  453.                 |              |           \               |              |
  454.                 |              |                           |              |
  455.                 |              |             \             |              |
  456.            256K +--------------+                           |              |
  457.                 |              |               \           |              |
  458.                 | / / / / / /  |                           |              |
  459.                 |              |                 \         |              |
  460.                 | / / / / / /  |                           |              |
  461.                 |              |                   \       |              |
  462.                 | / / / / / /  |                           |              |
  463.                 |              |                     \     |              |
  464.               0 +--------------+                           |              |
  465.                                                        \   |              |
  466.                                                            |              |
  467.           *Intended for operating                        \ |              |
  468.            system/environment use only                   0 +--------------+
  469.  
  470.  
  471.  
  472.           Figure 1-1.  Expanded Memory
  473.  
  474.  
  475.  
  476.  
  477.           Introduction                                                    2
  478.  
  479.  
  480.  
  481.  
  482.  
  483.                The page frame is located above 640K bytes.  Normally, only
  484.                video adapters, network cards, and similar devices exist
  485.                between 640K and 1024K.
  486.  
  487.                This specification also defines methods for operating
  488.                systems and environments to access expanded memory through
  489.                physical pages below 640K bytes.  These methods are intended
  490.                for operating system/environment developers only.
  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.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.           Introduction                                                    3
  537.  
  538.  
  539.  
  540.  
  541.  
  542.           Chapter 2
  543.           WRITING PROGRAMS THAT USE EXPANDED MEMORY
  544.  
  545.  
  546.                This chapter describes what every program must do to use
  547.                expanded memory and describes more advanced techniques of
  548.                using expanded memory.
  549.  
  550.                This chapter also lists programming guidelines you should
  551.                follow when writing programs that use expanded memory and
  552.                provides the listings of some example programs.
  553.  
  554.  
  555.           What Every Program Must Do
  556.  
  557.                This section describes the steps every program must take to
  558.                use expanded memory.
  559.  
  560.                In order to use expanded memory, applications must perform
  561.                these steps in the following order:
  562.  
  563.                1.  Determine if EMM is installed.
  564.  
  565.                2.  Determine if enough expanded memory pages exist for your
  566.                    application.  (Function 3)
  567.  
  568.                3.  Allocate expanded memory pages.  (Function 4, 18, or 27)
  569.  
  570.                4.  Get the page frame base address.  (Function 2)
  571.  
  572.                5.  Map in expanded memory pages.  (Function 5 or 17)
  573.  
  574.                6.  Read/write/execute data in expanded memory, just as if
  575.                    it were conventional memory.
  576.  
  577.                7.  Return expanded memory pages to expand memory pool
  578.                    before exiting.  (Function 6 or 18)
  579.  
  580.                Table 2-1 overviews the functions while Chapter 3 describes
  581.                each of these functions in detail.  Example programs at the
  582.                end of this chapter illustrate using expanded memory.
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.           Writing Programs That Use Expanded Memory                       4
  596.  
  597.  
  598.  
  599.  
  600.  
  601.           Table 2-1.  The Basic Functions
  602.           ----------------------------------------------------------------
  603.  
  604.           Function                        Description
  605.  
  606.           ----------------------------------------------------------------
  607.  
  608.              1         The Get Status Function returns a status code
  609.                        indicating whether the memory manager hardware is
  610.                        working correctly.
  611.  
  612.              2         The Get Page Frame Address function returns the
  613.                        address where the 64K-byte page frame is located.
  614.  
  615.              3         The Get Unallocated Page Count function returns the
  616.                        number of unallocated pages (pages available to your
  617.                        program) and the total number of pages in expanded
  618.                        memory.
  619.  
  620.              4         The Allocate Pages function allocates the number of
  621.                        pages requested and assigns a unique EMM handle to
  622.                        these pages.
  623.  
  624.              5         The Map/Unmap Handle Page function maps a logical
  625.                        page to a specific physical page anywhere in the
  626.                        mappable regions of system memory.
  627.  
  628.              6         The Deallocate Pages deallocates the logical pages
  629.                        currently allocated to an EMM handle.
  630.  
  631.              7         The Get Version function returns the version number
  632.                        of the memory manager software.
  633.  
  634.           ----------------------------------------------------------------
  635.  
  636.  
  637.  
  638.           Advanced Programming
  639.  
  640.                In addition to the basic functions, the Lotus/Intel/Micro-
  641.                soft Expanded Memory Specification provides several advanced
  642.                functions which enhance the capabilities of software that
  643.                uses expanded memory.
  644.  
  645.                The following sections describe the advanced programming
  646.                capabilities and list the advanced EMM functions.
  647.  
  648.  
  649.           Note............................................................
  650.                Before using the advanced functions, programs should first
  651.                call Function 7 (Get Version) to determine whether the
  652.                installed version of EMM supports these functions.
  653.  
  654.           Writing Programs That Use Expanded Memory                       5
  655.  
  656.  
  657.  
  658.  
  659.  
  660.           Saving The State of Mapping Hardware
  661.  
  662.                Some software (such as interrupt service routines, device
  663.                drivers, and resident software) must save the current state
  664.                of the mapping hardware, switch mapping contexts, manipulate
  665.                sections of expanded memory, and restore the original
  666.                context of the memory mapping hardware.  Use Functions 8 and
  667.                9 or 15 and 16 to save the state of the hardware.
  668.  
  669.  
  670.           Retrieving Handle and Page Counts
  671.  
  672.                Some utility programs need to keep track of how expanded
  673.                memory is being used; use Functions 12 through 14 to do
  674.                this.
  675.  
  676.  
  677.           Mapping and Unmapping Multiple Pages
  678.  
  679.                Mapping multiple pages reduces the overhead an application
  680.                must perform during mapping.  Function 17 lets a program map
  681.                (or unmap) multiple pages at one time.
  682.  
  683.                In addition, you can map pages using segment addresses
  684.                instead of physical pages.  For example, if the page frame
  685.                base address is set to D000, you can map to either physical
  686.                page 0 or segment D000.  Function 25 (Get Mappable Physical
  687.                Address Array) returns a cross reference between all
  688.                expanded memory physical pages and their corresponding
  689.                segment values.
  690.  
  691.  
  692.           Reallocating Pages
  693.  
  694.                Reallocating pages (Function 18) lets applications dynami-
  695.                cally allocate expanded memory pages without acquiring
  696.                another handle or obtain a handle without allocating pages. 
  697.                Reallocating pages is an efficient means for applications to
  698.                obtain and release expanded memory pages.
  699.  
  700.  
  701.           Using Handles and Assigning Names to Handles
  702.  
  703.                This specification lets you associate a name with a handle,
  704.                so a family of applications can share information in
  705.                expanded memory.  For example, a software package consisting
  706.                of a word processor, spreadsheet, and print spooler can
  707.                share the same data among the different applications.  The
  708.                print spooler could use a handle name to reference data that
  709.                either the spreadsheet or word processor put in expanded
  710.                memory and could check for data in a particular handle
  711.                name's expanded memory pages.
  712.  
  713.           Writing Programs That Use Expanded Memory                       6
  714.  
  715.  
  716.  
  717.  
  718.  
  719.                Use Function 20 (Set Handle Name subfunction) to assign a
  720.                handle name to an EMM handle or Function 21 (Search for
  721.                Named Handle subfunction) to obtain the EMM handle as-
  722.                sociated with the handle name.  In addition, you can use
  723.                Function 14 (Get Handle Pages) to determine the number of
  724.                expanded memory pages allocated to an EMM handle.
  725.  
  726.  
  727.           Using Handle Attributes
  728.  
  729.                In addition to naming a handle, you can use Function 19 to
  730.                associate an attribute (volatile or non-volatile) with a
  731.                handle name.  A non-volatile attribute enables expanded
  732.                memory pages to preserve their data through a warmboot. 
  733.                With a volatile attribute, the data is not preserved.  The
  734.                default attribute for handles is volatile.
  735.  
  736.                Because using this function depends on the capabilities of
  737.                the expanded memory hardware installed in the system, you
  738.                should use the Get Attribute Capability subfunction before
  739.                attempting to assign an attribute to a handle's pages.
  740.  
  741.  
  742.           Altering Page Maps and Jumping/Calling
  743.  
  744.                You can use Functions 22 (Alter Page Map & Jump) and 23
  745.                (Alter Page Map & Call) to map a new set of values into the
  746.                map registers and transfer program control to a specified
  747.                address within expanded memory.  These functions can be used
  748.                to load and execute code in expanded memory.  An application
  749.                using this feature can significantly reduce the amount of
  750.                conventional memory it requires.  Programs can load needed
  751.                modules into expanded memory at run time and use Functions
  752.                22 and 23 to transfer control to these modules.
  753.  
  754.                Using expanded memory to store code can improve program
  755.                execution in many ways.  For example, sometimes programs
  756.                need to be divided into small overlays because of conven-
  757.                tional memory size limitations.  Overlays targeted for
  758.                expanded memory can be very large because LIM EMS 4.0
  759.                supports up to 32M bytes of expanded memory.  This method of
  760.                loading overlays improves overall system performance by
  761.                conserving conventional memory and eliminating conventional
  762.                memory allocation errors.
  763.  
  764.  
  765.           Moving or Exchanging Memory Regions
  766.  
  767.                Using Function 24 (Move/Exchange Memory Region), you can
  768.                easily move and exchange data between conventional and
  769.                expanded memory.  Function 24 can manipulate up to one
  770.                megabyte of data with one function call.  Although applica-
  771.  
  772.           Writing Programs That Use Expanded Memory                       7
  773.  
  774.  
  775.  
  776.  
  777.  
  778.                tions can perform this operation without this function,
  779.                having the expanded memory manager do it reduces the amount
  780.                of overhead for the application.
  781.  
  782.                In addition, this function checks for overlapping regions
  783.                and performs all the necessary mapping, preserving the
  784.                mapping context from before the exchange/move call.
  785.  
  786.  
  787.           Getting the Amount of Mappable Memory
  788.  
  789.                Function 25 enables applications to determine the total
  790.                amount of mappable memory the hardware/system currently
  791.                supports.  Not all expanded memory boards supply the same
  792.                number of physical pages (map registers).
  793.  
  794.                The Get Mappable Physical Address Array Entries subfunction
  795.                returns the total number of physical pages the expanded
  796.                memory hardware/system is capable of supporting.  The Get
  797.                Mappable Physical Array subfunction returns a cross refer-
  798.                ence between physical page numbers and the actual segment
  799.                address for each of the physical pages.
  800.  
  801.  
  802.           Operating System Functions
  803.  
  804.                In addition to the functions for application programs, this
  805.                specification defines functions for operating systems/en-
  806.                vironments.  These functions can be disabled at any time by
  807.                the operating system/environment, so programs should not
  808.                depend on their presence.  Applications that avoid this
  809.                warning and use these functions run a great risk of being
  810.                incompatible with other programs, including the operating
  811.                system.
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.           Writing Programs That Use Expanded Memory                       8
  832.  
  833.  
  834.  
  835.  
  836.  
  837.           Table 2-2.  The Advanced Functions
  838.           ----------------------------------------------------------------
  839.  
  840.           Function                        Description
  841.  
  842.           ----------------------------------------------------------------
  843.  
  844.              8         The Save Page Map saves the contents of the page
  845.                        mapping registers from all expanded memory boards in
  846.                        an internal save area.
  847.  
  848.              9         The Restore Page Map function restores (from an
  849.                        internal save area) the page mapping register
  850.                        contents on the expanded memory boards for a
  851.                        particular EMM handle.
  852.  
  853.              10        Reserved.
  854.  
  855.              11        Reserved.
  856.  
  857.              12        The Get Handle Count function returns the number of
  858.                        open EMM handles in the system.
  859.  
  860.              13        The Get Handle Pages function returns the number of
  861.                        pages allocated to a specific EMM handle.
  862.  
  863.              14        The Get All Handle Pages function returns an array
  864.                        of the active EMM handles and the number of pages
  865.                        allocated to each one.
  866.  
  867.              15        The Get/Set Page Map subfunction saves or restores
  868.                        the mapping context for all mappable memory regions
  869.                        (conventional and expanded) in a destination array
  870.                        which the application supplies.
  871.  
  872.              16        The Get/Set Partial Page Map subfunction provides a
  873.                        mechanism for saving a partial mapping context for
  874.                        specific mappable memory regions in a system.
  875.  
  876.              17        The Map/Unmap Multiple Handle Pages function can, in
  877.                        a single invocation, map (or unmap) logical pages
  878.                        into as many physical pages as the system supports.
  879.  
  880.              18        The Reallocate Pages function can increase or
  881.                        decrease the amount of expanded memory allocated to
  882.                        a handle.
  883.  
  884.              19        The Get/Set Handle Attribute function allows an
  885.                        application program to determine and set the
  886.                        attribute associated with a handle.
  887.  
  888.  
  889.  
  890.           Writing Programs That Use Expanded Memory                       9
  891.  
  892.  
  893.  
  894.  
  895.  
  896.           Table 2-2.  The Advanced Functions (continued)
  897.           ----------------------------------------------------------------
  898.  
  899.           Function                        Description
  900.  
  901.           ----------------------------------------------------------------
  902.  
  903.              20        The Get/Set Handle Name function gets the eight
  904.                        character name currently assigned to a handle and
  905.                        can assign an eight character name to a handle.
  906.  
  907.              21        The Get Handle Directory function returns informa-
  908.                        tion about active handles and the names assigned to
  909.                        each.
  910.  
  911.              22        The Alter Page Map & Jump function alters the memory
  912.                        mapping context and transfers control to the
  913.                        specified address.
  914.  
  915.              23        The Alter Page Map & Call function alters the speci-
  916.                        fied mapping context and transfers control to the
  917.                        specified address.  A return can then restore the
  918.                        context and return control to the caller.
  919.  
  920.              24        The Move/Exchange Memory Region function copies or
  921.                        exchanges a region of memory from conventional to
  922.                        conventional memory, conventional to expanded
  923.                        memory, expanded to conventional memory, or expanded
  924.                        to expanded memory.
  925.  
  926.              25        The Get Mappable Physical Address Array function
  927.                        returns an array containing the segment address and
  928.                        physical page number for each mappable physical page
  929.                        in a system.
  930.  
  931.              26        The Get Expanded Memory Hardware Information
  932.                        function returns an array containing the hardware
  933.                        capabilities of the expanded memory system.
  934.  
  935.              27        The Allocate Standard/Raw Pages function allocates
  936.                        the number of standard or non-standard size pages
  937.                        that the operating system requests and assigns a
  938.                        unique EMM handle to these pages.
  939.  
  940.              28        The Alternate Map Register Set function enables an
  941.                        application to simulate alternate sets of hardware
  942.                        mapping registers.
  943.  
  944.              29        The Prepare Expanded Memory Hardware for Warm Boot
  945.                        function prepares the expanded memory hardware for
  946.                        an "impending" warm boot.
  947.  
  948.  
  949.           Writing Programs That Use Expanded Memory                      10
  950.  
  951.  
  952.  
  953.  
  954.  
  955.           Table 2-2.  The Advanced Functions (continued)
  956.           ----------------------------------------------------------------
  957.  
  958.           Function                        Description
  959.  
  960.           ----------------------------------------------------------------
  961.  
  962.              30        The Enable/Disable OS/E function enables operating
  963.                        systems developers to enable and disable functions
  964.                        designed for operating system use.
  965.  
  966.           ----------------------------------------------------------------
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.           Writing Programs That Use Expanded Memory                      11
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.           Programming Guidelines
  1015.  
  1016.                The following section contains guidelines for programmers
  1017.                writing applications that use EMM.
  1018.  
  1019.                o   Do not put a program's stack in expanded memory.
  1020.  
  1021.                o   Do not replace interrupt 67h.  This is the interrupt
  1022.                    vector the EMM uses.  Replacing interrupt 67h could
  1023.                    result in disabling the Expanded Memory Manager.
  1024.  
  1025.                o   Do not map into conventional memory address space your
  1026.                    application doesn't own.  Applications that use the EMM
  1027.                    to swap into conventional memory space, must first
  1028.                    allocate this space from the operating system.  If the
  1029.                    operating system is not aware that a region of memory it
  1030.                    manages is in use, it will think it is available.  This
  1031.                    could have disastrous results.  EMM should not be used
  1032.                    to "allocate" conventional memory.  DOS is the proper
  1033.                    manager of conventional memory space.  EMM should only
  1034.                    be used to swap data in conventional memory space
  1035.                    previously allocated from DOS.
  1036.  
  1037.                o   Applications that plan on using data aliasing in
  1038.                    expanded memory must check for the presence of expanded
  1039.                    memory hardware.  Data aliasing occurs when mapping one
  1040.                    logical page into two or more mappable segments.  This
  1041.                    makes one 16K-byte expanded memory page appear to be in
  1042.                    more than one 16K-byte memory address space.  Data
  1043.                    aliasing is legal and sometimes useful for applications.
  1044.  
  1045.                    Software-only expanded memory emulators cannot perform
  1046.                    data aliasing.  A simple way to distinguish software
  1047.                    emulators from actual expanded memory hardware is to
  1048.                    attempt data aliasing and check the results.  For
  1049.                    example, map one logical page into four physical pages. 
  1050.                    Write to physical page 0.  Read physical pages 1-3 to
  1051.                    see if the data is there as well.  If the data appears
  1052.                    in all four physical pages, then expanded memory
  1053.                    hardware is installed in the system, and data aliasing
  1054.                    is supported.
  1055.  
  1056.                o   Applications should always return expanded memory pages
  1057.                    to the expanded memory manager upon termination.  These
  1058.                    pages will be made available for other applications.  If
  1059.                    unneeded pages are not returned to the expanded memory
  1060.                    manager, the system could "run out" of expanded memory
  1061.                    pages or expanded memory handles.
  1062.  
  1063.                o   Terminate and stay resident programs (TSR's) should
  1064.                    ALWAYS save the state of the map registers before
  1065.                    changing them.  Since TSR's may interrupt other programs
  1066.  
  1067.           Writing Programs That Use Expanded Memory                      12
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.                    which may be using expanded memory, they must not change
  1074.                    the state of the page mapping registers without first
  1075.                    saving them.  Before exiting, TSR's must restore the
  1076.                    state of the map registers.
  1077.  
  1078.                    The following sections describe the three ways to save
  1079.                    and restore the state of the map registers.
  1080.  
  1081.                    1.  Save Page Map and Restore Page Map (Functions 8 and
  1082.                        9).  This is the simplest of the three methods.  The
  1083.                        EMM saves the map register contents in its own data
  1084.                        structures -- the application does not need to
  1085.                        provide extra storage locations for the mapping
  1086.                        context.  The last mapping context to be saved,
  1087.                        under a particular handle, will be restored when a
  1088.                        call to Restore Page Map is issued with the same
  1089.                        handle.  This method is limited to one mapping
  1090.                        context for each handle and saves the context for
  1091.                        only LIM standard 64K-byte page frames.
  1092.  
  1093.                    2.  Get/Set Page Map (Function 15).  This method
  1094.                        requires the application to allocate space for the
  1095.                        storage array.  The EMM saves the mapping context in
  1096.                        an array whose address is passed to the EMM.  When
  1097.                        restoring the mapping context with this method, an
  1098.                        application passes the address of an array which
  1099.                        contains a previously stored mapping context.
  1100.  
  1101.                        This method is preferable if an application needs to
  1102.                        do more than one save before a restore.  It provides
  1103.                        a mechanism for switching between more than one
  1104.                        mapping context.
  1105.  
  1106.                    3.  Get/Set Partial Page Map (Function 16).  This method
  1107.                        provides a way for saving a partial mapping context. 
  1108.                        It should be used when the application does not need
  1109.                        to save the context of all mappable memory.  This
  1110.                        function also requires that the storage array be
  1111.                        part of the application's data.
  1112.  
  1113.                o   All functions using pointers to data structures must
  1114.                    have those data structures in memory which will not be
  1115.                    mapped out.  Functions 22 and 23 (Alter Map & Call and
  1116.                    Alter Map & Jump) are the only exceptions.
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.           Writing Programs That Use Expanded Memory                      13
  1127.  
  1128.  
  1129.  
  1130.  
  1131.  
  1132.           Examples
  1133.  
  1134.                This section lists four example programs that demonstrate
  1135.                the use of expanded memory.
  1136.  
  1137.  
  1138.           Example 1
  1139.  
  1140.                This program was written using the Microsoft C compiler
  1141.                Version 3.0.  EMM function calls are made with the int86
  1142.                function found in the dos.h library.  To create an ex-
  1143.                ecutable program use the following compile command line:
  1144.  
  1145.                          msc /Gs /Oat /Ml program,,program;
  1146.  
  1147.           #include <dos.h>
  1148.           #include <stdio.h>
  1149.  
  1150.           #define EMM_INT                 0x67  /* EMM interrupt number */
  1151.           #define GET_PAGE_FRAME          0x41  /* EMM get page frame */
  1152.                                                 /* function number */
  1153.           #define GET_UNALLOC_PAGE_COUNT  0x42  /* EMM get unallocated */
  1154.                                                 /* page count */
  1155.                                                 /* function number */
  1156.           #define ALLOCATE_PAGES          0x43  /* EMM allocate pages */
  1157.                                                 /* function number */
  1158.           #define MAP_PAGES               0x44  /* EMM map pages */
  1159.                                                 /* function number */
  1160.           #define DEALLOCATE_PAGES        0x45  /* EMM deallocate pages */
  1161.                                                 /* function number */
  1162.           #define DEVICE_NAME_LENGTH      8     /* length of a device */
  1163.                                                 /* name string */
  1164.           #define TRUE                    1
  1165.           #define FALSE                   0
  1166.  
  1167.           union REGS input_regs, output_regs;
  1168.           struct SREGS segment_regs;
  1169.           int pf_addr;
  1170.  
  1171.           /*------------------------------------------------------------*/
  1172.           /* Routine to convert a segment:offset pair to a far ptr.     */
  1173.           /*------------------------------------------------------------*/
  1174.           char *build_ptr (segment, offset)
  1175.  
  1176.               unsigned int segment;
  1177.               unsigned int offset;
  1178.           {
  1179.               char *ptr;
  1180.  
  1181.               ptr = (char *)(((unsigned long)segment << 16) + offset);
  1182.               return (ptr);
  1183.           }
  1184.  
  1185.           Writing Programs That Use Expanded Memory                      14
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.           /*------------------------------------------------------------*/
  1192.           /* Function which determines whether EMM device driver        */
  1193.           /* is installed.                                              */
  1194.           /*------------------------------------------------------------*/
  1195.           char emm_installed()
  1196.  
  1197.           {
  1198.               char *EMM_device_name = "EMMXXXX0";
  1199.               char *int_67_device_name_ptr;
  1200.  
  1201.               /*--------------------------------------------------------*/
  1202.               /* AH = DOS get interrupt vector function.                */
  1203.               /*--------------------------------------------------------*/
  1204.               input_regs.h.ah = 0x35;
  1205.  
  1206.               /*--------------------------------------------------------*/
  1207.               /* AL = EMM interrupt vector number.                      */
  1208.               /*--------------------------------------------------------*/
  1209.               input_regs.h.al = EMM_INT;
  1210.               intdosx (&input_regs, &output_regs, &segment_regs);
  1211.  
  1212.               /*--------------------------------------------------------*/
  1213.               /* Upon return ES:0Ah points to location where            */
  1214.               /* device name should be.                                 */
  1215.               /*--------------------------------------------------------*/
  1216.               int_67_device_name_ptr = build_ptr (segment_regs.es, 0x0A);
  1217.  
  1218.               /*--------------------------------------------------------*/
  1219.               /* Compare memory with EMM device name.                   */
  1220.               /*--------------------------------------------------------*/
  1221.               if (memcmp (EMM_device_name, int_67_device_name_ptr,
  1222.                                              DEVICE_NAME_LENGTH) == 0)
  1223.                   return (TRUE);
  1224.               else
  1225.                   return (FALSE);
  1226.           }
  1227.  
  1228.           /*------------------------------------------------------------*/
  1229.           /* Function which determines if there are enough unallocated  */
  1230.           /* expanded memory pages for the application.                 */
  1231.           /*------------------------------------------------------------*/
  1232.           char enough_unallocated_pages (pages_needed)
  1233.  
  1234.               int pages_needed;
  1235.           {
  1236.               input_regs.h.ah = GET_UNALLOCATED_PAGE_COUNT;
  1237.               int86 (EMM_INT, &input_regs, &output_regs);
  1238.               if (output_regs.h.ah != 0 || pages_needed > output_regs.x.bx)
  1239.                   return (FALSE);
  1240.               else
  1241.                   return (TRUE);
  1242.           }
  1243.  
  1244.           Writing Programs That Use Expanded Memory                      15
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.           /*------------------------------------------------------------*/
  1251.           /* Function which allocates expanded memory pages and passes  */
  1252.           /* back to the main EMM handle.                               */
  1253.           /*------------------------------------------------------------*/
  1254.           char allocate_expanded_memory_pages (pages_needed,emm_handle_ptr)
  1255.  
  1256.               int pages_needed;
  1257.               unsigned int *emm_handle_ptr;
  1258.           {
  1259.               input_regs.h.ah = ALLOCATE_PAGES;
  1260.               input_regs.x.bx = pages_needed;
  1261.               int86 (EMM_INT, &input_regs, &output_regs);
  1262.               if (output_regs.h.ah == 0) {
  1263.                   *emm_handle_ptr = output_regs.x.dx;
  1264.                   return (TRUE);
  1265.               }
  1266.               else
  1267.                   return (FALSE);
  1268.           }
  1269.  
  1270.           /*------------------------------------------------------------*/
  1271.           /* Routine to map a logical page to a physical page.          */
  1272.           /*------------------------------------------------------------*/
  1273.           char map_expanded_memory_pages (emm_handle, physical_page,       
  1274.                                                              logical_page)
  1275.               unsigned int emm_handle;
  1276.               int physical_page;
  1277.               int logical_page;
  1278.           {
  1279.               input_regs.h.ah = MAP_PAGES;
  1280.               input_regs.h.al = physical_page;
  1281.               input_regs.x.bx = logical_page;
  1282.               input_regs.x.dx = emm_handle;
  1283.               int86 (EMM_INT, &input_regs, &output_regs);
  1284.               if (output_regs.h.ah == 0)
  1285.                   return (TRUE);
  1286.               else
  1287.                   return (FALSE);
  1288.           }
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.           Writing Programs That Use Expanded Memory                      16
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.           /*------------------------------------------------------------*/
  1310.           /* Routine which gets the page frame base address from EMM.   */
  1311.           /*------------------------------------------------------------*/
  1312.           char get_page_frame_address (pf_ptr)
  1313.  
  1314.               char **pf_ptr;
  1315.           {
  1316.               input_regs.h.ah = GET_PAGE_FRAME;
  1317.               int86 (EMM_INT, &input_regs, &output_regs);
  1318.               if (output_regs.h.ah != 0)       /* check EMM status */
  1319.                   return (FALSE);
  1320.               else
  1321.                  *pf_ptr = build_ptr (output_regs.x.bx, 0);
  1322.               return (TRUE);
  1323.           }
  1324.  
  1325.           /*------------------------------------------------------------*/
  1326.           /* Routine to release all expanded memory pages allocated     */
  1327.           /* by an EMM handle.                                          */
  1328.           /*------------------------------------------------------------*/
  1329.  
  1330.           char deallocate_expanded_memory_pages (emm_handle)
  1331.  
  1332.               unsigned int emm_handle;
  1333.           {
  1334.               input_regs.h.ah = DEALLOCATE_PAGES;
  1335.               input_regs.x.dx = emm_handle;
  1336.               int86 (EMM_INT, &input_regs, &output_regs);
  1337.               if (output_regs.h.ah == 0)
  1338.                   return (TRUE);
  1339.               else
  1340.                   return (FALSE);
  1341.           }
  1342.  
  1343.           main()
  1344.  
  1345.           {
  1346.               unsigned int emm_handle;
  1347.               char *pf_addr;
  1348.               int pages_needed;
  1349.               int physical_page;
  1350.               int logical_page;
  1351.               int index;
  1352.  
  1353.               /*--------------------------------------------------------*/
  1354.               /* Determine if EMM is installed.                         */
  1355.               /*--------------------------------------------------------*/
  1356.               if (!emm_installed())
  1357.                   exit(1);
  1358.  
  1359.  
  1360.  
  1361.  
  1362.           Writing Programs That Use Expanded Memory                      17
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.               /*--------------------------------------------------------*/
  1369.               /* Determine if enough expanded memory pages exist for    */
  1370.               /* application.                                           */
  1371.               /*--------------------------------------------------------*/
  1372.               pages_needed = 1;
  1373.               if (!enough_unallocated_pages (pages_needed))
  1374.                   exit(1);
  1375.  
  1376.               /*--------------------------------------------------------*/
  1377.               /* Allocate expanded memory pages.                        */
  1378.               /*--------------------------------------------------------*/
  1379.               if (!allocate_expanded_memory_pages (pages_needed,
  1380.                                                              &emm_handle))
  1381.                   exit(1);
  1382.  
  1383.               /*--------------------------------------------------------*/
  1384.               /* Map in the required pages.                             */
  1385.               /*--------------------------------------------------------*/
  1386.               physical_page = 0;
  1387.               logical_page = 0;
  1388.               if (!map_expanded_memory_pages (emm_handle, physical_page,
  1389.                                                             logical_page))
  1390.                   exit(1);
  1391.  
  1392.               /*--------------------------------------------------------*/
  1393.               /* Get expanded memory page frame address.                */
  1394.               /*--------------------------------------------------------*/
  1395.               if (!get_page_frame_address (&pf_addr))
  1396.                   exit(1);
  1397.  
  1398.               /*--------------------------------------------------------*/
  1399.               /* Write to expanded memory.                              */
  1400.               /*--------------------------------------------------------*/
  1401.               for (index = 0; index < 0x3fff; index++)
  1402.                   pf_addr[index] = index;
  1403.  
  1404.               /*--------------------------------------------------------*/
  1405.               /* Return expanded memory pages before exiting.           */
  1406.               /*--------------------------------------------------------*/
  1407.               if (!deallocate_expanded_memory_pages (emm_handle))
  1408.                   exit(1);
  1409.           }
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.           Writing Programs That Use Expanded Memory                      18
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.           Example 2
  1428.  
  1429.           This program shows you how to use the basic functions of the LIM
  1430.           Expanded Memory Specification with Turbo Pascal.  The program
  1431.           does the following:
  1432.  
  1433.                1.  Makes sure the LIM Expanded Memory Manager (EMM) has
  1434.                    been installed.
  1435.  
  1436.                2.  Displays the version number of the EMM.
  1437.  
  1438.                3.  Determines if there are enough pages of memory for the
  1439.                    program.  It then displays the total number of EMM pages
  1440.                    present in the system and the number available for use.
  1441.  
  1442.                4.  Requests the desired number of pages from the EMM.
  1443.  
  1444.                5.  Maps a logical page into one of the physical pages.
  1445.  
  1446.                6.  Displays the base address of our EMM memory page frame. 
  1447.                    Performs a simple read/write test on the EMM memory.
  1448.  
  1449.                7.  Returns the EMM memory given to us back to the EMM.
  1450.  
  1451.                8.  Exits.
  1452.  
  1453.           All the calls are structured to return the result or error code
  1454.           of the Expanded Memory function performed as an integer.  If the
  1455.           error code is not zero, an error has occurred, a simple error
  1456.           procedure is called, and the program terminates.
  1457.  
  1458.           Type
  1459.             ST3  = string[3];
  1460.             ST80 = string[80];
  1461.             ST5  = string[5];
  1462.  
  1463.             Registers = record
  1464.               case integer of
  1465.                 1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,FLAGS: Integer);
  1466.                 2: (AL,AH,BL,BH,CL,CH,DL,DH         : Byte);
  1467.               end;
  1468.  
  1469.           Const
  1470.             EMM_INT                    = $67;
  1471.             DOS_Int                    = $21;
  1472.             GET_PAGE_FRAME             = $41;
  1473.             GET_UNALLOCATED_PAGE_COUNT = $42;
  1474.             ALLOCATE_PAGES             = $43;
  1475.             MAP_PAGES                  = $44;
  1476.             DEALLOCATE_PAGES           = $45;
  1477.             GET_VERSION                = $46;
  1478.             STATUS_OK                  = 0;
  1479.  
  1480.           Writing Programs That Use Expanded Memory                      19
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.             {------------------------------------------------------------}
  1487.             { Assume the application needs one EMM page.                 }
  1488.             {------------------------------------------------------------}
  1489.             APPLICATION_PAGE_COUNT = 1;
  1490.  
  1491.           Var
  1492.             Regs: Registers;
  1493.  
  1494.             Emm_handle,
  1495.             Page_Frame_Base_Address,
  1496.             Pages_Needed,
  1497.             Physical_Page,
  1498.             Logical_Page,
  1499.             Offset,
  1500.             Error_Code,
  1501.             Pages_EMM_Available,
  1502.             Total_EMM_Pages,
  1503.             Available_EMM_Pages: Integer;
  1504.  
  1505.             Version_Number,
  1506.             Pages_Number_String: ST3;
  1507.  
  1508.             Verify: Boolean;
  1509.  
  1510.             {------------------------------------------------------------}
  1511.             { The function Hex_String converts an integer into a four    }
  1512.             { character hexadecimal number (string) with leading zeros.  }
  1513.             {------------------------------------------------------------}
  1514.             Function Hex_String (Number: Integer): ST5;
  1515.               Function Hex_Char (Number: Integer): Char;
  1516.                 Begin
  1517.                   If Number < 10 then
  1518.                     Hex_Char := Char (Number + 48)
  1519.                   else
  1520.                     Hex_Char := Char (Number + 55);
  1521.                 end; { Function Hex_char }
  1522.  
  1523.             Var
  1524.               S: ST5;
  1525.  
  1526.             Begin
  1527.               S := '';
  1528.               S := Hex_Char ((Number shr 1) div 2048);
  1529.               Number := (((Number shr 1) mod 2048) shl 1) + (Number and 1);
  1530.               S := S + Hex_Char (Number div 256);
  1531.               Number := Number mod 256;
  1532.               S := S + Hex_Char (Number div 16);
  1533.               Number := Number mod 16;
  1534.               S := S + Hex_Char (Number);
  1535.               Hex_String := S + 'h';
  1536.             end; { Function Hex_String }
  1537.  
  1538.  
  1539.           Writing Programs That Use Expanded Memory                      20
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.             {------------------------------------------------------------}
  1546.             { The function Emm_Installed checks to see if the            }
  1547.             { EMM is loaded in memory.  It does this by looking          }
  1548.             { for the string 'EMMXXXX0', which should be located         }
  1549.             { at 10 bytes from the beginning of the code segment the     }
  1550.             { EMM interrupt, 67h, points to.                             }
  1551.             {------------------------------------------------------------}
  1552.             Function Emm_Installed: Boolean;
  1553.               Var
  1554.                 Emm_Device_Name   : string[8];
  1555.                 Int_67_Device_Name: string[8];
  1556.                 Position          : integer;
  1557.                 Regs              : registers;
  1558.  
  1559.               Begin
  1560.                 Int_67_Device_Name := '';
  1561.                 Emm_Device_Name    := 'EMMXXXX0';
  1562.                 with Regs do
  1563.                   Begin
  1564.                     {----------------------------------------------------}
  1565.                     { Get the code segment interrupt 67h points to       }
  1566.                     { the EMM interrupt by using DOS function 35h.       }
  1567.                     { (get interrupt vector)                             }
  1568.                     {----------------------------------------------------}
  1569.                     AH := $35;
  1570.                     AL := EMM_INT;
  1571.                     Intr (DOS_Int, Regs);
  1572.                     {----------------------------------------------------}
  1573.                     { The ES pseudo-register contains the segment        }
  1574.                     { address pointed to by interrupt 67h.  Create an    }
  1575.                     { eight character string from the eight successive   }
  1576.                     { bytes at address ES:$000A (10 bytes from ES)       }
  1577.                     {----------------------------------------------------}
  1578.                     For Position := 0 to 7 do
  1579.                       Int_67_Device_Name :=
  1580.                         Int_67_Device_Name + Chr (mem[ES:Position + $0A]);
  1581.                     Emm_Installed := True;
  1582.                     {----------------------------------------------------}
  1583.                     { If the string is the EMM manager signature,        }
  1584.                     { 'EMMXXXX0', then EMM is installed and ready for    }
  1585.                     { use.  If not, then EMM is not present.             }
  1586.                     {----------------------------------------------------}
  1587.                     If Int_67_Device_Name <> Emm_Device_Name
  1588.                       then Emm_Installed := False;
  1589.                   end; { with Regs do }
  1590.               end; { Function Emm_Installed }
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.           Writing Programs That Use Expanded Memory                      21
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.             {------------------------------------------------------------}
  1605.             { This function returns the total number of EMM pages        }
  1606.             { present in the system, and the number of EMM pages that    }
  1607.             { are available.                                             }
  1608.             {------------------------------------------------------------}
  1609.             Function EMM_Pages_Available
  1610.               (Var Total_EMM_Pages, Pages_Available: Integer): Integer;
  1611.               Var
  1612.                 Regs: Registers;
  1613.  
  1614.               Begin
  1615.                 with Regs do
  1616.                   Begin
  1617.                     {----------------------------------------------------}
  1618.                     { Get the number of currently unallocated pages and  }
  1619.                     { the total number of pages in the system from EMM.  }
  1620.                     { Load pseudo-registers prior to invoking EMM.       }
  1621.                     {    AH = get unallocated page count function        }
  1622.                     {----------------------------------------------------}
  1623.                     AH := GET_UNALLOCATED_PAGE_COUNT;
  1624.                     Intr (EMM_INT, Regs);
  1625.                     {----------------------------------------------------}
  1626.                     { Unload the pseudo-registers after invoking EMM.    }
  1627.                     {    BX = currently unallocated pages                }
  1628.                     {    DX = total pages in the system                  }
  1629.                     {    AH = status                                     }
  1630.                     {----------------------------------------------------}
  1631.                     Pages_Available := BX;
  1632.                     Total_EMM_Pages := DX;
  1633.                     EMM_Pages_Available := AH;
  1634.                   end;
  1635.               end; { Function EMM_Pages_Available }
  1636.  
  1637.  
  1638.             {------------------------------------------------------------}
  1639.             { This function requests the specified number of pages       }
  1640.             { from the EMM.                                              }
  1641.             {------------------------------------------------------------}
  1642.             Function Allocate_Expanded_Memory_Pages
  1643.               (Pages_Needed: Integer; Var Handle: Integer): Integer;
  1644.               Var
  1645.                 Regs: Registers;
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.           Writing Programs That Use Expanded Memory                      22
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.               Begin
  1664.                 with Regs do
  1665.                   Begin
  1666.                     {----------------------------------------------------}
  1667.                     { Allocate the specified number of pages from EMM.   }
  1668.                     { Load pseudo-registers prior to invoking EMM.       }
  1669.                     {    AH = allocate pages function.                   }
  1670.                     {    BX = number of pages to allocate.               }
  1671.                     {----------------------------------------------------}
  1672.                     AH := ALLOCATE_PAGES;
  1673.                     BX := Pages_Needed;
  1674.                     Intr (EMM_INT, Regs);
  1675.                     {----------------------------------------------------}
  1676.                     { Unload the pseudo-registers after invoking EMM.    }
  1677.                     {    DX = EMM handle                                 }
  1678.                     {    AH = status                                     }
  1679.                     {----------------------------------------------------}
  1680.                     Handle := DX;
  1681.                     Allocate_Expanded_Memory_Pages := AH;
  1682.                   end;
  1683.               end; { Function Allocate_Expanded_Memory_Pages }
  1684.  
  1685.  
  1686.             {------------------------------------------------------------}
  1687.             { This function maps a logical page allocated by the         }
  1688.             { Allocate_Expanded_Memory_Pages function into one of the    }
  1689.             { four physical pages.                                       }
  1690.             {------------------------------------------------------------}
  1691.             Function Map_Expanded_Memory_Pages
  1692.               (Handle, Logical_Page, Physical_Page: Integer): Integer;
  1693.               Var
  1694.                 Regs: Registers;
  1695.  
  1696.               Begin
  1697.                 with Regs do
  1698.                   Begin
  1699.                     {----------------------------------------------------}
  1700.                     { Map a logical page at a physical page.             }
  1701.                     { Load pseudo-registers prior to invoking EMM.       }
  1702.                     {    AH = map page function                          }
  1703.                     {    DX = handle                                     }
  1704.                     {    BX = logical page number                        }
  1705.                     {    AL = physical page number                       }
  1706.                     {----------------------------------------------------}
  1707.                     AH := MAP_PAGES;
  1708.                     DX := Handle;
  1709.                     BX := Logical_Page;
  1710.                     AL := Physical_Page;
  1711.                     Intr (EMM_INT, Regs);
  1712.  
  1713.  
  1714.  
  1715.  
  1716.           Writing Programs That Use Expanded Memory                      23
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.                     {----------------------------------------------------}
  1723.                     { Unload the pseudo-registers after invoking EMM.    }
  1724.                     {    AH = status                                     }
  1725.                     {----------------------------------------------------}
  1726.                     Map_Expanded_Memory_Pages := AH;
  1727.                   end; { with Regs do }
  1728.               end; { Function Map_Expanded_Memory_Pages }
  1729.  
  1730.  
  1731.             {------------------------------------------------------------}
  1732.             { This function gets the physical address of the EMM page    }
  1733.             { frame we are using.  The address returned is the segment   }
  1734.             { of the page frame.                                         }
  1735.             {------------------------------------------------------------}
  1736.             Function Get_Page_Frame_Base_Address
  1737.               (Var Page_Frame_Address: Integer): Integer;
  1738.               Var
  1739.                 Regs: Registers;
  1740.  
  1741.               Begin
  1742.                 with Regs do
  1743.                   Begin
  1744.                     {----------------------------------------------------}
  1745.                     { Get the page frame segment address from EMM.       }
  1746.                     { Load pseudo-registers prior to invoking EMM.       }
  1747.                     {    AH = get page frame segment function            }
  1748.                     {----------------------------------------------------}
  1749.                     AH := GET_PAGE_FRAME;
  1750.                     Intr (EMM_INT, Regs);
  1751.                     {----------------------------------------------------}
  1752.                     { Unload the pseudo-registers after invoking EMM.    }
  1753.                     {    BX = page frame segment address                 }
  1754.                     {    AH = status                                     }
  1755.                     {----------------------------------------------------}
  1756.                     Page_Frame_Address := BX;
  1757.                     Get_Page_Frame_Base_Address := AH;
  1758.                   end; { with Regs do }
  1759.               end; { Function Get_Page_Frame_Base_Address }
  1760.  
  1761.  
  1762.             {------------------------------------------------------------}
  1763.             { This function releases the EMM memory pages allocated to   }
  1764.             { us, back to the EMM memory pool.                           }
  1765.             {------------------------------------------------------------}
  1766.             Function Deallocate_Expanded_Memory_Pages
  1767.               (Handle: Integer): Integer;
  1768.               Var
  1769.                 Regs: Registers;
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.           Writing Programs That Use Expanded Memory                      24
  1776.  
  1777.  
  1778.  
  1779.  
  1780.  
  1781.               Begin
  1782.                 with Regs do
  1783.                   Begin
  1784.                     {----------------------------------------------------}
  1785.                     { Deallocate the pages allocated to an EMM handle.   }
  1786.                     { Load pseudo-registers prior to invoking EMM.       }
  1787.                     {    AH = deallocate pages function                  }
  1788.                     {    DX = EMM handle                                 }
  1789.                     {----------------------------------------------------}
  1790.                     AH := DEALLOCATE_PAGES;
  1791.                     DX := Handle;
  1792.                     Intr (EMM_INT, Regs);
  1793.                     {----------------------------------------------------}
  1794.                     { Unload the pseudo-registers after invoking EMM.    }
  1795.                     {    AH = status                                     }
  1796.                     {----------------------------------------------------}
  1797.                     Deallocate_Expanded_Memory_Pages := AH;
  1798.                   end; { with Regs do }
  1799.               end; { Function Deallocate_Expanded_Memory_Pages }
  1800.  
  1801.  
  1802.             {------------------------------------------------------------}
  1803.             { This function returns the version number of the EMM as     }
  1804.             { a three-character string.                                  }
  1805.             {------------------------------------------------------------}
  1806.             Function Get_Version_Number (Var Version_String: ST3): Integer;
  1807.               Var
  1808.                 Regs: Registers;
  1809.                 Integer_Part, Fractional_Part: Char;
  1810.  
  1811.               Begin
  1812.                 with Regs do
  1813.                   Begin
  1814.                     {----------------------------------------------------}
  1815.                     { Get the version of EMM.                            }
  1816.                     { Load pseudo-registers prior to invoking EMM.       }
  1817.                     {    AH = get EMM version function                   }
  1818.                     {----------------------------------------------------}
  1819.                     AH := GET_VERSION;
  1820.                     Intr (EMM_INT, Regs);
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.           Writing Programs That Use Expanded Memory                      25
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.                     {----------------------------------------------------}
  1841.                     { If the version number returned was OK, then        }
  1842.                     { convert it to a three-character string.            }
  1843.                     {----------------------------------------------------}
  1844.                     If AH=STATUS_OK then
  1845.                       Begin
  1846.                         {------------------------------------------------}
  1847.                         { The upper four bits of AH are the integer      }
  1848.                         { portion of the version number, the lower four  }
  1849.                         { bits are the fractional portion.  Convert the  }
  1850.                         { integer value to ASCII by adding 48.           }
  1851.                         {------------------------------------------------}
  1852.                         Integer_Part    := Char (AL shr 4  + 48);
  1853.                         Fractional_Part := Char (AL and $F + 48);
  1854.                         Version_String  := Integer_Part + '.' +
  1855.                                                           Fractional_Part;
  1856.                       end; { If AH=STATUS_OK }
  1857.                     {----------------------------------------------------}
  1858.                     { Unload the pseudo-registers after invoking EMM.    }
  1859.                     {    AH = status                                     }
  1860.                     {----------------------------------------------------}
  1861.                     Get_Version_Number := AH;
  1862.                   end; { with Regs do }
  1863.               end; { Function Get_Version_Number }
  1864.  
  1865.  
  1866.             {------------------------------------------------------------}
  1867.             { This procedure prints an error message passed by the       }
  1868.             { caller, prints the error code passed by the caller in hex, }
  1869.             { and then terminates the program with an error level of 1.  }
  1870.             {------------------------------------------------------------}
  1871.             Procedure Error (Error_Message: ST80; Error_Number: Integer);
  1872.               Begin
  1873.                 Writeln (Error_Message);
  1874.                 Writeln ('  Error_Number = ', Hex_String (Error_Number));
  1875.                 Writeln ('EMM test program aborting.');
  1876.                 Halt (1);
  1877.               end; { Procedure Error }
  1878.  
  1879.  
  1880.           {--------------------------------------------------------------}
  1881.           { This program is an example of the basic EMM functions that   }
  1882.           { you need in order to use EMM memory with Turbo Pascal.       }
  1883.           {--------------------------------------------------------------}
  1884.           Begin
  1885.             ClrScr;
  1886.             Window (5,2,77,22);
  1887.  
  1888.  
  1889.  
  1890.  
  1891.  
  1892.  
  1893.           Writing Programs That Use Expanded Memory                      26
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.             {------------------------------------------------------------}
  1900.             { Determine if the Expanded Memory Manager is installed.  If }
  1901.             { not, then terminate 'main' with an ErrorLevel code of 1.   }
  1902.             {------------------------------------------------------------}
  1903.             If not (Emm_Installed) then
  1904.               Begin
  1905.                 Writeln ('The LIM EMM is not installed.');
  1906.                 Halt (1);
  1907.               end
  1908.             else
  1909.               Begin
  1910.                 { Get the version number and display it }
  1911.                 Error_Code := Get_Version_Number (Version_Number);
  1912.                 If Error_Code <> STATUS_OK then
  1913.                   Error ('Error getting EMM version number.', Error_Code)
  1914.                 else
  1915.                   Writeln ('LIM Expanded Memory Manager, version ',
  1916.                            Version_Number, ' is ready for use.');
  1917.               end;
  1918.             Writeln;
  1919.  
  1920.             {------------------------------------------------------------}
  1921.             { Determine if there are enough expanded memory pages for    }
  1922.             { this application.                                          }
  1923.             {------------------------------------------------------------}
  1924.             Pages_Needed := APPLICATION_PAGE_COUNT;
  1925.             Error_Code   := EMM_Pages_Available (Total_EMM_Pages,
  1926.                                                  Available_EMM_Pages);
  1927.             If Error_Code <> STATUS_OK then
  1928.               Error ('Error determining number of EMM pages available.',
  1929.                      Error_Code);
  1930.             Writeln ('There are a total of ', Total_EMM_Pages,
  1931.                      ' expanded memory pages present in this system.');
  1932.             Writeln ('  ', Available_EMM_Pages,
  1933.                      ' of those pages are available for use.');
  1934.             Writeln;
  1935.  
  1936.             {------------------------------------------------------------}
  1937.             { If there is an insufficient number of pages for the        }
  1938.             { application, then report the error and terminate the EMM   }
  1939.             { example program.                                           }
  1940.             {------------------------------------------------------------}
  1941.             If Pages_Needed > Available_EMM_Pages then
  1942.               Begin
  1943.                 Str (Pages_Needed, Pages_Number_String);
  1944.                 Error ('We need ' + Pages_Number_String +
  1945.                        ' EMM pages.  There are not that many available.',
  1946.                        Error_Code);
  1947.               end; { Pages_Needed > Available_EMM_Pages }
  1948.  
  1949.  
  1950.  
  1951.  
  1952.           Writing Programs That Use Expanded Memory                      27
  1953.  
  1954.  
  1955.  
  1956.  
  1957.  
  1958.             {------------------------------------------------------------}
  1959.             { Allocate expanded memory pages for our use.                }
  1960.             {------------------------------------------------------------}
  1961.             Error_Code :=
  1962.               Allocate_Expanded_Memory_Pages (Pages_Needed, Emm_Handle);
  1963.             Str (Pages_Needed, Pages_Number_String);
  1964.             If Error_Code <> STATUS_OK then
  1965.               Error ('EMM test program failed trying to allocate '
  1966.                      + Pages_Number_String
  1967.                      + ' pages for usage.', Error_Code);
  1968.             Writeln (APPLICATION_PAGE_COUNT,
  1969.                      ' EMM page(s) allocated for the EMM test program.');
  1970.             Writeln;
  1971.  
  1972.             {------------------------------------------------------------}
  1973.             { Map in the required logical pages to the physical pages    }
  1974.             { given to us, in this case just one page.                   }
  1975.             {------------------------------------------------------------}
  1976.             Logical_Page  := 0;
  1977.             Physical_Page := 0;
  1978.             Error_Code := Map_Expanded_Memory_Pages (Emm_Handle,
  1979.                                                      Logical_Page,
  1980.                                                      Physical_Page);
  1981.             If Error_Code <> STATUS_OK then
  1982.               Error ('EMM test program failed trying to map '
  1983.                      + 'logical pages into physical pages.',
  1984.                      Error_Code);
  1985.  
  1986.             Writeln ('Logical Page ',
  1987.                      Logical_Page,
  1988.                      ' successfully mapped into Physical Page ',
  1989.                      Physical_Page);
  1990.             Writeln;
  1991.  
  1992.             {------------------------------------------------------------}
  1993.             { Get the expanded memory page frame address.                }
  1994.             {------------------------------------------------------------}
  1995.             Error_Code := Get_Page_Frame_Base_Address
  1996.                             (Page_Frame_Base_Address);
  1997.             If Error_Code <> STATUS_OK then
  1998.               Error ('EMM test program unable to get the base Page'
  1999.                      + ' Frame Address.',
  2000.                      Error_Code);
  2001.             Writeln ('The base address of the EMM page frame is = '
  2002.                      + Hex_String (Page_Frame_Base_Address));
  2003.             Writeln;
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.           Writing Programs That Use Expanded Memory                      28
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.             {------------------------------------------------------------}
  2018.             { Write a test pattern to expanded memory.                   }
  2019.             {------------------------------------------------------------}
  2020.             For Offset := 0 to 16382 do
  2021.               Begin
  2022.                 Mem[Page_Frame_Base_Address:Offset] := Offset mod 256;
  2023.               end;
  2024.  
  2025.             {------------------------------------------------------------}
  2026.             { Make sure that what is in EMM memory is what was just      }
  2027.             { written.                                                   }
  2028.             {------------------------------------------------------------}
  2029.             Writeln ('Testing EMM memory.');
  2030.  
  2031.             Offset := 1;
  2032.             Verify := True;
  2033.             while (Offset <= 16382) and (Verify = True) do
  2034.               Begin
  2035.                 If Mem[Page_Frame_Base_Address:Offset] <> Offset mod 256
  2036.                   then Verify := False;
  2037.                 Offset := Succ (Offset);
  2038.               end; { while (Offset <= 16382) and (Verify = True) }
  2039.  
  2040.             {------------------------------------------------------------}
  2041.             { If what is read does not match what was written,           }
  2042.             { an error occurred.                                         }
  2043.             {------------------------------------------------------------}
  2044.             If not Verify then
  2045.               Error ('What was written to EMM memory was not found during'
  2046.                      + ' memory verification test.',
  2047.                      0);
  2048.             Writeln ('EMM memory test successful.');
  2049.             Writeln;
  2050.  
  2051.             {------------------------------------------------------------}
  2052.             { Return the expanded memory pages given to us back to the   }
  2053.             { EMM memory pool before terminating our test program.       }
  2054.             {------------------------------------------------------------}
  2055.             Error_Code := Deallocate_Expanded_Memory_Pages (Emm_Handle);
  2056.             If Error_Code <> STATUS_OK then
  2057.               Error ('EMM test program was unable to deallocate '
  2058.                      + 'the EMM pages in use.',
  2059.                      Error_Code);
  2060.             Writeln (APPLICATION_PAGE_COUNT,
  2061.                      ' pages(s) deallocated.');
  2062.             Writeln;
  2063.             Writeln ('EMM test program completed.');
  2064.  
  2065.           end.
  2066.  
  2067.  
  2068.  
  2069.  
  2070.           Writing Programs That Use Expanded Memory                      29
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.           Example 3
  2077.  
  2078.                This program is written in Microsoft's macro assembler.
  2079.  
  2080.  
  2081.           CODE SEGMENT
  2082.                ASSUME CS:CODE, DS:CODE
  2083.  
  2084.           MOV   AX,CS
  2085.           MOV   DX,AX
  2086.                .
  2087.                .
  2088.                .
  2089.           check_emm_installed:
  2090.  
  2091.           MOV   AH,35h                  ; AH = DOS get interrupt vector
  2092.                                         ; function
  2093.           MOV   AL,67h                  ; AL = EMM interrupt vector number
  2094.           INT   21h
  2095.           MOV   DI,0Ah                  ; ES:DI points to where device     
  2096.                                         ; name should be
  2097.           LEA   SI,EMM_device_name      ; DS:SI points to ASCII string     
  2098.                                         ; containing EMM device name
  2099.  
  2100.           MOV   CX,device_name_length   ; set up loop counter for string op
  2101.           CLD                           ; set up direction flag for forward
  2102.           REPE  CMPSB                   ; Compare the strings
  2103.           JNE   exit                    ; IF strings not equal THEN exit
  2104.                                         ; ELSE
  2105.           check_enough_unallocated_pages:
  2106.  
  2107.           MOV   AH,41h                  ;    AH = EMM get unallocated page
  2108.                                         ;    count function code
  2109.           INT   67h
  2110.           OR    AH,AH                   ; Check EMM status
  2111.           JNZ   emm_error_handler       ; IF error THEN goto error handler
  2112.                                         ; ELSE
  2113.           allocate_expanded_memory_pages:
  2114.  
  2115.           MOV   AH,43h                  ;    AH = EMM allocate pages
  2116.                                         ;    function code
  2117.           MOV   BX,2                    ;    BX = number of pages needed
  2118.           INT   67h
  2119.           OR    AH,AH                   ; Check EMM status
  2120.           JNZ   emm_error_handler       ; IF error THEN goto error handler
  2121.                                         ; ELSE
  2122.           MOV   emm_handle,DX           ;    save EMM handle
  2123.  
  2124.           map_expanded_memory_pages:
  2125.  
  2126.           MOV   AH,44h                  ; AH = EMM map pages function
  2127.           MOV   DX,emm_handle           ; DX = application's handle
  2128.  
  2129.           Writing Programs That Use Expanded Memory                      30
  2130.  
  2131.  
  2132.  
  2133.  
  2134.  
  2135.           map_0_to_0:
  2136.  
  2137.           MOV   BX,0                    ; BX = logical page 0
  2138.           MOV   AL,0                    ; AL = physical page 0
  2139.           INT   67h
  2140.           OR    AH,AH                   ; Check EMM status
  2141.           JNZ   emm_error_handler       ; If error THEN goto error handler
  2142.                                         ; ELSE
  2143.           get_page_frame_address:
  2144.  
  2145.           MOV   AH,41h                  ; AH = EMM get page frame base
  2146.                                         ; address function
  2147.           INT   67h
  2148.           OR    AH,AH                   ; Check EMM status
  2149.           JNZ   emm_error_handler       ; IF error THEN goto error handler
  2150.           MOV   pf_addr,BX              ; ELSE save pf_addr
  2151.  
  2152.           write_to_expanded_memory:     ; Write zeros to memory mapped at
  2153.                                         ; physical page 0
  2154.           MOV   AX,pf_addr
  2155.           MOV   ES,AX                   ; ES points to physical page 0
  2156.           MOV   DI,0                    ; DI indexes into physical page 0
  2157.           MOV   AL,0                    ; Initialize AL for string STOSB
  2158.           MOV   CX,4000h                ; Initialize loop counter to length 
  2159.                                         ; of expanded memory page size
  2160.           CLD                           ; set up direction flag for forward
  2161.           REP   STOSB
  2162.  
  2163.           deallocate_pages:
  2164.  
  2165.           MOV   AH,45h                  ; AH = EMM deallocate pages        
  2166.                                         ; function
  2167.           MOV   DX,emm_handle
  2168.           INT   67h                     ; return handle's pages to EMM
  2169.           OR    AH,AH                   ; Check EMM status
  2170.           JNZ   emm_error_handler       ; IF error THEN goto error handler
  2171.  
  2172.           exit:
  2173.  
  2174.           MOV   AH,4Ch                  ; AH = DOS exit function
  2175.           INT   21h                     ; return to DOS
  2176.  
  2177.  
  2178.           EMM_device_name DB 'EMMXXXX0' ; ASCII EMM device name string
  2179.  
  2180.           device_name_length EQU 8
  2181.  
  2182.           CODE ENDS
  2183.                END
  2184.  
  2185.  
  2186.  
  2187.  
  2188.           Writing Programs That Use Expanded Memory                      31
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.           Example 4
  2195.  
  2196.                This program is an example of how to exchange a 256K-byte
  2197.                block of data from conventional memory to expanded memory.
  2198.  
  2199.  
  2200.           CODE SEGMENT
  2201.                ASSUME CS:CODE, DS:CODE
  2202.                .
  2203.                .
  2204.                .
  2205.           xchg_packet_set_up:
  2206.  
  2207.           ;DS:SI = xchg_packet
  2208.  
  2209.           MOV   AX,SEG xchg_packet
  2210.           MOV   DS,AX
  2211.           MOV   SI,OFFSET xchg_packet
  2212.  
  2213.           ;Moving 256K of data from conventional memory to expanded memory
  2214.  
  2215.           MOV   WORD PTR [SI].region_length[0],0
  2216.           MOV   WORD PTR [SI].region_length[2],4
  2217.           MOV   [SI].src_mem_type,0
  2218.           MOV   [SI].dest_mem_type,1
  2219.  
  2220.           ;starting at segment: 4000h, offset: 0
  2221.  
  2222.           MOV   [SI].src_init_seg_page,4000h
  2223.           MOV   [SI].src_init_offset,0
  2224.  
  2225.           ;Move data into expanded memory logical page 0, offset 0.
  2226.  
  2227.           MOV   [SI].dest_init_seg_page,0
  2228.           MOV   [SI].dest_init_offset,0
  2229.  
  2230.           ;Initialize for future compatibility
  2231.  
  2232.           MOV   [SI].src_handle,0
  2233.  
  2234.           ;Need handle for expanded memory destination.
  2235.  
  2236.           MOV   DX,emm_handle
  2237.           MOV   [SI].dest_handle,DX
  2238.  
  2239.           ;AX = EMM Exchange Memory function
  2240.  
  2241.           MOV   AX,5701h
  2242.           INT   67h
  2243.           OR    AH,AH
  2244.           JNZ   emm_error_handler
  2245.  
  2246.  
  2247.           Writing Programs That Use Expanded Memory                      32
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.           xchg_struct                    STRUC
  2254.              region_length               DD ?
  2255.              src_mem_type                DB ?
  2256.              src_handle                  DW ?
  2257.              src_init_offset             DW ?
  2258.              src_init_seg_page           DW ?
  2259.              dest_mem_type               DB ?
  2260.              dest_handle                 DW ?
  2261.              dest_init_offset            DW ?
  2262.              dest_init_seg_page          DW ?
  2263.           xchg_struct                    ENDS
  2264.  
  2265.           xchg_packet                    xchg_struct
  2266.  
  2267.           CODE  ENDS
  2268.                 END
  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.           Writing Programs That Use Expanded Memory                      33
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.           Chapter 3
  2313.           EMM FUNCTIONS
  2314.  
  2315.  
  2316.                This chapter provides you with a standardized set of
  2317.                expanded memory functions.  Because they are standardized,
  2318.                you avoid potential compatibility problems with other
  2319.                expanded memory programs that also adhere to the memory
  2320.                manager specification.  Programs that deal directly with the
  2321.                hardware or that don't adhere to this specification will be
  2322.                incompatible.
  2323.  
  2324.                Table 3-1 presents a sequential list of the EMM functions. 
  2325.                The remainder of this chapter provides detailed descriptions
  2326.                of each function.
  2327.  
  2328.  
  2329.           Table 3-1.  List of EMM Functions
  2330.           ----------------------------------------------------------------
  2331.  
  2332.           Number             Function Name                Hex Value   Page
  2333.  
  2334.           ----------------------------------------------------------------
  2335.  
  2336.              1    Get Status                                40h         37
  2337.  
  2338.              2    Get Page Frame Address                    41h         38
  2339.  
  2340.              3    Get Unallocated Page Count                42h         40
  2341.  
  2342.              4    Allocate Pages                            43h         42
  2343.  
  2344.              5    Map/Unmap Handle Page                     44h         46
  2345.  
  2346.              6    Deallocate Pages                          45h         49
  2347.  
  2348.              7    Get Version                               46h         51
  2349.  
  2350.              8    Save Page Map                             47h         53
  2351.  
  2352.              9    Restore Page Map                          48h         55
  2353.  
  2354.             10    Reserved                                  49h         57
  2355.  
  2356.             11    Reserved                                  4Ah         58
  2357.  
  2358.             12    Get Handle Count                          4Bh         59
  2359.  
  2360.             13    Get Handle Pages                          4Ch         61
  2361.  
  2362.             14    Get All Handle Pages                      4Dh         63
  2363.  
  2364.  
  2365.           EMM Functions                                                  34
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.           Table 3-1.  List of EMM Functions (continued)
  2372.           ----------------------------------------------------------------
  2373.  
  2374.           Number             Function Name                Hex Value   Page
  2375.  
  2376.           ----------------------------------------------------------------
  2377.  
  2378.             15    Get Page Map                              4E00h       65
  2379.                   Set Page Map                              4E01h       67
  2380.                   Get & Set Page Map                        4E02h       69
  2381.                   Get Size of Page Map Save Array           4E03h       71
  2382.  
  2383.             16    Get Partial Page Map                      4F00h       73
  2384.                   Set Partial Page Map                      4F01h       76
  2385.                   Get Size of Partial Page Map
  2386.                      Save Array                             4F02h       78
  2387.  
  2388.             17    Map/Unmap Multiple Handle Pages
  2389.                   (Physical page number mode)               5000h       82
  2390.                   Map/Unmap Multiple Handle Pages
  2391.                   (Segment address mode)                    5001h       85
  2392.  
  2393.             18    Reallocate Pages                          51h         88
  2394.  
  2395.             19    Get Handle Attribute                      5200h       92
  2396.                   Set Handle Attribute                      5201h       94
  2397.                   Get Handle Attribute Capability           5202h       96
  2398.  
  2399.             20    Get Handle Name                           5300h       98
  2400.                   Set Handle Name                           5301h      100
  2401.  
  2402.             21    Get Handle Directory                      5400h      102
  2403.                   Search for Named Handle                   5401h      105
  2404.                   Get Total Handles                         5402h      107
  2405.  
  2406.             22    Alter Page Map & Jump
  2407.                   (Physical page number mode)               5500h      109
  2408.                   Alter Page Map & Jump
  2409.                   (Segment address mode)                    5501h      109
  2410.  
  2411.             23    Alter Page Map & Call
  2412.                   (Physical page number mode)               5600h      113
  2413.                   Alter Page Map & Call
  2414.                   (Segment address mode)                    5601h      113
  2415.                   Get Page Map Stack Space Size             5602h      118
  2416.  
  2417.             24    Move Memory Region                        5700h      120
  2418.                   Exchange Memory Region                    5701h      126
  2419.  
  2420.             25    Get Mappable Physical Address Array       5800h      132
  2421.                   Get Mappable Physical Address Array
  2422.                      Entries                                5801h      136
  2423.  
  2424.           EMM Functions                                                  35
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430.           Table 3-1.  List of EMM Functions (continued)
  2431.           ----------------------------------------------------------------
  2432.  
  2433.           Number             Function Name                Hex Value   Page
  2434.  
  2435.           ----------------------------------------------------------------
  2436.  
  2437.             26    Get Hardware Configuration Array          5900h      138
  2438.                   Get Unallocated Raw Page Count            5901h      142
  2439.  
  2440.             27    Allocate Standard Pages                   5A00h      144
  2441.                   Allocate Raw Pages                        5A01h      147
  2442.  
  2443.             28    Get Alternate Map Register Set            5B00h      153
  2444.                   Set Alternate Map Register Set            5B01h      157
  2445.                   Get Alternate Map Save Array Size         5B02h      161
  2446.                   Allocate Alternate Map Register Set       5B03h      163
  2447.                   Deallocate Alternate Map Register Set     5B04h      166
  2448.                   Allocate DMA Register Set                 5B05h      168
  2449.                   Enable DMA on Alternate Map
  2450.                      Register Set                           5B06h      170
  2451.                   Disable DMA on Alternate Map
  2452.                      Register Set                           5B07h      173
  2453.                   Deallocate DMA Register Set               5B08h      175
  2454.  
  2455.             29    Prepare Expanded Memory Hardware
  2456.                      for Warmboot                           5Ch        177
  2457.  
  2458.             30    Enable OS/E Function Set                  5D00h      179
  2459.                   Disable OS/E Function Set                 5D01h      182
  2460.                   Return OS/E Access Key                    5D02h      185
  2461.  
  2462.           ----------------------------------------------------------------
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.  
  2472.  
  2473.  
  2474.  
  2475.  
  2476.  
  2477.  
  2478.  
  2479.  
  2480.  
  2481.  
  2482.  
  2483.           EMM Functions                                                  36
  2484.  
  2485.  
  2486.  
  2487.  
  2488.  
  2489.           Function 1. Get Status
  2490.  
  2491.  
  2492.  
  2493.           PURPOSE
  2494.  
  2495.                The Get Status function returns a status code indicating
  2496.                whether the memory manager is present and the hardware is
  2497.                working correctly.
  2498.  
  2499.  
  2500.           CALLING PARAMETERS
  2501.  
  2502.                AH = 40h
  2503.                    Contains the Get Status Function.
  2504.  
  2505.  
  2506.           REGISTERS MODIFIED
  2507.  
  2508.                AX
  2509.  
  2510.  
  2511.           STATUS
  2512.  
  2513.                AH = 0   SUCCESSFUL.
  2514.                    The manager is present in the system, and the hardware
  2515.                    is working correctly.
  2516.  
  2517.                AH = 80h   NON-RECOVERABLE.
  2518.                    The manager detected a malfunction in the memory manager
  2519.                    software.
  2520.  
  2521.                AH = 81h   NON-RECOVERABLE.
  2522.                    The manager detected a malfunction in the expanded
  2523.                    memory hardware.
  2524.  
  2525.                AH = 84h   NON-RECOVERABLE.
  2526.                    The function code passed to the memory manager is not
  2527.                    defined.
  2528.  
  2529.  
  2530.           EXAMPLE
  2531.  
  2532.           MOV   AH,40h                   ; load function code
  2533.           INT   67h                      ; call the memory manager
  2534.           OR    AH,AH                    ; check EMM status
  2535.           JNZ   emm_err_handler          ; jump to error handler on error
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542.           EMM Functions                                                  37
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.           Function 2. Get Page Frame Address
  2549.  
  2550.  
  2551.  
  2552.           PURPOSE
  2553.  
  2554.                The Get Page Frame Address function returns the segment
  2555.                address where the page frame is located.
  2556.  
  2557.  
  2558.           CALLING PARAMETERS
  2559.  
  2560.                AH = 41h
  2561.                    Contains the Get Page Frame Address function.
  2562.  
  2563.  
  2564.           RESULTS
  2565.  
  2566.                These results are valid only if the status returned is zero.
  2567.  
  2568.                BX = page frame segment address
  2569.                    Contains the segment address of the page frame.
  2570.  
  2571.  
  2572.           REGISTERS MODIFIED
  2573.  
  2574.                AX, BX
  2575.  
  2576.  
  2577.           STATUS
  2578.  
  2579.                AH = 0   SUCCESSFUL.
  2580.                    The manager has returned the page frame address in the
  2581.                    BX register.
  2582.  
  2583.                AH = 80h   NON-RECOVERABLE.
  2584.                    The manager detected a malfunction in the memory manager
  2585.                    software.
  2586.  
  2587.                AH = 81h   NON-RECOVERABLE.
  2588.                    The manager detected a malfunction in the expanded
  2589.                    memory hardware.
  2590.  
  2591.                AH = 84h   NON-RECOVERABLE.
  2592.                    The function code passed to the memory manager is not
  2593.                    defined.
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600.  
  2601.           EMM Functions                                                  38
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.           Function 2. Get Page Frame Address
  2608.  
  2609.  
  2610.  
  2611.           EXAMPLE
  2612.  
  2613.           page_frame_segment             DW ?
  2614.  
  2615.           MOV   AH,41h                   ; load function code
  2616.           INT   67h                      ; call the memory manager
  2617.           OR    AH,AH                    ; check EMM status
  2618.           JNZ   emm_err_handler          ; jump to error handler on error
  2619.           MOV   page_frame_segment,BX    ; save page frame address
  2620.  
  2621.  
  2622.  
  2623.  
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.  
  2651.  
  2652.  
  2653.  
  2654.  
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.           EMM Functions                                                  39
  2661.  
  2662.  
  2663.  
  2664.  
  2665.  
  2666.           Function 3. Get Unallocated Page Count
  2667.  
  2668.  
  2669.  
  2670.           PURPOSE
  2671.  
  2672.                The Get Unallocated Page Count function returns the number
  2673.                of unallocated pages and the total number of expanded memory
  2674.                pages.
  2675.  
  2676.  
  2677.           CALLING PARAMETERS
  2678.  
  2679.                AH = 42h
  2680.                    Contains the Get Unallocated Page Count function.
  2681.  
  2682.  
  2683.           RESULTS
  2684.  
  2685.                These results are valid only if the status returned is zero.
  2686.  
  2687.                BX = unallocated pages
  2688.                    The number of expanded memory pages that are currently
  2689.                    available for use (unallocated).
  2690.  
  2691.                DX = total pages
  2692.                    The total number of expanded memory pages.
  2693.  
  2694.  
  2695.           REGISTERS MODIFIED
  2696.  
  2697.                AX, BX, DX
  2698.  
  2699.  
  2700.           STATUS
  2701.  
  2702.                AH = 0   SUCCESSFUL.
  2703.                    The manager has returned the number of unallocated pages
  2704.                    and the number of total pages in expanded memory.
  2705.  
  2706.                AH = 80h   NON-RECOVERABLE.
  2707.                    The manager detected a malfunction in the memory manager
  2708.                    software.
  2709.  
  2710.                AH = 81h   NON-RECOVERABLE.
  2711.                    The manager detected a malfunction in the expanded
  2712.                    memory hardware.
  2713.  
  2714.                AH = 84h   NON-RECOVERABLE.
  2715.                    The function code passed to the memory manager is not
  2716.                    defined.
  2717.  
  2718.  
  2719.           EMM Functions                                                  40
  2720.  
  2721.  
  2722.  
  2723.  
  2724.  
  2725.           Function 3. Get Unallocated Page Count
  2726.  
  2727.  
  2728.  
  2729.           EXAMPLE
  2730.  
  2731.           un_alloc_pages                 DW ?
  2732.           total_pages                    DW ?
  2733.  
  2734.           MOV   AH,42h                   ; load function code
  2735.           INT   67h                      ; call the memory manager
  2736.           OR    AH,AH                    ; check EMM status
  2737.           JNZ   emm_err_handler          ; jump to error handler on error
  2738.           MOV   un_alloc_pages,BX        ; save unallocated page count
  2739.           MOV   total_pages,DX           ; save total page count
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.  
  2777.  
  2778.           EMM Functions                                                  41
  2779.  
  2780.  
  2781.  
  2782.  
  2783.  
  2784.           Function 4. Allocate Pages
  2785.  
  2786.  
  2787.  
  2788.                The Allocate Pages function allocates the number of pages
  2789.                requested and assigns a unique EMM handle to these pages. 
  2790.                The EMM handle owns these pages until the application
  2791.                deallocates them.
  2792.  
  2793.                Handles which are assigned using this function will have
  2794.                16K-byte pages, the size of a standard expanded memory page. 
  2795.                If the expanded memory board hardware isn't able to supply
  2796.                16K-byte pages, it will emulate them by combining multiple
  2797.                non-standard size pages to form a single 16K-byte page.  All
  2798.                application programs and functions that use the handles this
  2799.                function returns will deal with 16K-byte pages.
  2800.  
  2801.                The numeric value of the handles the EMM returns are in the
  2802.                range of 1 to 254 decimal (0001h to 00FEh).  The OS handle
  2803.                (handle value 0) is never returned by the Allocate Pages
  2804.                function.  Also, the uppermost byte of the handle will be
  2805.                zero and cannot be used by the application.  A memory
  2806.                manager should be able to supply up to 255 handles, includ-
  2807.                ing the OS handle.  An application can use Function 21 to
  2808.                find out how many handles an EMM supports.
  2809.  
  2810.                Allocating zero pages to a handle is not valid.  If an
  2811.                application needs to allocate 0 pages to a handle it should
  2812.                use Function 27 (Allocate Standard Pages subfunction)
  2813.                provided for this purpose.
  2814.  
  2815.           Note............................................................
  2816.                This note affects expanded memory manager implementors and
  2817.                operating system developers only.  Applications should not
  2818.                use the following characteristics of the memory manager.  An
  2819.                application violating this rule will be incompatible with
  2820.                future versions of Microsoft's operating systems and
  2821.                environments.
  2822.  
  2823.                To be compatible with this specification, an expanded memory
  2824.                manager will provide a special handle which is available to
  2825.                the operating system only.  This handle will have a value of
  2826.                0000h and will have a set of pages allocated to it when the
  2827.                expanded memory manager driver installs.  The pages that the
  2828.                memory manager will automatically allocate to handle 0000h
  2829.                are those that backfill conventional memory.  Typically,
  2830.                this backfill occurs between addresses 40000h (256K) and
  2831.                9FFFFh (640K).  However, the range can extend below and
  2832.                above this limit if the hardware and memory manager have the
  2833.                capability.
  2834.  
  2835.  
  2836.  
  2837.           EMM Functions                                                  42
  2838.  
  2839.  
  2840.  
  2841.  
  2842.  
  2843.           Function 4. Allocate Pages
  2844.  
  2845.  
  2846.  
  2847.                An operating system won't have to invoke Function 4 to
  2848.                obtain this handle because it can assume the handle already
  2849.                exists and is available for use immediately after the
  2850.                expanded memory device driver installs.  When an operating
  2851.                system wants to use this handle, it uses the special handle
  2852.                value of 0000h.  The operating system will be able to invoke
  2853.                any EMM function using this special handle value.  To
  2854.                allocate pages to this handle, the operating system need
  2855.                only invoke Function 18 (Reallocate Pages).
  2856.  
  2857.                There are two special cases for this handle:
  2858.  
  2859.                1.  Function 4 (Allocate Pages).  This function must never
  2860.                    return zero as a handle value.  Applications must always
  2861.                    invoke Function 4 to allocate pages and obtain a handle
  2862.                    which identifies the pages which belong to it.  Since
  2863.                    Function 4 never returns a handle value of zero, an
  2864.                    application will never gain access to this special
  2865.                    handle.
  2866.  
  2867.                2.  Function 6 (Deallocate Pages).  If the operating system
  2868.                    uses it to deallocate the pages which are allocated to
  2869.                    this special handle, the pages the handle owns will be
  2870.                    returned to the manager for use.  But the handle will
  2871.                    not be available for reassignment.  The manager should
  2872.                    treat a deallocate pages function request for this
  2873.                    handle the same as a reallocate pages function request,
  2874.                    where the number of pages to reallocate to this handle
  2875.                    is zero.
  2876.  
  2877.  
  2878.           CALLING PARAMETERS
  2879.  
  2880.                AH = 43h
  2881.                    Contains the Allocate Pages function.
  2882.  
  2883.                BX = num_of_pages_to_alloc
  2884.                    Contains the number of pages you want your program to
  2885.                    allocate.
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.           EMM Functions                                                  43
  2897.  
  2898.  
  2899.  
  2900.  
  2901.  
  2902.           Function 4. Allocate Pages
  2903.  
  2904.  
  2905.  
  2906.           RESULTS
  2907.  
  2908.                These results are valid only if the status returned is zero.
  2909.  
  2910.                DX = handle
  2911.                    Contains a unique EMM handle.  Your program must use
  2912.                    this EMM handle (as a parameter) in any function that
  2913.                    requires it.  You can use up to 255 handles.  The
  2914.                    uppermost byte of the handle will be zero and cannot be
  2915.                    used by the application.
  2916.  
  2917.  
  2918.           REGISTERS MODIFIED
  2919.  
  2920.                AX, DX
  2921.  
  2922.  
  2923.           STATUS
  2924.  
  2925.                AH = 0   SUCCESSFUL.
  2926.                    The manager has allocated the requested pages to the
  2927.                    assigned EMM handle.
  2928.  
  2929.                AH = 80h   NON-RECOVERABLE.
  2930.                    The manager detected a malfunction in the memory manager
  2931.                    software.
  2932.  
  2933.                AH = 81h   NON-RECOVERABLE.
  2934.                    The manager detected a malfunction in the expanded
  2935.                    memory hardware.
  2936.  
  2937.                AH = 84h   NON-RECOVERABLE.
  2938.                    The function code passed to the memory manager is not
  2939.                    defined.
  2940.  
  2941.                AH = 85h   RECOVERABLE.
  2942.                    All EMM handles are being used.
  2943.  
  2944.                AH = 87h   RECOVERABLE.
  2945.                    There aren't enough expanded memory pages present in the
  2946.                    system to satisfy your program's request.
  2947.  
  2948.                AH = 88h   RECOVERABLE.
  2949.                    There aren't enough unallocated pages to satisfy your
  2950.                    program's request.
  2951.  
  2952.                AH = 89h   RECOVERABLE.
  2953.                    Your program attempted to allocate zero pages.
  2954.  
  2955.           EMM Functions                                                  44
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.           Function 4. Allocate Pages
  2962.  
  2963.  
  2964.  
  2965.           EXAMPLE
  2966.  
  2967.           num_of_pages_to_alloc          DW ?
  2968.           emm_handle                     DW ?
  2969.  
  2970.           MOV   BX,num_of_pages_to_alloc ; load number of pages
  2971.           MOV   AH,43h                   ; load function code
  2972.           INT   67h                      ; call the memory manager
  2973.           OR    AH,AH                    ; check EMM status
  2974.           JNZ   emm_err_handler          ; jump to error handler on error
  2975.           MOV   emm_handle,DX            ; save EMM handle
  2976.  
  2977.  
  2978.  
  2979.  
  2980.  
  2981.  
  2982.  
  2983.  
  2984.  
  2985.  
  2986.  
  2987.  
  2988.  
  2989.  
  2990.  
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.  
  3000.  
  3001.  
  3002.  
  3003.  
  3004.  
  3005.  
  3006.  
  3007.  
  3008.  
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.           EMM Functions                                                  45
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.           Function 5. Map/Unmap Handle Pages
  3021.  
  3022.  
  3023.  
  3024.           PURPOSE
  3025.  
  3026.                The Map/Unmap Handle Page function maps a logical page at a
  3027.                specific physical page anywhere in the mappable regions of
  3028.                system memory.  The lowest valued physical page numbers are
  3029.                associated with regions of memory outside the conventional
  3030.                memory range.  Use Function 25 (Get Mappable Physical
  3031.                Address Array) to determine which physical pages within a
  3032.                system are mappable and determine the segment addresses
  3033.                which correspond to a specific physical page number. 
  3034.                Function 25 provides a cross reference between physical page
  3035.                numbers and segment addresses.
  3036.  
  3037.                This function can also unmap physical pages, making them
  3038.                inaccessible for reading or writing.  You unmap a physical
  3039.                page by setting its associated logical page to FFFFh.
  3040.  
  3041.                You might unmap an entire set of mapped pages, for example,
  3042.                before loading and executing a program.  Doing so ensures
  3043.                the loaded program, if it accesses expanded memory, won't
  3044.                access the pages your program has mapped.  However, you must
  3045.                save the mapped context before you unmap the physical pages. 
  3046.                This enables you to restore it later so you can access the
  3047.                memory you mapped there.  To save the mapping context, use
  3048.                Function 8, 15, or 16.  To restore the mapping context, use
  3049.                Function 9, 15, or 16.
  3050.  
  3051.                The handle determines what type of pages are being mapped. 
  3052.                Logical pages allocated by Function 4 and Function 27
  3053.                (Allocate Standard Pages subfunction) are referred to as
  3054.                pages and are 16K bytes long.  Logical pages allocated by
  3055.                Function 27 (Allocate Raw Pages subfunction) are referred to
  3056.                as raw pages and might not be the same size as logical
  3057.                pages.
  3058.  
  3059.  
  3060.           CALLING PARAMETERS
  3061.  
  3062.                AH = 44h
  3063.                    Contains the Map Handle Page function.
  3064.  
  3065.                AL = physical_page_number
  3066.                    Contains the number of the physical page into which the
  3067.                    logical page number is to be mapped.  Physical pages are
  3068.                    numbered zero-relative.
  3069.  
  3070.  
  3071.  
  3072.  
  3073.           EMM Functions                                                  46
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.           Function 5. Map/Unmap Handle Pages
  3080.  
  3081.  
  3082.  
  3083.                BX = logical_page_number
  3084.                    Contains the number of the logical page to be mapped at
  3085.                    the physical page within the page frame.  Logical pages
  3086.                    are numbered zero-relative.  The logical page must be in
  3087.                    the range zero through (number of pages allocated to the
  3088.                    EMM handle - 1).  However, if BX contains logical page
  3089.                    number FFFFh, the physical page specified in AL will be
  3090.                    unmapped (be made inaccessible for reading or writing).
  3091.  
  3092.                DX = emm_handle
  3093.                    Contains the EMM handle your program received from
  3094.                    Function 4 (Allocate Pages).
  3095.  
  3096.  
  3097.           REGISTERS MODIFIED
  3098.  
  3099.                AX
  3100.  
  3101.  
  3102.           STATUS
  3103.  
  3104.                AH = 0   SUCCESSFUL.
  3105.                    The manager has mapped the page.  The page is ready to
  3106.                    be accessed.
  3107.  
  3108.                AH = 80h   NON-RECOVERABLE.
  3109.                    The manager detected a malfunction in the memory manager
  3110.                    software.
  3111.  
  3112.                AH = 81h   NON-RECOVERABLE.
  3113.                    The manager detected a malfunction in the expanded
  3114.                    memory hardware.
  3115.  
  3116.                AH = 83h   NON-RECOVERABLE.
  3117.                    The memory manager couldn't find the EMM handle your
  3118.                    program specified.
  3119.  
  3120.                AH = 84h   NON-RECOVERABLE.
  3121.                    The function code passed to the memory manager isn't
  3122.                    defined.
  3123.  
  3124.                AH = 8Ah   RECOVERABLE.
  3125.                    The logical page is out of the range of logical pages
  3126.                    which are allocated to the EMM handle.  This status is
  3127.                    also returned if a program attempts to map a logical
  3128.                    page when no logical pages are allocated to the handle.
  3129.  
  3130.  
  3131.  
  3132.           EMM Functions                                                  47
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.           Function 5. Map/Unmap Handle Pages
  3139.  
  3140.  
  3141.  
  3142.                AH = 8Bh   RECOVERABLE.
  3143.                    The physical page number is out of the range of allow-
  3144.                    able physical pages.  The program can recover by
  3145.                    attempting to map into memory at a physical page which
  3146.                    is within the range of allowable physical pages.
  3147.  
  3148.  
  3149.           EXAMPLE
  3150.  
  3151.           emm_handle                     DW ?
  3152.           logical_page_number            DW ?
  3153.           physical_page_number           DB ?
  3154.  
  3155.           MOV   DX,emm_handle            ; load EMM handle
  3156.           MOV   BX,logical_page_number   ; load logical page number
  3157.           MOV   AL,physical_page_number  ; load physical page number
  3158.           MOV   AH,44h                   ; load function code
  3159.           INT   67h                      ; call the memory manager
  3160.           OR    AH,AH                    ; check EMM status
  3161.           JNZ   emm_err_handler          ; jump to error handler on error
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.  
  3176.  
  3177.  
  3178.  
  3179.  
  3180.  
  3181.  
  3182.  
  3183.  
  3184.  
  3185.  
  3186.  
  3187.  
  3188.  
  3189.  
  3190.  
  3191.           EMM Functions                                                  48
  3192.  
  3193.  
  3194.  
  3195.  
  3196.  
  3197.           Function 6. Deallocate Pages
  3198.  
  3199.  
  3200.  
  3201.           PURPOSE
  3202.  
  3203.                Deallocate Pages deallocates the logical pages currently
  3204.                allocated to an EMM handle.  Only after the application
  3205.                deallocates these pages can other applications use them. 
  3206.                When a handle is deallocated, its name is set to all ASCII
  3207.                nulls (binary zeros).
  3208.  
  3209.           Note............................................................
  3210.                A program must perform this function before it exits to DOS. 
  3211.                If it doesn't, no other programs can use these pages or the
  3212.                EMM handle.  This means that a program using expanded memory
  3213.                should trap critical errors and control-break if there is a
  3214.                chance that the program will have allocated pages when
  3215.                either of these events occur.
  3216.  
  3217.  
  3218.           CALLING PARAMETERS
  3219.  
  3220.                AH = 45h
  3221.                    Contains the Deallocate Pages function.
  3222.  
  3223.                DX = handle
  3224.                    Contains the EMM handle returned by Function 4 (Allocate
  3225.                    Pages).
  3226.  
  3227.  
  3228.           REGISTERS MODIFIED
  3229.  
  3230.                AX
  3231.  
  3232.  
  3233.           STATUS
  3234.  
  3235.                AH = 0   SUCCESSFUL.
  3236.                    The manager has deallocated the pages previously allo-
  3237.                    cated to the EMM handle.
  3238.  
  3239.                AH = 80h   NON-RECOVERABLE.
  3240.                    The manager detected a malfunction in the memory manager
  3241.                    software.
  3242.  
  3243.                AH = 81h   NON-RECOVERABLE.
  3244.                    The manager detected a malfunction in the expanded
  3245.                    memory hardware.
  3246.  
  3247.                AH = 83h   NON-RECOVERABLE.
  3248.                    The manager couldn't find the specified EMM handle.
  3249.  
  3250.           EMM Functions                                                  49
  3251.  
  3252.  
  3253.  
  3254.  
  3255.  
  3256.           Function 6. Deallocate Pages
  3257.  
  3258.  
  3259.  
  3260.                AH = 84h   NON-RECOVERABLE.
  3261.                    The function code passed to the memory manager is not
  3262.                    defined.
  3263.  
  3264.                AH = 86h   RECOVERABLE.
  3265.                    The memory manager detected a save or restore page
  3266.                    mapping context error (Function 8 or 9).  There is a
  3267.                    page mapping register state in the save area for the
  3268.                    specified EMM handle.  Save Page Map (Function 8) placed
  3269.                    it there and a subsequent Restore Page Map (Function 9)
  3270.                    has not removed it.
  3271.  
  3272.                    If you have saved the mapping context, you must restore
  3273.                    it before you deallocate the EMM handle's pages.
  3274.  
  3275.  
  3276.           EXAMPLE
  3277.  
  3278.           emm_handle                     DW ?
  3279.  
  3280.           MOV   DX,emm_handle            ; load EMM handle
  3281.           MOV   AH,45h                   ; load function code
  3282.           INT   67h                      ; call the memory manager
  3283.           OR    AH,AH                    ; check EMM status
  3284.           JNZ   emm_err_handler          ; jump to error handler on error
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.  
  3309.           EMM Functions                                                  50
  3310.  
  3311.  
  3312.  
  3313.  
  3314.  
  3315.           Function 7. Get Version
  3316.  
  3317.  
  3318.  
  3319.           PURPOSE
  3320.  
  3321.                The Get Version function returns the version number of the
  3322.                memory manager software.
  3323.  
  3324.  
  3325.           CALLING PARAMETERS
  3326.  
  3327.                AH = 46h
  3328.                    Contains the Get Version function.
  3329.  
  3330.  
  3331.           RESULTS
  3332.  
  3333.                These results are valid only if the status returned is zero.
  3334.  
  3335.                AL = version number
  3336.                    Contains the memory manager's version number in binary
  3337.                    coded decimal (BCD) format.  The upper four bits contain
  3338.                    the integer digit of the version number.  The lower four
  3339.                    bits contain the fractional digit of version number. 
  3340.                    For example, version 4.0 is represented like this:
  3341.  
  3342.                                       0100 0000
  3343.                                         /   \
  3344.                                        4  .  0
  3345.  
  3346.                    When checking for a version number, an application
  3347.                    should check for a version number or greater.  Vendors
  3348.                    may use the fractional digit to indicate enhancements or
  3349.                    corrections to their memory managers.  Therefore, to
  3350.                    allow for future versions of memory managers, an
  3351.                    application shouldn't depend on an exact version number.
  3352.  
  3353.  
  3354.           REGISTERS MODIFIED
  3355.  
  3356.                AX
  3357.  
  3358.  
  3359.           STATUS
  3360.  
  3361.                AH = 0   SUCCESSFUL.
  3362.                    The manager is present in the system and the hardware is
  3363.                    working correctly.
  3364.  
  3365.  
  3366.  
  3367.  
  3368.           EMM Functions                                                  51
  3369.  
  3370.  
  3371.  
  3372.  
  3373.  
  3374.           Function 7. Get Version
  3375.  
  3376.  
  3377.  
  3378.                AH = 80h   NON-RECOVERABLE.
  3379.                    The manager detected a malfunction in the memory manager
  3380.                    software.
  3381.  
  3382.                AH = 81h   NON-RECOVERABLE.
  3383.                    The manager detected a malfunction in the expanded
  3384.                    memory hardware.
  3385.  
  3386.                AH = 84h   NON-RECOVERABLE.
  3387.                    The function code passed to the memory manager is not
  3388.                    defined.
  3389.  
  3390.  
  3391.           EXAMPLE
  3392.  
  3393.           emm_version                    DB ?
  3394.  
  3395.           MOV   AH,46h                   ; load function code
  3396.           INT   67h                      ; call the memory manager
  3397.           OR    AH,AH                    ; check EMM status
  3398.           JNZ   emm_err_handler          ; jump to error handler on error
  3399.           MOV   emm_version,AL           ; save version number
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.           EMM Functions                                                  52
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.           Function 8. Save Page Map
  3434.  
  3435.  
  3436.  
  3437.           PURPOSE
  3438.  
  3439.                Save Page Map saves the contents of the page mapping
  3440.                registers on all expanded memory boards in an internal save
  3441.                area.  The function is typically used to save the memory
  3442.                mapping context of the EMM handle that was active when a
  3443.                software or hardware interrupt occurred.  (See Function 9,
  3444.                Restore Page Map, for the restore operation.)
  3445.  
  3446.                If you're writing a resident program, an interrupt service
  3447.                routine, or a device driver that uses expanded memory, you
  3448.                must save the state of the mapping hardware.  You must save
  3449.                this state because application software using expanded
  3450.                memory may be running when your program is invoked by a
  3451.                hardware interrupt, a software interrupt, or DOS.
  3452.  
  3453.                The Save Page Map function requires the EMM handle that was
  3454.                assigned to your resident program, interrupt service
  3455.                routine, or device driver at the time it was initialized. 
  3456.                This is not the EMM handle that the application software was
  3457.                using when your software interrupted it.
  3458.  
  3459.                The Save Page Map function saves the state of the map
  3460.                registers for only the 64K-byte page frame defined in
  3461.                versions 3.x of this specification.  Since all applications
  3462.                written to LIM versions 3.x require saving the map register
  3463.                state of only this 64K-byte page frame, saving the entire
  3464.                mapping state for a large number of mappable pages would be
  3465.                inefficient use of memory.  Applications that use a mappable
  3466.                memory region outside the LIM 3.x page frame should use
  3467.                Function 15 or 16 to save and restore the state of the map
  3468.                registers.
  3469.  
  3470.  
  3471.           CALLING PARAMETERS
  3472.  
  3473.                AH = 47h
  3474.                    Contains the Save Page Map function.
  3475.  
  3476.                DX = handle
  3477.                    Contains the EMM handle assigned to the interrupt
  3478.                    service routine that's servicing the software or
  3479.                    hardware interrupt.  The interrupt service routine needs
  3480.                    to save the state of the page mapping hardware before
  3481.                    mapping any pages.
  3482.  
  3483.  
  3484.  
  3485.  
  3486.           EMM Functions                                                  53
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.           Function 8. Save Page Map
  3493.  
  3494.  
  3495.  
  3496.           REGISTERS MODIFIED
  3497.  
  3498.                AX
  3499.  
  3500.  
  3501.           STATUS
  3502.  
  3503.                AH = 0   SUCCESSFUL.
  3504.                    The manager has saved the state of the page mapping
  3505.                    hardware.
  3506.  
  3507.                AH = 80h   NON-RECOVERABLE.
  3508.                    The manager detected a malfunction in the memory manager
  3509.                    software.
  3510.  
  3511.                AH = 81h   NON-RECOVERABLE.
  3512.                    The manager detected a malfunction in the expanded
  3513.                    memory hardware.
  3514.  
  3515.                AH = 83h   NON-RECOVERABLE.
  3516.                    The memory manager couldn't find the EMM handle your
  3517.                    program specified.
  3518.  
  3519.                AH = 84h   NON-RECOVERABLE.
  3520.                    The function code passed to the memory manager is not
  3521.                    defined.
  3522.  
  3523.                AH = 8Ch   NON-RECOVERABLE.
  3524.                    There is no room in the save area to store the state of
  3525.                    the page mapping registers.  The state of the map
  3526.                    registers has not been saved.
  3527.  
  3528.                AH = 8Dh   CONDITIONALLY-RECOVERABLE.
  3529.                    The save area already contains the page mapping register
  3530.                    state for the EMM handle your program specified.
  3531.  
  3532.  
  3533.           EXAMPLE
  3534.  
  3535.           emm_handle                     DW ?
  3536.  
  3537.           MOV   DX,emm_handle            ; load EMM handle
  3538.           MOV   AH,47h                   ; load function code
  3539.           INT   67h                      ; call the memory manager
  3540.           OR    AH,AH                    ; check EMM status
  3541.           JNZ   emm_err_handler          ; jump to error handler on error
  3542.  
  3543.  
  3544.  
  3545.           EMM Functions                                                  54
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.           Function 9. Restore Page Map
  3552.  
  3553.  
  3554.  
  3555.           PURPOSE
  3556.  
  3557.                The Restore Page Map function restores the page mapping
  3558.                register contents on the expanded memory boards for a
  3559.                particular EMM handle.  This function lets your program
  3560.                restore the contents of the mapping registers its EMM handle
  3561.                saved.  (See Function 8, Save Page Map for the save opera-
  3562.                tion.)
  3563.  
  3564.                If you're writing a resident program, an interrupt service
  3565.                routine, or a device driver that uses expanded memory, you
  3566.                must restore the mapping hardware to the state it was in
  3567.                before your program took over.  You must save this state
  3568.                because application software using expanded memory might
  3569.                have been running when your program was invoked.
  3570.  
  3571.                The Restore Page Map function requires the EMM handle that
  3572.                was assigned to your resident program, interrupt service
  3573.                routine, or device driver at the time it was initialized. 
  3574.                This is not the EMM handle that the application software was
  3575.                using when your software interrupted it.
  3576.  
  3577.                The Restore Page Map function restores the state of the map
  3578.                registers for only the 64K-byte page frame defined in
  3579.                versions 3.x of this specification.  Since all applications
  3580.                written to LIM versions 3.x require restoring the map
  3581.                register state of only this 64K-byte page frame, restoring
  3582.                the entire mapping state for a large number of mappable
  3583.                pages would be inefficient use of memory.  Applications that
  3584.                use a mappable memory region outside the LIM 3.x page frame
  3585.                should use Function 15 or 16 to save and restore the state
  3586.                of the map registers.
  3587.  
  3588.  
  3589.           CALLING PARAMETERS
  3590.  
  3591.                AH = 48h
  3592.                    Contains the Restore Page Map function.
  3593.  
  3594.                DX = emm_handle
  3595.                    Contains the EMM handle assigned to the interrupt
  3596.                    service routine that's servicing the software or
  3597.                    hardware interrupt.  The interrupt service routine needs
  3598.                    to restore the state of the page mapping hardware.
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.           EMM Functions                                                  55
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.           Function 9. Restore Page Map
  3611.  
  3612.  
  3613.  
  3614.           REGISTERS MODIFIED
  3615.  
  3616.                AX
  3617.  
  3618.  
  3619.           STATUS
  3620.  
  3621.                AH = 0   SUCCESSFUL.
  3622.                    The manager has restored the state of the page mapping
  3623.                    registers.
  3624.  
  3625.                AH = 80h   NON-RECOVERABLE.
  3626.                    The manager detected a malfunction in the memory manager
  3627.                    software.
  3628.  
  3629.                AH = 81h   NON-RECOVERABLE.
  3630.                    The manager detected a malfunction in the expanded
  3631.                    memory hardware.
  3632.  
  3633.                AH = 83h   NON-RECOVERABLE.
  3634.                    The memory manager couldn't find the EMM handle your
  3635.                    program specified.
  3636.  
  3637.                AH = 84h   NON-RECOVERABLE.
  3638.                    The function code passed to the memory manager is not
  3639.                    defined.
  3640.  
  3641.                AH = 8Eh   CONDITIONALLY-RECOVERABLE.
  3642.                    There is no page mapping register state in the save area
  3643.                    for the specified EMM handle.  Your program didn't save
  3644.                    the contents of the page mapping hardware, so Restore
  3645.                    Page can't restore it.
  3646.  
  3647.  
  3648.           EXAMPLE
  3649.  
  3650.           emm_handle                     DW ?
  3651.  
  3652.           MOV   DX,emm_handle            ; load EMM handle
  3653.           MOV   AH,48h                   ; load function code
  3654.           INT   67h                      ; call the memory manager
  3655.           OR    AH,AH                    ; check EMM status
  3656.           JNZ   emm_err_handler          ; jump to error handler on error
  3657.  
  3658.  
  3659.  
  3660.  
  3661.  
  3662.  
  3663.           EMM Functions                                                  56
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.           Function 10. Reserved
  3670.  
  3671.  
  3672.  
  3673.                In earlier versions of the Lotus/Intel/Microsoft Expanded
  3674.                Memory Specification, Function 10 returned the page mapping
  3675.                register I/O array.  This function is now reserved and new
  3676.                programs should not use it.
  3677.  
  3678.                Existing programs that use this function may still work
  3679.                correctly if the hardware is capable of supporting them. 
  3680.                However, programs that use Functions 16 through 30 in
  3681.                Version 4.0 of this specification must not use Functions 10
  3682.                and 11.  These functions won't work correctly if your
  3683.                program attempts to mix the use of the new functions
  3684.                (Functions 16 through 30) and Functions 10 and 11.  Func-
  3685.                tions 10 and 11 are specific to the hardware on Intel
  3686.                expanded memory boards and will not work correctly on all
  3687.                vendors' expanded memory boards.
  3688.  
  3689.  
  3690.  
  3691.  
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.  
  3704.  
  3705.  
  3706.  
  3707.  
  3708.  
  3709.  
  3710.  
  3711.  
  3712.  
  3713.  
  3714.  
  3715.  
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721.  
  3722.           EMM Functions                                                  57
  3723.  
  3724.  
  3725.  
  3726.  
  3727.  
  3728.           Function 11. Reserved
  3729.  
  3730.  
  3731.  
  3732.                In earlier versions of the Lotus/Intel/Microsoft Expanded
  3733.                Memory Specification, Function 11 returned a page transla-
  3734.                tion array.  This function is now reserved and new programs
  3735.                should not use it.
  3736.  
  3737.                Existing programs that use this function may still work
  3738.                correctly if the hardware is capable of supporting them. 
  3739.                However, programs that use Functions 16 through 30 in
  3740.                Version 4.0 of this specification must not use Functions 10
  3741.                and 11.  These functions won't work correctly if your
  3742.                program attempts to mix the use of the new functions
  3743.                (Functions 16 through 30) and Functions 10 and 11.  Func-
  3744.                tions 10 and 11 are specific to the hardware on Intel
  3745.                expanded memory boards and will not work correctly on all
  3746.                vendors' expanded memory boards.
  3747.  
  3748.  
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.  
  3770.  
  3771.  
  3772.  
  3773.  
  3774.  
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.           EMM Functions                                                  58
  3782.  
  3783.  
  3784.  
  3785.  
  3786.  
  3787.           Function 12. Get Handle Count
  3788.  
  3789.  
  3790.  
  3791.           PURPOSE
  3792.  
  3793.                The Get Handle Count function returns the number of open EMM
  3794.                handles (including the operating system handle 0) in the
  3795.                system.
  3796.  
  3797.  
  3798.           CALLING PARAMETERS
  3799.  
  3800.                AH = 4Bh
  3801.                    Contains the Get Handle Count function.
  3802.  
  3803.  
  3804.           RESULTS
  3805.  
  3806.                These results are valid only if the status returned is zero.
  3807.  
  3808.                BX = total_open_emm_handles
  3809.                    Contains the number of open EMM handles [including the
  3810.                    operating system handle (0)].  This number will not
  3811.                    exceed 255.
  3812.  
  3813.  
  3814.           REGISTERS MODIFIED
  3815.  
  3816.                AX, BX
  3817.  
  3818.  
  3819.           STATUS
  3820.  
  3821.                AH = 0   SUCCESSFUL.
  3822.                    The manager has returned the number of active EMM
  3823.                    handles.
  3824.  
  3825.                AH = 80h   NON-RECOVERABLE.
  3826.                    The manager detected a malfunction in the memory manager
  3827.                    software.
  3828.  
  3829.                AH = 81h   NON-RECOVERABLE.
  3830.                    The manager detected a malfunction in the expanded
  3831.                    memory hardware.
  3832.  
  3833.                AH = 84h   NON-RECOVERABLE.
  3834.                    The function code passed to the memory manager is not
  3835.                    defined.
  3836.  
  3837.  
  3838.  
  3839.  
  3840.           EMM Functions                                                  59
  3841.  
  3842.  
  3843.  
  3844.  
  3845.  
  3846.           Function 12. Get Handle Count
  3847.  
  3848.  
  3849.  
  3850.           EXAMPLE
  3851.  
  3852.           total_open_emm_handles              DW ?
  3853.  
  3854.           MOV   AH,4Bh                        ; load function code
  3855.           INT   67h                           ; call the memory manger
  3856.           OR    AH,AH                         ; check EMM status
  3857.           JNZ   emm_err_handler               ; jump to error handler on   
  3858.                                               ; error
  3859.           MOV   total_open_emm_handles,BX     ; save total active handle   
  3860.                                               ; count
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866.  
  3867.  
  3868.  
  3869.  
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886.  
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.  
  3896.  
  3897.  
  3898.  
  3899.           EMM Functions                                                  60
  3900.  
  3901.  
  3902.  
  3903.  
  3904.  
  3905.           Function 13. Get Handle Pages
  3906.  
  3907.  
  3908.  
  3909.           PURPOSE
  3910.  
  3911.                The Get Handle Pages function returns the number of pages
  3912.                allocated to a specific EMM handle.
  3913.  
  3914.  
  3915.           CALLING PARAMETERS
  3916.  
  3917.                AH = 4Ch
  3918.                    Contains the Get Handle Pages function.
  3919.  
  3920.                DX = emm_handle
  3921.                    Contains the EMM handle.
  3922.  
  3923.  
  3924.           RESULTS
  3925.  
  3926.                These results are valid only if the status returned is zero.
  3927.  
  3928.                BX = num_pages_alloc_to_emm_handle
  3929.                    Contains the number of logical pages allocated to the
  3930.                    specified EMM handle.  This number never exceeds 2048
  3931.                    because the memory manager allows a maximum of 2048
  3932.                    pages (32M bytes) of expanded memory.
  3933.  
  3934.  
  3935.           REGISTERS MODIFIED
  3936.  
  3937.                AX, BX
  3938.  
  3939.  
  3940.           STATUS
  3941.  
  3942.                AH = 0   SUCCESSFUL.
  3943.                    The manager has returned the number of pages allocated
  3944.                    to the EMM handle.
  3945.  
  3946.                AH = 80h   NON-RECOVERABLE.
  3947.                    The manager detected a malfunction in the memory manager
  3948.                    software.
  3949.  
  3950.                AH = 81h   NON-RECOVERABLE.
  3951.                    The manager detected a malfunction in the expanded
  3952.                    memory hardware.
  3953.  
  3954.                AH = 83h   NON-RECOVERABLE.
  3955.                    The memory manager couldn't find the EMM handle your
  3956.                    program specified.
  3957.  
  3958.           EMM Functions                                                  61
  3959.  
  3960.  
  3961.  
  3962.  
  3963.  
  3964.           Function 13. Get Handle Pages
  3965.  
  3966.  
  3967.  
  3968.                AH = 84h   NON-RECOVERABLE.
  3969.                    The function code passed to the memory manager is not
  3970.                    defined.
  3971.  
  3972.  
  3973.           EXAMPLE
  3974.  
  3975.           emm_handle                          DW ?
  3976.           pages_alloc_to_handle               DW ?
  3977.  
  3978.           MOV   DX,emm_handle                 ; load EMM handle
  3979.           MOV   AH,4Ch                        ; load function code
  3980.           INT   67h                           ; call the memory manager
  3981.           OR    AH,AH                         ; check EMM status
  3982.           JNZ   emm_err_handler               ; jump to error handler on   
  3983.                                               ; error
  3984.           MOV   pages_alloc_to_handle,BX      ; save number of pages       
  3985.                                               ; allocated to specified     
  3986.                                               ; handle
  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.           EMM Functions                                                  62
  4018.  
  4019.  
  4020.  
  4021.  
  4022.  
  4023.           Function 14. Get All Handle Pages
  4024.  
  4025.  
  4026.  
  4027.           PURPOSE
  4028.  
  4029.                The Get All Handle Pages function returns an array of the
  4030.                open EMM handles and the number of pages allocated to each
  4031.                one.
  4032.  
  4033.  
  4034.           CALLING PARAMETERS
  4035.  
  4036.                AH = 4Dh
  4037.                    Contains the Get All Handle Pages function.
  4038.  
  4039.                    handle_page_struct              STRUC
  4040.                        emm_handle                  DW ?
  4041.                        pages_alloc_to_handle       DW ?
  4042.                    handle_page_struct              ENDS
  4043.  
  4044.                ES:DI = pointer to handle_page
  4045.                    Contains a pointer to an array of structures where a
  4046.                    copy of all open EMM handles and the number of pages
  4047.                    allocated to each will be stored.  Each structure has
  4048.                    these two members:
  4049.  
  4050.                    .emm_handle
  4051.                        The first member is a word which contains the value
  4052.                        of the open EMM handle.  The values of the handles
  4053.                        this function returns will be in the range of 0 to
  4054.                        255 decimal (0000h to 00FFh).  The uppermost byte of
  4055.                        the handle is always zero.
  4056.  
  4057.                    .pages_alloc_to_handle
  4058.                        The second member is a word which contains the
  4059.                        number of pages allocated to the open EMM handle.
  4060.  
  4061.  
  4062.           RESULTS
  4063.  
  4064.                These results are valid only if the status returned is zero.
  4065.  
  4066.                BX = total_open_emm_handles
  4067.                    Contains the number of open EMM handles (including the
  4068.                    operating system handle [0]).  The number cannot be zero
  4069.                    because the operating system handle is always active and
  4070.                    cannot be deallocated.  This number will not exceed 255.
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.           EMM Functions                                                  63
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.           Function 14. Get All Handle Pages
  4083.  
  4084.  
  4085.  
  4086.           REGISTERS MODIFIED
  4087.  
  4088.                AX, BX
  4089.  
  4090.  
  4091.           STATUS
  4092.  
  4093.                AH = 0   SUCCESSFUL.
  4094.                    The manager has returned the array.
  4095.  
  4096.                AH = 80h   NON-RECOVERABLE.
  4097.                    The manager detected a malfunction in the memory manager
  4098.                    software.
  4099.  
  4100.                AH = 81h   NON-RECOVERABLE.
  4101.                    The manager detected a malfunction in the expanded
  4102.                    memory hardware.
  4103.  
  4104.                AH = 84h   NON-RECOVERABLE.
  4105.                    The function code passed to the memory manager is not
  4106.                    defined.
  4107.  
  4108.  
  4109.           EXAMPLE
  4110.  
  4111.           handle_page                    handle_page_struct 255 DUP (?)
  4112.           total_open_handles             DW ?
  4113.  
  4114.           MOV   AX,SEG handle_page
  4115.           MOV   ES,AX
  4116.           LEA   DI,handle_page           ; ES:DI points to handle_page
  4117.           MOV   AH,4Dh                   ; load function code
  4118.           INT   67h                      ; call the memory manager
  4119.           OR    AH,AH                    ; check the EMM status
  4120.           JNZ   emm_err_handler          ; jump to error handler on error
  4121.           MOV   total_open_handles,BX    ; save total open handle count
  4122.  
  4123.  
  4124.  
  4125.  
  4126.  
  4127.  
  4128.  
  4129.  
  4130.  
  4131.  
  4132.  
  4133.  
  4134.  
  4135.           EMM Functions                                                  64
  4136.  
  4137.  
  4138.  
  4139.  
  4140.  
  4141.           Function 15. Get/Set Page Map
  4142.           Get Page Map subfunction
  4143.  
  4144.  
  4145.  
  4146.           PURPOSE
  4147.  
  4148.                The Get Page Map subfunction saves the mapping context for
  4149.                all mappable memory regions (conventional and expanded) by
  4150.                copying the contents of the mapping registers from each
  4151.                expanded memory board to a destination array.  The applica-
  4152.                tion must pass a pointer to the destination array.  This
  4153.                subfunction doesn't require an EMM handle.
  4154.  
  4155.                Use this function instead of Functions 8 and 9 if you need
  4156.                to save or restore the mapping context but don't want (or
  4157.                have) to use a handle.
  4158.  
  4159.  
  4160.           CALLING PARAMETERS
  4161.  
  4162.                AX = 4E00h
  4163.                    Contains the Get Page Map subfunction.
  4164.  
  4165.                ES:DI = dest_page_map
  4166.                    Contains a pointer to the destination array address in
  4167.                    segment:offset format.  Use the Get Size of Page Map
  4168.                    Save Array subfunction to determine the size of the
  4169.                    desired array.
  4170.  
  4171.  
  4172.           RESULTS
  4173.  
  4174.                These results are valid only if the status returned is zero.
  4175.  
  4176.                dest_page_map
  4177.                    The array contains the state of all the mapping regis-
  4178.                    ters on all boards in the system.  It also contains any
  4179.                    additional information necessary to restore the boards
  4180.                    to their original state when the program invokes a Set
  4181.                    subfunction.
  4182.  
  4183.  
  4184.           REGISTERS MODIFIED
  4185.  
  4186.                AX
  4187.  
  4188.  
  4189.           STATUS
  4190.  
  4191.                AH = 0   SUCCESSFUL.
  4192.                    The manager has returned the array.
  4193.  
  4194.           EMM Functions                                                  65
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.           Function 15. Get/Set Page Map
  4201.           Get Page Map subfunction
  4202.  
  4203.  
  4204.  
  4205.                AH = 80h   NON-RECOVERABLE.
  4206.                    The manager detected a malfunction in the memory manager
  4207.                    software.
  4208.  
  4209.                AH = 81h   NON-RECOVERABLE.
  4210.                    The manager detected a malfunction in the expanded
  4211.                    memory hardware.
  4212.  
  4213.                AH = 84h   NON-RECOVERABLE.
  4214.                    The function code passed to the memory manager is not
  4215.                    defined.
  4216.  
  4217.                AH = 8Fh   NON-RECOVERABLE.
  4218.                    The subfunction parameter is invalid.
  4219.  
  4220.  
  4221.           EXAMPLE
  4222.  
  4223.           dest_page_map                  DB ? DUP (?)
  4224.  
  4225.           MOV   AX,SEG dest_page_map
  4226.           MOV   ES,AX
  4227.           LEA   DI,dest_page_map         ; ES:DI points to dest_page_map
  4228.           MOV   AX,4E00h                 ; load function code
  4229.           INT   67h                      ; call the memory manager
  4230.           OR    AH,AH                    ; check EMM status
  4231.           JNZ   emm_err_handler          ; jump to error handler on error
  4232.  
  4233.  
  4234.  
  4235.  
  4236.  
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.  
  4252.  
  4253.           EMM Functions                                                  66
  4254.  
  4255.  
  4256.  
  4257.  
  4258.  
  4259.           Function 15. Get/Set Page Map
  4260.           Set Page Map subfunction
  4261.  
  4262.  
  4263.  
  4264.           PURPOSE
  4265.  
  4266.                The Set Page Map subfunction restores the mapping context
  4267.                for all mappable memory regions (conventional and expanded)
  4268.                by copying the contents of a source array into the mapping
  4269.                registers on each expanded memory board in the system.  The
  4270.                application must pass a pointer to the source array.  This
  4271.                subfunction doesn't require an EMM handle.
  4272.  
  4273.                Use this function instead of Functions 8 and 9 if you need
  4274.                to save or restore the mapping context but don't want (or
  4275.                have) to use a handle.
  4276.  
  4277.  
  4278.           CALLING PARAMETERS
  4279.  
  4280.                AX = 4E01h
  4281.                    Contains the Set Page Map subfunction.
  4282.  
  4283.                DS:SI = source_page_map
  4284.                    Contains a pointer to the source array address in
  4285.                    segment:offset format.  The application must point to an
  4286.                    array which contains the mapping register state.  Use
  4287.                    the Get Size of Page Map Save Array subfunction to
  4288.                    determine the size of the desired array.
  4289.  
  4290.  
  4291.           REGISTERS MODIFIED
  4292.  
  4293.                AX
  4294.  
  4295.  
  4296.           STATUS
  4297.  
  4298.                AH = 0   SUCCESSFUL.
  4299.                    The manager has passed the array.
  4300.  
  4301.                AH = 80h   NON-RECOVERABLE.
  4302.                    The manager detected a malfunction in the memory manager
  4303.                    software.
  4304.  
  4305.                AH = 81h   NON-RECOVERABLE.
  4306.                    The manager detected a malfunction in the expanded
  4307.                    memory hardware.
  4308.  
  4309.  
  4310.  
  4311.  
  4312.           EMM Functions                                                  67
  4313.  
  4314.  
  4315.  
  4316.  
  4317.  
  4318.           Function 15. Get/Set Page Map
  4319.           Set Page Map subfunction
  4320.  
  4321.  
  4322.  
  4323.                AH = 84h   NON-RECOVERABLE.
  4324.                    The function code passed to the memory manager is not
  4325.                    defined.
  4326.  
  4327.                AH = 8Fh   NON-RECOVERABLE.
  4328.                    The subfunction parameter is invalid.
  4329.  
  4330.                AH = A3h   NON-RECOVERABLE.
  4331.                    The contents of the source array have been corrupted, or
  4332.                    the pointer passed to the subfunction is invalid.
  4333.  
  4334.  
  4335.           EXAMPLE
  4336.  
  4337.           source_page_map                DB ? DUP (?)
  4338.  
  4339.           MOV   AX,SEG source_page_map
  4340.           MOV   DS,AX
  4341.           LEA   SI,source_page_map       ; DS:SI points to source_page_map
  4342.           MOV   AX,4E01h                 ; load function code
  4343.           INT   67h                      ; call the memory manager
  4344.           OR    AH,AH                    ; check EMM status
  4345.           JNZ   emm_err_handler          ; jump to error handler on error
  4346.  
  4347.  
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.  
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.  
  4364.  
  4365.  
  4366.  
  4367.  
  4368.  
  4369.  
  4370.  
  4371.           EMM Functions                                                  68
  4372.  
  4373.  
  4374.  
  4375.  
  4376.  
  4377.           Function 15. Get/Set Page Map
  4378.           Get & Set Page Map subfunction
  4379.  
  4380.  
  4381.  
  4382.           PURPOSE
  4383.  
  4384.                The Get & Set Page Map subfunction simultaneously saves a
  4385.                current mapping context and restores a previous mapping
  4386.                context for all mappable memory regions (both conventional
  4387.                and expanded).  It first copies the contents of the mapping
  4388.                registers from each expanded memory board in the system into
  4389.                a destination array.  (The application must pass a pointer
  4390.                to the destination array.)  Then, the subfunction copies the
  4391.                contents of a source array into the mapping registers on
  4392.                each of the expanded memory boards.  (The application must
  4393.                pass a pointer to the source array.)
  4394.  
  4395.                Use this function instead of Functions 8 and 9 if you need
  4396.                to save or restore the mapping context but don't want (or
  4397.                have) to use a handle.
  4398.  
  4399.  
  4400.           CALLING PARAMETERS
  4401.  
  4402.                AX = 4E02h
  4403.                    Contains the Get & Set Page Map subfunction.
  4404.  
  4405.                ES:DI = dest_page_map
  4406.                    Contains a pointer to the destination array address in
  4407.                    segment:offset format.  The current contents of the map
  4408.                    registers will be saved in this array.
  4409.  
  4410.                DS:SI = source_page_map
  4411.                    Contains a pointer to the source array address in
  4412.                    segment:offset format.  The contents of this array will
  4413.                    be copied into the map registers.  The application must
  4414.                    point to an array which contains the mapping register
  4415.                    state.  This address is required only for the Set or Get
  4416.                    and Set subfunctions.
  4417.  
  4418.  
  4419.           RESULTS
  4420.  
  4421.                These results are valid only if the status returned is zero.
  4422.  
  4423.                dest_page_map
  4424.                    The array contains the mapping state.  It also contains
  4425.                    any additional information necessary to restore the
  4426.                    original state when the program invokes a Set subfunc-
  4427.                    tion.
  4428.  
  4429.  
  4430.           EMM Functions                                                  69
  4431.  
  4432.  
  4433.  
  4434.  
  4435.  
  4436.           Function 15. Get/Set Page Map
  4437.           Get & Set Page Map subfunction
  4438.  
  4439.  
  4440.  
  4441.           REGISTERS MODIFIED
  4442.  
  4443.                AX
  4444.  
  4445.  
  4446.           STATUS
  4447.  
  4448.                AH = 0   SUCCESSFUL.
  4449.                    The manager has returned and passed both arrays.
  4450.  
  4451.                AH = 80h   NON-RECOVERABLE.
  4452.                    The manager detected a malfunction in the memory manager
  4453.                    software.
  4454.  
  4455.                AH = 81h   NON-RECOVERABLE.
  4456.                    The manager detected a malfunction in the expanded
  4457.                    memory hardware.
  4458.  
  4459.                AH = 84h   NON-RECOVERABLE.
  4460.                    The function code passed to the memory manager is not
  4461.                    defined.
  4462.  
  4463.                AH = 8Fh   NON-RECOVERABLE.
  4464.                    The subfunction parameter is invalid.
  4465.  
  4466.                AH = A3h   NON-RECOVERABLE.
  4467.                    The contents of the source array have been corrupted, or
  4468.                    the pointer passed to the subfunction is invalid.
  4469.  
  4470.  
  4471.           EXAMPLE
  4472.  
  4473.           dest_page_map                  DB ? DUP (?)
  4474.  
  4475.           source_page_map                DB ? DUP (?)
  4476.  
  4477.           MOV   AX,SEG dest_page_map
  4478.           MOV   ES,AX
  4479.           MOV   AX,SEG source_page_map
  4480.           MOV   DS,AX
  4481.           LEA   DI,dest_page_map         ; ES:DI points to dest_page_map
  4482.           LEA   SI,source_page_map       ; DS:SI points to source_page_map
  4483.           MOV   AX,4E02h                 ; load function code
  4484.           INT   67h                      ; call the memory manager
  4485.           OR    AH,AH                    ; check EMM status
  4486.           JNZ   emm_err_handler          ; jump to error handler on error
  4487.  
  4488.  
  4489.           EMM Functions                                                  70
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.           Function 15. Get/Set Page Map
  4496.           Get Size of Page Map Save Array subfunction
  4497.  
  4498.  
  4499.  
  4500.           PURPOSE
  4501.  
  4502.                The Get Size of Page Map Save Array subfunction returns the
  4503.                storage requirements for the array passed by the other three
  4504.                subfunctions.  This subfunction doesn't require an EMM
  4505.                handle.
  4506.  
  4507.  
  4508.           CALLING PARAMETERS
  4509.  
  4510.                AX = 4E03h
  4511.                    Contains the Get Size of Page Map Save Array subfunc-
  4512.                    tion.  The size of this array depends on how the
  4513.                    expanded memory system is configured and how the
  4514.                    expanded memory manager is implemented.  Therefore, the
  4515.                    size must be determined after the memory manager is
  4516.                    loaded.
  4517.  
  4518.  
  4519.           RESULTS
  4520.  
  4521.                These results are valid only if the status returned is zero.
  4522.  
  4523.                AL = size_of_array
  4524.                    Contains the number of bytes that will be transferred to
  4525.                    the memory area an application supplies whenever a
  4526.                    program requests the Get, Set, or Get and Set subfunc-
  4527.                    tions.
  4528.  
  4529.  
  4530.           REGISTERS MODIFIED
  4531.  
  4532.                AX
  4533.  
  4534.  
  4535.           STATUS
  4536.  
  4537.                AH = 0   SUCCESSFUL.
  4538.                    The manager has returned the array size.
  4539.  
  4540.                AH = 80h   NON-RECOVERABLE.
  4541.                    The manager detected a malfunction in the memory manager
  4542.                    software.
  4543.  
  4544.                AH = 81h   NON-RECOVERABLE.
  4545.                    The manager detected a malfunction in the expanded
  4546.                    memory hardware.
  4547.  
  4548.           EMM Functions                                                  71
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.           Function 15. Get/Set Page Map
  4555.           Get Size of Page Map Save Array subfunction
  4556.  
  4557.  
  4558.  
  4559.                AH = 84h   NON-RECOVERABLE.
  4560.                    The function code passed to the memory manager is not
  4561.                    defined.
  4562.  
  4563.                AH = 8Fh   NON-RECOVERABLE.
  4564.                    The subfunction parameter is invalid.
  4565.  
  4566.  
  4567.           EXAMPLE
  4568.  
  4569.           size_of_array                  DB ?
  4570.  
  4571.           MOV   AX,4E03h                 ; load function code
  4572.           INT   67h                      ; call the memory manager
  4573.           OR    AH,AH                    ; check EMM status
  4574.           JNZ   emm_err_handler          ; jump to error handler on error
  4575.           MOV   size_of_array,AL         ; save array size
  4576.  
  4577.  
  4578.  
  4579.  
  4580.  
  4581.  
  4582.  
  4583.  
  4584.  
  4585.  
  4586.  
  4587.  
  4588.  
  4589.  
  4590.  
  4591.  
  4592.  
  4593.  
  4594.  
  4595.  
  4596.  
  4597.  
  4598.  
  4599.  
  4600.  
  4601.  
  4602.  
  4603.  
  4604.  
  4605.  
  4606.  
  4607.           EMM Functions                                                  72
  4608.  
  4609.  
  4610.  
  4611.  
  4612.  
  4613.           Function 16. Get/Set Partial Page Map
  4614.           Get Partial Page Map subfunction
  4615.  
  4616.  
  4617.  
  4618.           PURPOSE
  4619.  
  4620.                The Get Partial Page Map subfunction saves a partial mapping
  4621.                context for specific mappable memory regions in a system. 
  4622.                Because this function saves only a subset of the entire
  4623.                mapping context, it uses much less memory for the save area
  4624.                and may be potentially faster than Function 15.  The
  4625.                subfunction does this by copying the contents of selected
  4626.                mapping registers from each expanded memory board to a
  4627.                destination array.
  4628.  
  4629.                The application must pass a pair of pointers.  The first
  4630.                points to a structure which specifies which mappable
  4631.                segments to save; the second points to the destination
  4632.                array.
  4633.  
  4634.                Use this function instead of Functions 8 and 9 if you need
  4635.                to save or restore the mapping context but don't want (or
  4636.                have) to use a handle.
  4637.  
  4638.  
  4639.           CALLING PARAMETERS
  4640.  
  4641.                AX = 4F00h
  4642.                    Contains the Get Partial Page Map subfunction.
  4643.  
  4644.                    partial_page_map_struct         STRUC
  4645.                        mappable_segment_count      DW ?
  4646.                        mappable_segment            DW (?) DUP (?)
  4647.                    partial_page_map_struct         ENDS
  4648.  
  4649.                DS:SI = partial_page_map
  4650.                    Contains a pointer to a structure which specifies only
  4651.                    those mappable memory regions which are to have their
  4652.                    mapping context saved.  The structure members are
  4653.                    described below.
  4654.  
  4655.                    .mappable_segment_count
  4656.                        The first member is a word which specifies the
  4657.                        number of members in the word array which immediate-
  4658.                        ly follows it.  This number should not exceed the
  4659.                        number of mappable segments in the system.
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.           EMM Functions                                                  73
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.           Function 16. Get/Set Partial Page Map
  4673.           Get Partial Page Map subfunction
  4674.  
  4675.  
  4676.  
  4677.                    .mappable_segment
  4678.                        The second member is a word array which contains the
  4679.                        segment addresses of the mappable memory regions
  4680.                        whose mapping contexts are to be saved.  The segment
  4681.                        address must be a mappable segment.  Use Function 25
  4682.                        to determine which segments are mappable.
  4683.  
  4684.                ES:DI = dest_array
  4685.                    Contains a pointer to the destination array address in
  4686.                    segment:offset format.  To determine the size of the
  4687.                    required array, see the Get Size of Partial Page Map
  4688.                    Save Array subfunction.
  4689.  
  4690.  
  4691.           RESULTS
  4692.  
  4693.                These results are valid only if the status returned is zero.
  4694.  
  4695.                dest_array
  4696.                    The array contains the partial mapping context and any
  4697.                    additional information necessary to restore this context
  4698.                    to its original state when the program invokes a Set
  4699.                    subfunction.
  4700.  
  4701.  
  4702.           REGISTERS MODIFIED
  4703.  
  4704.                AX
  4705.  
  4706.  
  4707.           STATUS
  4708.  
  4709.                AH = 0   SUCCESSFUL.
  4710.                    The manager has saved the partial map context.
  4711.  
  4712.                AH = 80h   NON-RECOVERABLE.
  4713.                    The manager detected a malfunction in the memory manager
  4714.                    software.
  4715.  
  4716.                AH = 81h   NON-RECOVERABLE.
  4717.                    The manager detected a malfunction in the expanded
  4718.                    memory hardware.
  4719.  
  4720.                AH = 84h   NON-RECOVERABLE.
  4721.                    The function code passed to the memory manager is not
  4722.                    defined.
  4723.  
  4724.  
  4725.           EMM Functions                                                  74
  4726.  
  4727.  
  4728.  
  4729.  
  4730.  
  4731.           Function 16. Get/Set Partial Page Map
  4732.           Get Partial Page Map subfunction
  4733.  
  4734.  
  4735.  
  4736.                AH = 8Bh   NON-RECOVERABLE.
  4737.                    One of the specified segments is not a mappable segment.
  4738.  
  4739.                AH = 8Fh   NON-RECOVERABLE.
  4740.                    The subfunction parameter is invalid.
  4741.  
  4742.                AH = A3h   NON-RECOVERABLE.
  4743.                    The contents of the partial page map structure have been
  4744.                    corrupted, the pointer passed to the subfunction is
  4745.                    invalid, or the mappable_segment_count exceeds the
  4746.                    number of mappable segments in the system.
  4747.  
  4748.  
  4749.           EXAMPLE
  4750.  
  4751.           partial_page_map               partial_page_map_struct <>
  4752.  
  4753.           dest_array                     DB ? DUP (?)
  4754.  
  4755.           MOV   AX,SEG partial_page_map
  4756.           MOV   DS,AX
  4757.           LEA   SI,partial_page_map      ; DS:SI points to partial_page_map
  4758.           MOV   AX,SEG dest_array
  4759.           MOV   ES,AX
  4760.           LEA   DI,dest_array            ; ES:DI points to dest_array
  4761.           MOV   AX,4F00h                 ; load function code
  4762.           INT   67h                      ; call the memory manager
  4763.           OR    AH,AH                    ; check EMM status
  4764.           JNZ   emm_err_handler          ; jump to error handler on error
  4765.  
  4766.  
  4767.  
  4768.  
  4769.  
  4770.  
  4771.  
  4772.  
  4773.  
  4774.  
  4775.  
  4776.  
  4777.  
  4778.  
  4779.  
  4780.  
  4781.  
  4782.  
  4783.  
  4784.           EMM Functions                                                  75
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.           Function 16. Get/Set Partial Page Map
  4791.           Set Partial Page Map subfunction
  4792.  
  4793.  
  4794.  
  4795.           PURPOSE
  4796.  
  4797.                The Set Partial Page Map subfunction provides a mechanism
  4798.                for restoring the mapping context for a partial mapping
  4799.                context for specific mappable memory regions in a system. 
  4800.                Because this function restores only a subset of the entire
  4801.                mapping context and not the entire systems mapping context,
  4802.                it uses much less memory for the save area and is potential-
  4803.                ly faster than Function 15.  The subfunction does this by
  4804.                copying the contents of the source array to selected mapping
  4805.                registers on each expanded memory board.  The application
  4806.                passes a pointer to the source array.
  4807.  
  4808.                Use this function instead of Functions 8 and 9 if you need
  4809.                to save or restore the mapping context but don't want (or
  4810.                have) to use a handle.
  4811.  
  4812.  
  4813.           CALLING PARAMETERS
  4814.  
  4815.                AX = 4F01h
  4816.                    Contains the Set Partial Page Map subfunction
  4817.  
  4818.                            source_array     DB ? DUP (?)
  4819.  
  4820.                DS:SI = source_array
  4821.                    Contains a pointer to the source array in segment:offset
  4822.                    format.  The application must point to an array which
  4823.                    contains the partial mapping register state.  To deter-
  4824.                    mine the size of the required array, see the Get Size of
  4825.                    Partial Page Map Save Array subfunction.
  4826.  
  4827.  
  4828.           REGISTERS MODIFIED
  4829.  
  4830.                AX
  4831.  
  4832.  
  4833.           STATUS
  4834.  
  4835.                AH = 0   SUCCESSFUL.
  4836.                    The manager has restored the partial mapping context.
  4837.  
  4838.                AH = 80h   NON-RECOVERABLE.
  4839.                    The manager detected a malfunction in the memory manager
  4840.                    software.
  4841.  
  4842.  
  4843.           EMM Functions                                                  76
  4844.  
  4845.  
  4846.  
  4847.  
  4848.  
  4849.           Function 16. Get/Set Partial Page Map
  4850.           Set Partial Page Map subfunction
  4851.  
  4852.  
  4853.  
  4854.                AH = 81h   NON-RECOVERABLE.
  4855.                    The manager detected a malfunction in the expanded
  4856.                    memory hardware.
  4857.  
  4858.                AH = 84h   NON-RECOVERABLE.
  4859.                    The function code passed to the memory manager is not
  4860.                    defined.
  4861.  
  4862.                AH = 8Fh   NON-RECOVERABLE.
  4863.                    The subfunction parameter is invalid.
  4864.  
  4865.                AH = A3h   NON-RECOVERABLE.
  4866.                    The contents of the source array have been corrupted, or
  4867.                    the pointer passed to the subfunction is invalid.
  4868.  
  4869.  
  4870.           EXAMPLE
  4871.  
  4872.           MOV   AX,SEG source_array
  4873.           MOV   DS,AX
  4874.           LEA   SI,source_array          ; DS:SI points to source_array
  4875.           MOV   AX,4F01h                 ; load function code
  4876.           INT   67h                      ; call the memory manager
  4877.           OR    AH,AH                    ; check EMM status
  4878.           JNZ   emm_err_handler          ; jump to error handler on error
  4879.  
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.  
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  
  4891.  
  4892.  
  4893.  
  4894.  
  4895.  
  4896.  
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902.           EMM Functions                                                  77
  4903.  
  4904.  
  4905.  
  4906.  
  4907.  
  4908.           Function 16. Get/Set Partial Page Map
  4909.           Get Size of Partial Page Map Save Array subfunction
  4910.  
  4911.  
  4912.  
  4913.           PURPOSE
  4914.  
  4915.                The Get Size of Partial Page Map Save Array subfunction
  4916.                returns the storage requirements for the array passed by the
  4917.                other two subfunctions.  This subfunction doesn't require an
  4918.                EMM handle.
  4919.  
  4920.  
  4921.           CALLING PARAMETERS
  4922.  
  4923.                AX = 4F02h
  4924.                    Contains the Get Size of Partial Page Map Save Array
  4925.                    subfunction.  The size of this array depends on the
  4926.                    expanded memory system configuration and the implementa-
  4927.                    tion of the expanded memory manager.  Therefore, it will
  4928.                    vary between hardware configurations and implementations
  4929.                    and must be determined after a specific memory manager
  4930.                    is loaded.
  4931.  
  4932.                BX = number of pages in the partial array
  4933.                    Contains the number of pages in the partial map to be
  4934.                    saved by the Get/Set Partial Page Map subfunctions. 
  4935.                    This number should be the same as the mappable_seg-
  4936.                    ment_count in the Get Partial Page Map subfunction.
  4937.  
  4938.  
  4939.           RESULTS
  4940.  
  4941.                These results are valid only if the status returned is zero.
  4942.  
  4943.                AL = size_of_partial_save_array
  4944.                    Contains the number of bytes that will be transferred to
  4945.                    the memory areas supplied by an application whenever a
  4946.                    program requests the Get or Set subfunction.
  4947.  
  4948.  
  4949.           REGISTERS MODIFIED
  4950.  
  4951.                AX
  4952.  
  4953.  
  4954.           STATUS
  4955.  
  4956.                AH = 0   SUCCESSFUL.
  4957.                    The manager has returned the array size.
  4958.  
  4959.  
  4960.  
  4961.           EMM Functions                                                  78
  4962.  
  4963.  
  4964.  
  4965.  
  4966.  
  4967.           Function 16. Get/Set Partial Page Map
  4968.           Get Size of Partial Page Map Save Array subfunction
  4969.  
  4970.  
  4971.  
  4972.                AH = 80h   NON-RECOVERABLE.
  4973.                    The manager detected a malfunction in the memory manager
  4974.                    software.
  4975.  
  4976.                AH = 81h   NON-RECOVERABLE.
  4977.                    The manager detected a malfunction in the expanded
  4978.                    memory hardware.
  4979.  
  4980.                AH = 84h   NON-RECOVERABLE.
  4981.                    The function code passed to the memory manager is not
  4982.                    defined.
  4983.  
  4984.                AH = 8Bh   NON-RECOVERABLE.
  4985.                    The number of pages in the partial array is outside the
  4986.                    range of physical pages in the system.
  4987.  
  4988.                AH = 8Fh   NON-RECOVERABLE.
  4989.                    The subfunction parameter is invalid.
  4990.  
  4991.  
  4992.           EXAMPLE
  4993.  
  4994.           number_of_pages_to_map              DW ?
  4995.           size_of_partial_save_array          DB ?
  4996.  
  4997.           MOV   BX,number_of_pages_to_map
  4998.           MOV   AX,4F02h                      ; load function code
  4999.           INT   67h                           ; call the memory manager
  5000.           OR    AH,AH                         ; check EMM status
  5001.           JNZ   emm_err_handler               ; jump to error handler on   
  5002.                                               ; error
  5003.           MOV   size_of_partial_save_array,AL ; save array size
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.  
  5018.  
  5019.  
  5020.           EMM Functions                                                  79
  5021.  
  5022.  
  5023.  
  5024.  
  5025.  
  5026.           Function 17. Map/Unmap Multiple Handle Pages
  5027.  
  5028.  
  5029.  
  5030.           PURPOSE
  5031.  
  5032.                This function can, in a single invocation, map (or unmap)
  5033.                logical pages into as many physical pages as the system
  5034.                supports.  Consequently, it has less execution overhead than
  5035.                mapping pages one at a time.  For applications which do a
  5036.                lot of page mapping, this is the preferred mapping method.
  5037.  
  5038.  
  5039.           Mapping Multiple Pages
  5040.  
  5041.                The handle passed to this function determines what type of
  5042.                logical pages are being mapped.  Logical pages that Function
  5043.                4 and Function 27 (Allocate Standard Pages subfunction)
  5044.                allocate are referred to as pages and are 16K bytes. 
  5045.                Logical pages that Function 27 (Allocate Raw Pages subfunc-
  5046.                tion) allocates are referred to as raw pages and might not
  5047.                be the same size as the pages Function 4 and Function 27
  5048.                (Allocate Standard Pages subfunction) allocate.
  5049.  
  5050.  
  5051.           Unmapping Multiple Pages
  5052.  
  5053.                This function can make specific physical pages unavailable
  5054.                for reading or writing.  A logical page which is unmapped
  5055.                from a specific physical page cannot be read or written from
  5056.                that physical page.  The logical page which is unavailable
  5057.                (unmapped) can be made available again by mapping it, or a
  5058.                new logical page, at the physical page that was unmapped. 
  5059.                Unmapping a physical page is accomplished by setting the
  5060.                logical page it is associated with to FFFFh.
  5061.  
  5062.                You might unmap an entire set of mapped pages, for example,
  5063.                before loading and executing a program.  This ensures that
  5064.                the loaded program won't be able to access the pages your
  5065.                program has mapped.  However, you must save the mapping
  5066.                context before you unmap the physical pages.  This enables
  5067.                you to restore it later so that you may access the memory
  5068.                you had mapped there.  You can save the mapping context with
  5069.                Functions 8, 15, or 16.  You can restore the mapping context
  5070.                with Functions 9, 15, or 16.
  5071.  
  5072.  
  5073.           Mapping and Unmapping Multiple Pages Simultaneously
  5074.  
  5075.                Both mapping and unmapping pages can be done in the same
  5076.                invocation.
  5077.  
  5078.  
  5079.           EMM Functions                                                  80
  5080.  
  5081.  
  5082.  
  5083.  
  5084.  
  5085.           Function 17. Map/Unmap Multiple Handle Pages
  5086.  
  5087.  
  5088.  
  5089.                Mapping or unmapping no pages is not considered an error. 
  5090.                If a request to map or unmap zero pages is made, nothing is
  5091.                done and no error is returned.
  5092.  
  5093.  
  5094.           Alternate Mapping and Unmapping Methods
  5095.  
  5096.                You can map or unmap pages using two methods.  Both methods
  5097.                produce identical results.
  5098.  
  5099.                1.  The first method specifies both a logical page and a
  5100.                    physical page at which the logical page is to be mapped. 
  5101.                    This method is an extension of Function 5 (Map Handle
  5102.                    Page).
  5103.  
  5104.                2.  The second method specifies both a logical page and a
  5105.                    corresponding segment address at which the logical page
  5106.                    is to be mapped.  While this is functionally the same as
  5107.                    the first method, it may be easier to use the actual
  5108.                    segment address of a physical page than to use a number
  5109.                    which only represents its location.  The memory manager
  5110.                    verifies whether the specified segment address falls on
  5111.                    the boundary of a mappable physical page.  The manager
  5112.                    then translates the segment address passed to it into
  5113.                    the necessary internal representation to map the pages.
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.           EMM Functions                                                  81
  5139.  
  5140.  
  5141.  
  5142.  
  5143.  
  5144.           Function 17. Map/Unmap Multiple Handle Pages
  5145.           Logical Page/Physical Page Method
  5146.  
  5147.  
  5148.           CALLING PARAMETERS
  5149.  
  5150.                AX = 5000h
  5151.                    Contains the Map/Unmap Multiple Handle Pages subfunction
  5152.                    using the logical page/physical page method.
  5153.  
  5154.                    log_to_phys_map_struct          STRUC
  5155.                        log_page_number             DW ?
  5156.                        phys_page_number            DW ?
  5157.                    log_to_phys_map_struct          ENDS
  5158.  
  5159.                DX = handle
  5160.                    Contains the EMM handle.
  5161.  
  5162.                CX = log_to_phys_map_len
  5163.                    Contains the number of entries in the array.  For
  5164.                    example, if the array contained four pages to map or
  5165.                    unmap, then CX would contain 4.  The number in CX should
  5166.                    not exceed the number of mappable pages in the system.
  5167.  
  5168.                DS:SI = pointer to log_to_phys_map array
  5169.                    Contains a pointer to an array of structures that
  5170.                    contains the information necessary to map the desired
  5171.                    pages.  The array is made up of the following two
  5172.                    elements:
  5173.  
  5174.                    .log_page_number
  5175.                        The first member is a word which contains the number
  5176.                        of the logical page which is to be mapped.  Logical
  5177.                        pages are numbered zero-relative, so the number for
  5178.                        a logical page can only range from zero to (maximum
  5179.                        number of logical pages allocated to the handle -
  5180.                        1).
  5181.  
  5182.                        If the logical page number is set to FFFFh, the
  5183.                        physical page associated with it is unmapped rather
  5184.                        than mapped.  Unmapping a physical page makes it
  5185.                        inaccessible for reading or writing.
  5186.  
  5187.                    .phys_page_number
  5188.                        The second member is a word which contains the
  5189.                        number of the physical page at which the logical
  5190.                        page is to be mapped.  Physical pages are numbered
  5191.                        zero-relative, so the number for a physical page can
  5192.                        only range from zero to (maximum number of physical
  5193.                        pages supported in the system - 1).
  5194.  
  5195.  
  5196.  
  5197.           EMM Functions                                                  82
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.           Function 17. Map/Unmap Multiple Handle Pages
  5204.           Logical Page/Physical Page Method
  5205.  
  5206.  
  5207.  
  5208.           REGISTERS MODIFIED
  5209.  
  5210.                AX
  5211.  
  5212.  
  5213.           STATUS
  5214.  
  5215.                AH = 0   SUCCESSFUL.
  5216.                    The logical pages have been mapped, or unmapped, at the
  5217.                    specified physical pages.
  5218.  
  5219.                AH = 80h   NON-RECOVERABLE.
  5220.                    The manager has detected a malfunction in the memory
  5221.                    manager software.
  5222.  
  5223.                AH = 81h   NON-RECOVERABLE.
  5224.                    The manager has detected a malfunction in the expanded
  5225.                    memory hardware.
  5226.  
  5227.                AH = 83h   NON-RECOVERABLE.
  5228.                    The manager couldn't find the specified EMM handle.  The
  5229.                    manager doesn't currently have any information pertain-
  5230.                    ing to the specified EMM handle.  The program has
  5231.                    probably corrupted its EMM handle.
  5232.  
  5233.                AH = 84h   NON-RECOVERABLE.
  5234.                    The function code passed to the manager is not defined.
  5235.  
  5236.                AH = 8Ah   RECOVERABLE.
  5237.                    One or more of the mapped logical pages is out of the
  5238.                    range of logical pages allocated to the EMM handle.  The
  5239.                    program can recover by attempting to map a logical page
  5240.                    which is within the bounds for the specified EMM handle. 
  5241.                    When this error occurs, the only pages mapped were the
  5242.                    ones valid up to the point that the error occurred.
  5243.  
  5244.                AH = 8Bh   RECOVERABLE.
  5245.                    One or more of the physical pages is out of the range of
  5246.                    mappable physical pages, or the log_to_phys_map_len
  5247.                    exceeds the number of mappable pages in the system.  The
  5248.                    program can recover from this condition by attempting to
  5249.                    map into memory at the physical page which is in the
  5250.                    range of the physical page numbers supported by the
  5251.                    system.  When this error occurs, the only pages mapped
  5252.                    were the ones valid up to the point that the error
  5253.                    occurred.
  5254.  
  5255.  
  5256.           EMM Functions                                                  83
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.           Function 17. Map/Unmap Multiple Handle Pages
  5263.           Logical Page/Physical Page Method
  5264.  
  5265.  
  5266.  
  5267.                AH = 8Fh   NON-RECOVERABLE.
  5268.                    The subfunction parameter is invalid.
  5269.  
  5270.  
  5271.           EXAMPLE
  5272.  
  5273.           log_to_phys_map            log_to_phys_map_struct ? DUP (?)
  5274.  
  5275.           emm_handle                 DW ?
  5276.  
  5277.           MOV   AX,SEG log_to_phys_map
  5278.           MOV   DS,AX
  5279.           LEA   SI,log_to_phys_map            ; DS:SI points to
  5280.                                               ; log_to_phys_map
  5281.           MOV   CX,LENGTH log_to_phys_map     ; set length field
  5282.           MOV   DX,emm_handle
  5283.           MOV   AX,5000h                      ; load function code
  5284.           INT   67h                           ; call the memory manager
  5285.           OR    AH,AH                         ; check EMM status
  5286.           JNZ   emm_err_handler               ; jump to error handler on   
  5287.                                               ; error
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.  
  5296.  
  5297.  
  5298.  
  5299.  
  5300.  
  5301.  
  5302.  
  5303.  
  5304.  
  5305.  
  5306.  
  5307.  
  5308.  
  5309.  
  5310.  
  5311.  
  5312.  
  5313.  
  5314.  
  5315.           EMM Functions                                                  84
  5316.  
  5317.  
  5318.  
  5319.  
  5320.  
  5321.           Function 17. Map/Unmap Multiple Handle Pages
  5322.           Logical Page/Segment Address Method
  5323.  
  5324.  
  5325.           CALLING PARAMETERS
  5326.  
  5327.                AX = 5001h
  5328.                    Contains the Map/Unmap Multiple Handle Pages subfunction
  5329.                    using the logical page/segment address method.
  5330.  
  5331.                    log_to_seg_map_struct           STRUC
  5332.                        log_page_number             DW ?
  5333.                        mappable_segment_address    DW ?
  5334.                    log_to_seg_map_struct           ENDS
  5335.  
  5336.                DX = handle
  5337.                    Contains the EMM handle.
  5338.  
  5339.                CX = log_to_segment_map_len
  5340.                    Contains the number of entries in the array.  For
  5341.                    example, if the array contained four pages to map or
  5342.                    unmap, then CX would contain four.
  5343.  
  5344.                DS:SI = pointer to log_to_segment_map array
  5345.                    Contains a pointer to an array of structures that
  5346.                    contains the information necessary to map the desired
  5347.                    pages.  The array is made up of the following elements:
  5348.  
  5349.                    .log_page_number
  5350.                        The first member is a word which contains the number
  5351.                        of the logical pages to be mapped.  Logical pages
  5352.                        are numbered zero-relative, so the number for a
  5353.                        logical page can range from zero to (maximum number
  5354.                        of logical pages allocated to the handle - 1).
  5355.  
  5356.                        If the logical page number is set to FFFFh, the
  5357.                        physical page associated with it is unmapped rather
  5358.                        than mapped.  Unmapping a physical page makes it
  5359.                        inaccessible for reading or writing.
  5360.  
  5361.                    .mappable_segment_address
  5362.                        The second member is a word which contains the
  5363.                        segment address at which the logical page is to be
  5364.                        mapped.  This segment address must correspond
  5365.                        exactly to a mappable segment address.  The mappable
  5366.                        segment addresses are available with Function 25
  5367.                        (Get Mappable Physical Address Array).
  5368.  
  5369.  
  5370.           REGISTERS MODIFIED
  5371.  
  5372.                AX
  5373.  
  5374.           EMM Functions                                                  85
  5375.  
  5376.  
  5377.  
  5378.  
  5379.  
  5380.           Function 17. Map/Unmap Multiple Handle Pages
  5381.           Logical Page/Segment Address Method
  5382.  
  5383.  
  5384.  
  5385.           STATUS
  5386.  
  5387.                AH = 0   SUCCESSFUL.
  5388.                    The logical pages have been mapped (or unmapped) at the
  5389.                    specified physical pages.
  5390.  
  5391.                AH = 80h   NON-RECOVERABLE.
  5392.                    The manager has detected a malfunction in the memory
  5393.                    manager software.
  5394.  
  5395.                AH = 81h   NON-RECOVERABLE.
  5396.                    The manager has detected a malfunction in the expanded
  5397.                    memory hardware.
  5398.  
  5399.                AH = 83h   NON-RECOVERABLE.
  5400.                    The manager could not find the specified EMM handle. 
  5401.                    The manager doesn't currently have any information
  5402.                    pertaining to the specified EMM handle.  The program has
  5403.                    probably corrupted its EMM handle.
  5404.  
  5405.                AH = 84h   NON-RECOVERABLE.
  5406.                    The function code passed to the manager is not defined.
  5407.  
  5408.                AH = 8Ah   RECOVERABLE.
  5409.                    One or more of the logical pages to be mapped is out of
  5410.                    the range of logical pages allocated to the EMM handle. 
  5411.                    The program can recover from this condition by mapping a
  5412.                    logical page which is within the bounds for the speci-
  5413.                    fied EMM handle.  When this error occurs, the only pages
  5414.                    mapped or unmapped were the ones valid up to the point
  5415.                    that the error occurred.
  5416.  
  5417.                AH = 8Bh   RECOVERABLE.
  5418.                    One or more of the mappable segment addresses specified
  5419.                    is not mappable, the segment address doesn't fall
  5420.                    exactly on a mappable address boundary, or the log_to_-
  5421.                    segment_map_len exceeds the number of mappable segments
  5422.                    in the system.  The program can recover from this
  5423.                    condition by mapping into memory on an exact mappable
  5424.                    segment address.  When this error occurs, the only pages
  5425.                    mapped were the ones valid up to the point that the
  5426.                    error occurred.
  5427.  
  5428.                AH = 8Fh   NON-RECOVERABLE.
  5429.                    The subfunction parameter is invalid.
  5430.  
  5431.  
  5432.  
  5433.           EMM Functions                                                  86
  5434.  
  5435.  
  5436.  
  5437.  
  5438.  
  5439.           Function 17. Map/Unmap Multiple Handle Pages
  5440.           Logical Page/Segment Address Method
  5441.  
  5442.  
  5443.  
  5444.           EXAMPLE
  5445.  
  5446.           log_to_seg_map             log_to_seg_map_struct 4 DUP (?)
  5447.  
  5448.           emm_handle                 DW ?
  5449.  
  5450.           MOV   AX,SEG log_to_seg_map
  5451.           MOV   DS,AX
  5452.           LEA   SI,log_to_seg_map             ; DS:SI points to
  5453.                                               ; log_to_seg_map
  5454.           MOV   CX,LENGTH log_to_seg_map
  5455.           MOV   DX,emm_handle
  5456.           MOV   AX,5001h                      ; load function code
  5457.           INT   67h                           ; call the memory manager
  5458.           OR    AH,AH                         ; check EMM status
  5459.           JNZ   emm_err_handler               ; jump to error handler on   
  5460.                                               ; error
  5461.  
  5462.  
  5463.  
  5464.  
  5465.  
  5466.  
  5467.  
  5468.  
  5469.  
  5470.  
  5471.  
  5472.  
  5473.  
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.  
  5480.  
  5481.  
  5482.  
  5483.  
  5484.  
  5485.  
  5486.  
  5487.  
  5488.  
  5489.  
  5490.  
  5491.  
  5492.           EMM Functions                                                  87
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.           Function 18. Reallocate Pages
  5499.  
  5500.  
  5501.  
  5502.           PURPOSE
  5503.  
  5504.                This function allows an application program to increase or
  5505.                decrease (reallocate) the number of logical pages allocated
  5506.                to an EMM handle.  There are four reallocation cases of
  5507.                interest:
  5508.  
  5509.                1.  A reallocation count of zero.  The handle assigned to
  5510.                    the application remains assigned and is still available
  5511.                    for use by the application.  The memory manager won't
  5512.                    reassign the handle to any other application.  However,
  5513.                    the handle will have any currently allocated pages
  5514.                    returned to the memory manager.  The application must
  5515.                    invoke the Deallocate Pages function (Function 6) before
  5516.                    returning to DOS, or the handle will remain assigned and
  5517.                    no other application will be able to use it.
  5518.  
  5519.                2.  A reallocation count equal to the current allocation
  5520.                    count.  This is not treated as an error, and a success-
  5521.                    ful status is returned.
  5522.  
  5523.                3.  A reallocation count greater than the current allocation
  5524.                    count.  The memory manager will attempt to add new pages
  5525.                    to those pages already allocated to the specified EMM
  5526.                    handle.  The number of new pages added is the difference
  5527.                    between the reallocation count and the current alloca-
  5528.                    tion count.  The sequence of logical pages allocated to
  5529.                    the EMM handle remains continuous after this operation. 
  5530.                    The newly allocated pages have logical page numbers
  5531.                    which begin where the previously allocated pages ended,
  5532.                    and continue in ascending sequence.
  5533.  
  5534.                4.  A reallocation count less than the current allocation
  5535.                    count.  The memory manager will attempt to subtract some
  5536.                    of the currently allocated pages and return them to the
  5537.                    memory manager.  The number of old pages subtracted is
  5538.                    the difference between the current allocation count and
  5539.                    the re-allocation count.  The pages are subtracted from
  5540.                    the end of the sequence of pages currently allocated to
  5541.                    the specified EMM handle.  The sequence of logical pages
  5542.                    allocated to the EMM handle remains continuous after
  5543.                    this operation.
  5544.  
  5545.  
  5546.  
  5547.  
  5548.  
  5549.  
  5550.  
  5551.           EMM Functions                                                  88
  5552.  
  5553.  
  5554.  
  5555.  
  5556.  
  5557.           Function 18. Reallocate Pages
  5558.  
  5559.  
  5560.  
  5561.           The handle determines what type of logical pages are being
  5562.           reallocated.  Logical pages which were originally allocated with
  5563.           Function 4 or Function 27 (Allocate Standard Pages subfunction)
  5564.           are called pages and are 16K bytes long.  Logical pages which
  5565.           were allocated with Function 27 (Allocate Raw Pages subfunction)
  5566.           are called raw pages and might not be the same size as pages
  5567.           allocated with Function 4.
  5568.  
  5569.  
  5570.           CALLING PARAMETERS
  5571.  
  5572.                AH = 51h
  5573.                    Contains the Reallocate Handle Pages function.
  5574.  
  5575.                DX = handle
  5576.                    Contains the EMM handle.
  5577.  
  5578.                BX = reallocation_count
  5579.                    Contains the total number of pages this handle should
  5580.                    have allocated to it after this function is invoked.
  5581.  
  5582.  
  5583.           RESULTS
  5584.  
  5585.                BX = number of pages allocated to handle after reallocation
  5586.                    Contains the number of pages now allocated to the EMM
  5587.                    handle after the pages have been added or subtracted. 
  5588.                    If the status returned is not zero, the value in BX is
  5589.                    equal to the number of pages allocated to the handle
  5590.                    prior to the invocation of this function.  This informa-
  5591.                    tion can be used to verify that the request generated
  5592.                    the expected results.
  5593.  
  5594.  
  5595.           REGISTERS MODIFIED
  5596.  
  5597.                AX, BX
  5598.  
  5599.  
  5600.           STATUS
  5601.  
  5602.                AH = 0   SUCCESSFUL.
  5603.                    The pages specified have been added to or subtracted
  5604.                    from the handle specified.
  5605.  
  5606.                AH = 80h   NON-RECOVERABLE.
  5607.                    The manager has detected a malfunction in the memory
  5608.                    manager software.
  5609.  
  5610.           EMM Functions                                                  89
  5611.  
  5612.  
  5613.  
  5614.  
  5615.  
  5616.           Function 18. Reallocate Pages
  5617.  
  5618.  
  5619.  
  5620.                AH = 81h   NON-RECOVERABLE.
  5621.                    The manager has detected a malfunction in the expanded
  5622.                    memory hardware.
  5623.  
  5624.                AH = 83h   NON-RECOVERABLE.
  5625.                    The manager could not find the specified EMM handle. 
  5626.                    The manager doesn't have any information pertaining to
  5627.                    the specified EMM handle.  The program may have cor-
  5628.                    rupted its EMM handle.
  5629.  
  5630.                AH = 84h   NON-RECOVERABLE.
  5631.                    The function code passed to the manager is not defined.
  5632.  
  5633.                AH = 87h   RECOVERABLE.
  5634.                    The number of pages that are available in the system is
  5635.                    insufficient for the new allocation request.  The
  5636.                    program can recover from this condition by specifying
  5637.                    fewer pages be allocated to the EMM handle.
  5638.  
  5639.                AH = 88h   RECOVERABLE.
  5640.                    The number of unallocated pages is insufficient for the
  5641.                    new allocation request.  The program can recover from
  5642.                    this condition by either requesting again when addition-
  5643.                    al pages are available or specifying fewer pages.
  5644.  
  5645.  
  5646.           EXAMPLE
  5647.  
  5648.           emm_handle                          DW ?
  5649.           realloc_count                       DW ?
  5650.           current_alloc_page_count            DW ?
  5651.  
  5652.           MOV   DX,emm_handle                 ; specify EMM handle
  5653.           MOV   BX,realloc_count              ; specify count
  5654.           MOV   AH,51h                        ; load function code
  5655.           INT   67h                           ; call the memory manager
  5656.           OR    AH,AH                         ; check EMM status
  5657.           JNZ   emm_err_handler               ; jump to error handler on   
  5658.                                               ; error
  5659.           MOV   current_alloc_page_count,BX
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.           EMM Functions                                                  90
  5670.  
  5671.  
  5672.  
  5673.  
  5674.  
  5675.           Function 19. Get/Set Handle Attribute
  5676.  
  5677.  
  5678.  
  5679.           Design Considerations
  5680.  
  5681.                This function is an option which will probably not be
  5682.                available in a typical expanded memory manager, system, or
  5683.                memory board.  Most personal computer systems disable memory
  5684.                refresh signals for a considerable period during a warm
  5685.                boot.  This can corrupt some of the data in memory boards,
  5686.                even though there is no problem with the design of the
  5687.                memory board, its operation, or the memory chips.  This
  5688.                memory refresh deficiency is present in the software design
  5689.                of the ROM BIOS in most personal computer systems.
  5690.  
  5691.                The majority of memory board designs, chip types, or
  5692.                personal computer systems won't be able to support the non-
  5693.                volatility feature.  The reason that this ROM BIOS deficien-
  5694.                cy is not evident in the conventional or extended memory
  5695.                area is that the ROM BIOS always initializes this area
  5696.                during a warm boot.  Memory data integrity is not a problem
  5697.                with the conventional or extended memory region, because it
  5698.                isn't physically possible to have data retained there across
  5699.                a warm boot event -- the ROM BIOS sets it to zero.
  5700.  
  5701.                Consequently, expanded memory board manufacturers should not
  5702.                supply this function unless their board can guarantee the
  5703.                integrity of data stored in the board's memory during a warm
  5704.                boot.  Generally, this means the memory board has an
  5705.                independent memory refresh controller which does not depend
  5706.                on the system board's memory refresh.
  5707.  
  5708.                If the expanded memory manager, system, or memory board
  5709.                cannot support this feature, it should return the not
  5710.                supported status described in the function.
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.           EMM Functions                                                  91
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734.           Function 19. Get/Set Handle Attribute
  5735.           Get Handle Attribute subfunction
  5736.  
  5737.  
  5738.  
  5739.           PURPOSE
  5740.  
  5741.                This subfunction returns the attribute associated with a
  5742.                handle.  The attributes are volatile or non-volatile. 
  5743.                Handles with non-volatile attributes enable the memory
  5744.                manager to save the contents of a handle's pages between
  5745.                warm boots.  However, this function may be disabled with a
  5746.                user option or may not be supported by the memory board or
  5747.                system hardware.
  5748.  
  5749.                If the handle's attribute has been set to non-volatile, the
  5750.                handle, its name (if it is assigned one), and the contents
  5751.                of the pages allocated to the handle are all maintained
  5752.                after a warm boot.
  5753.  
  5754.  
  5755.           CALLING PARAMETERS
  5756.  
  5757.                AX = 5200h
  5758.                    Contains the Get Handle Attribute subfunction.
  5759.  
  5760.                DX = handle
  5761.                    Contains the EMM handle.
  5762.  
  5763.  
  5764.           RESULTS
  5765.  
  5766.                These results are valid only if the status returned is zero.
  5767.  
  5768.                AL = handle attribute
  5769.                    Contains the EMM handle's attribute.  The only at-
  5770.                    tributes a handle may have are volatile or non-volatile. 
  5771.                    A value of zero indicates the handle is volatile.  A
  5772.                    value of one indicates that the handle is non-volatile.
  5773.  
  5774.  
  5775.           REGISTERS MODIFIED
  5776.  
  5777.                AX
  5778.  
  5779.  
  5780.           STATUS
  5781.  
  5782.                AH = 0   SUCCESSFUL.
  5783.                    The handle's attribute has been obtained.
  5784.  
  5785.  
  5786.  
  5787.           EMM Functions                                                  92
  5788.  
  5789.  
  5790.  
  5791.  
  5792.  
  5793.           Function 19. Get/Set Handle Attribute
  5794.           Get Handle Attribute subfunction
  5795.  
  5796.  
  5797.  
  5798.                AH = 80h   NON-RECOVERABLE.
  5799.                    The manager has detected a malfunction in the memory
  5800.                    manager software.
  5801.  
  5802.                AH = 81h   NON-RECOVERABLE.
  5803.                    The manager has detected a malfunction in the expanded
  5804.                    memory hardware.
  5805.  
  5806.                AH = 83h   NON-RECOVERABLE.
  5807.                    The manager couldn't find the specified EMM handle.  The
  5808.                    manager doesn't have any information pertaining to the
  5809.                    specified EMM handle.  The program may have corrupted
  5810.                    its EMM handle.
  5811.  
  5812.                AH = 84h   NON-RECOVERABLE.
  5813.                    The function code passed to the manager is not defined.
  5814.  
  5815.                AH = 8Fh   NON-RECOVERABLE.
  5816.                    The subfunction parameter is invalid.
  5817.  
  5818.                AH = 91h   NON-RECOVERABLE.
  5819.                    This feature is not supported.
  5820.  
  5821.  
  5822.           EXAMPLE
  5823.  
  5824.           emm_handle                     DW ?
  5825.           handle_attrib                  DB ?
  5826.  
  5827.           MOV   DX,emm_handle            ; specify EMM handle
  5828.           MOV   AX,5200h                 ; load function code
  5829.           INT   67h                      ; call the memory manager
  5830.           OR    AH,AH                    ; check EMM status
  5831.           JNZ   emm_err_handler          ; jump to error handler on error
  5832.           MOV   handle_attrib,AL         ; save handle attribute
  5833.  
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.           EMM Functions                                                  93
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.           Function 19. Get/Set Handle Attribute
  5853.           Set Handle Attribute subfunction
  5854.  
  5855.  
  5856.  
  5857.           PURPOSE
  5858.  
  5859.                This subfunction can be used to modify the attribute which a
  5860.                handle has associated with it.  The attributes which a
  5861.                handle may have are volatile or non-volatile.  The non-
  5862.                volatile attribute enables the EMM to save the contents of a
  5863.                handle's pages between warm boots.  However, this function
  5864.                may be disabled with a user option or may not be supported
  5865.                by the memory board or system hardware.
  5866.  
  5867.                If the handle's attribute has been set to non-volatile, the
  5868.                handle, its name (if it is assigned one), and the contents
  5869.                of the pages allocated to the handle are all maintained
  5870.                after a warm boot.
  5871.  
  5872.  
  5873.           CALLING PARAMETERS
  5874.  
  5875.                AX = 5201h
  5876.                    Contains the Set Handle Attribute function.
  5877.  
  5878.                DX = handle
  5879.                    Contains the EMM handle.
  5880.  
  5881.                BL = new handle attribute
  5882.                    Contains the handle's new attribute.  A value of zero
  5883.                    indicates that the handle should be made volatile.  A
  5884.                    value of one indicates that the handle should be made
  5885.                    non-volatile.
  5886.  
  5887.                    A volatile handle attribute instructs the memory manager
  5888.                    to deallocate both the handle and the pages allocated to
  5889.                    it after a warm boot.  If all handles have the volatile
  5890.                    attribute (the default attribute) at warm boot, the
  5891.                    handle directory will be empty and all of expanded
  5892.                    memory will be initialized to zero immediately after a
  5893.                    warm boot.
  5894.  
  5895.  
  5896.           REGISTERS MODIFIED
  5897.  
  5898.                AX
  5899.  
  5900.  
  5901.  
  5902.  
  5903.  
  5904.  
  5905.           EMM Functions                                                  94
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.           Function 19. Get/Set Handle Attribute
  5912.           Set Handle Attribute subfunction
  5913.  
  5914.  
  5915.  
  5916.           STATUS
  5917.  
  5918.                AH = 0   SUCCESSFUL.
  5919.                    The handle's attribute has been modified.
  5920.  
  5921.                AH = 80h   NON-RECOVERABLE.
  5922.                    The manager has detected a malfunction in the memory
  5923.                    manager software.
  5924.  
  5925.                AH = 81h   NON-RECOVERABLE.
  5926.                    The manager has detected a malfunction in the expanded
  5927.                    memory hardware.
  5928.  
  5929.                AH = 83h   NON-RECOVERABLE.
  5930.                    The manager could not find the specified EMM handle. 
  5931.                    The manager doesn't have any information pertaining to
  5932.                    the specified EMM handle.  The program may have cor-
  5933.                    rupted its EMM handle.
  5934.  
  5935.                AH = 84h   NON-RECOVERABLE.
  5936.                    The function code passed to the manager is not defined.
  5937.  
  5938.                AH = 8Fh   NON-RECOVERABLE.
  5939.                    The subfunction parameter is invalid.
  5940.  
  5941.                AH = 90h   NON-RECOVERABLE.
  5942.                    The attribute type is undefined.
  5943.  
  5944.                AH = 91h   NON-RECOVERABLE.
  5945.                    This feature is not supported.
  5946.  
  5947.  
  5948.           EXAMPLE
  5949.  
  5950.           emm_handle                     DW ?
  5951.           new_handle_attrib              DB ?
  5952.  
  5953.           MOV   DX,emm_handle            ; specify EMM handle
  5954.           MOV   BL,new_handle_attrib     ; specify the set attribute
  5955.           MOV   AX,5201h                 ; load function code
  5956.           INT   67h                      ; call the memory manager
  5957.           OR    AH,AH                    ; check EMM status
  5958.           JNZ   emm_err_handler          ; jump to error handler on error
  5959.  
  5960.  
  5961.  
  5962.  
  5963.  
  5964.           EMM Functions                                                  95
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.           Function 19. Get/Set Handle Attribute
  5971.           Get Attribute Capability subfunction
  5972.  
  5973.  
  5974.  
  5975.           PURPOSE
  5976.  
  5977.                This subfunction can be used to determine whether the memory
  5978.                manager can support the non-volatile attribute.
  5979.  
  5980.  
  5981.           CALLING PARAMETERS
  5982.  
  5983.                AX = 5202h
  5984.                    Contains the Get Attribute Capability subfunction.
  5985.  
  5986.  
  5987.           RESULTS
  5988.  
  5989.                These results are valid only if the status returned is zero.
  5990.  
  5991.                AL = attribute capability
  5992.                    Contains the attribute capability.  A value of zero
  5993.                    indicates that the memory manager and hardware supports
  5994.                    only volatile handles.  A value of one indicates that
  5995.                    the memory manager/hardware supports both volatile and
  5996.                    non-volatile handles.
  5997.  
  5998.  
  5999.           REGISTERS MODIFIED
  6000.  
  6001.                AX
  6002.  
  6003.  
  6004.           STATUS
  6005.  
  6006.                AH = 0   SUCCESSFUL.
  6007.                    The attribute capability has been returned.
  6008.  
  6009.                AH = 80h   NON-RECOVERABLE.
  6010.                    The manager has detected a malfunction in the memory
  6011.                    manager software.
  6012.  
  6013.                AH = 81h   NON-RECOVERABLE.
  6014.                    The manager has detected a malfunction in the expanded
  6015.                    memory hardware.
  6016.  
  6017.                AH = 84h   NON-RECOVERABLE.
  6018.                    The function code passed to the manager is not defined.
  6019.  
  6020.                AH = 8Fh   NON-RECOVERABLE.
  6021.                    The subfunction parameter is invalid.
  6022.  
  6023.           EMM Functions                                                  96
  6024.  
  6025.  
  6026.  
  6027.  
  6028.  
  6029.           Function 19. Get/Set Handle Attribute
  6030.           Get Attribute Capability subfunction
  6031.  
  6032.  
  6033.  
  6034.           EXAMPLE
  6035.  
  6036.           attrib_capability              DB ?
  6037.  
  6038.           MOV   AX,5202h                 ; load function code
  6039.           INT   67h                      ; call the memory manager
  6040.           OR    AH,AH                    ; check EMM status
  6041.           JNZ   emm_err_handler          ; jump to error handler on error
  6042.           MOV   attrib_capability,AL     ; save attribute capability
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.  
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.  
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073.  
  6074.  
  6075.  
  6076.  
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.           EMM Functions                                                  97
  6083.  
  6084.  
  6085.  
  6086.  
  6087.  
  6088.           Function 20. Get/Set Handle Name
  6089.           Get Handle Name subfunction
  6090.  
  6091.  
  6092.  
  6093.           PURPOSE
  6094.  
  6095.                This subfunction gets the eight character name currently
  6096.                assigned to a handle.  There is no restriction on the
  6097.                characters which may be used in the handle name (that is,
  6098.                anything from 00h through FFh).
  6099.  
  6100.                The handle name is initialized to ASCII nulls (binary zeros)
  6101.                three times:  when the memory manager is installed, when a
  6102.                handle is allocated, and when a handle is deallocated.  A
  6103.                handle with a name which is all ASCII nulls, by definition,
  6104.                has no name.  When a handle is assigned a name, at least one
  6105.                character in the name must be a non-null character in order
  6106.                to distinguish it from a handle without a name.
  6107.  
  6108.  
  6109.           CALLING PARAMETERS
  6110.  
  6111.                AX = 5300h
  6112.                    Contains the Get Handle Name function.
  6113.  
  6114.                DX = handle number
  6115.                    Contains the EMM handle.
  6116.  
  6117.                ES:DI = pointer to handle_name array
  6118.                    Contains a pointer to an eight-byte array into which the
  6119.                    name currently assigned to the handle will be copied.
  6120.  
  6121.  
  6122.           RESULTS
  6123.  
  6124.                These results are valid only if the status returned is zero.
  6125.  
  6126.                handle_name array
  6127.                    Contains the name associated with the specified handle.
  6128.  
  6129.  
  6130.           REGISTERS MODIFIED
  6131.  
  6132.                AX
  6133.  
  6134.  
  6135.           STATUS
  6136.  
  6137.                AH = 0   SUCCESSFUL.
  6138.                    The handle name has been returned.
  6139.  
  6140.  
  6141.           EMM Functions                                                  98
  6142.  
  6143.  
  6144.  
  6145.  
  6146.  
  6147.           Function 20. Get/Set Handle Name
  6148.           Get Handle Name subfunction
  6149.  
  6150.  
  6151.  
  6152.                AH = 80h   NON-RECOVERABLE.
  6153.                    The manager has detected a malfunction in the memory
  6154.                    manager software.
  6155.  
  6156.                AH = 81h   NON-RECOVERABLE.
  6157.                    The manager has detected a malfunction in the expanded
  6158.                    memory hardware.
  6159.  
  6160.                AH = 83h   NON-RECOVERABLE.
  6161.                    The manager couldn't find the specified EMM handle.  The
  6162.                    manager doesn't have any information on the specified
  6163.                    EMM handle.  The program may have corrupted its EMM
  6164.                    handle.
  6165.  
  6166.                AH = 84h   NON-RECOVERABLE.
  6167.                    The function code passed to the manager is not defined.
  6168.  
  6169.                AH = 8Fh   NON-RECOVERABLE.
  6170.                    The subfunction parameter is invalid.
  6171.  
  6172.  
  6173.           EXAMPLE
  6174.  
  6175.           handle_name                    DB 8 DUP (?)
  6176.           emm_handle                     DW ?
  6177.  
  6178.           MOV   AX,SEG handle_name
  6179.           MOV   ES,AX
  6180.           LEA   DI,handle_name           ; ES:DI points to handle_name
  6181.           MOV   DX,emm_handle            ; specify EMM handle
  6182.           MOV   AX,5300h                 ; load function code
  6183.           INT   67h                      ; call the memory manager
  6184.           OR    AH,AH                    ; check EMM status
  6185.           JNZ   emm_err_handler          ; jump to error handler on error
  6186.  
  6187.  
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.  
  6195.  
  6196.  
  6197.  
  6198.  
  6199.  
  6200.           EMM Functions                                                  99
  6201.  
  6202.  
  6203.  
  6204.  
  6205.  
  6206.           Function 20. Get/Set Handle Name
  6207.           Set Handle Name subfunction
  6208.  
  6209.  
  6210.  
  6211.           PURPOSE
  6212.  
  6213.                This subfunction assigns an eight character name to a
  6214.                handle.  There is no restriction on the characters which may
  6215.                be used in the handle name.  The full range of values may be
  6216.                assigned to each character in a name (that is, 00h through
  6217.                FFh).
  6218.  
  6219.                At installation, all handles have their name initialized to
  6220.                ASCII nulls (binary zeros).  A handle with a name consisting
  6221.                of all ASCII nulls has no name.  When a handle is assigned a
  6222.                name, at least one character in the name must be a non-null
  6223.                character in order to distinguish it from a handle without a
  6224.                name.  No two handles may have the same name.
  6225.  
  6226.                A handle can be renamed at any time by setting the handle's
  6227.                name to a new value.  A handle can have its name removed by
  6228.                setting the handle's name to all ASCII nulls.  When a handle
  6229.                is deallocated, its name is removed (set to ASCII nulls).
  6230.  
  6231.  
  6232.           CALLING PARAMETERS
  6233.  
  6234.                AX = 5301h
  6235.                    Contains the Set Handle Name function.
  6236.  
  6237.                DX = handle number
  6238.                    Contains the EMM handle.
  6239.  
  6240.                DS:SI = pointer to handle_name
  6241.                    Contains a pointer to a byte array which contains the
  6242.                    name that is to be assigned to the handle.  The handle
  6243.                    name must be padded with nulls if the name is less than
  6244.                    eight characters long.
  6245.  
  6246.  
  6247.           REGISTERS MODIFIED
  6248.  
  6249.                AX
  6250.  
  6251.  
  6252.           STATUS
  6253.  
  6254.                AH = 0   SUCCESSFUL.
  6255.                    The handle name has been assigned.
  6256.  
  6257.  
  6258.  
  6259.           EMM Functions                                                 100
  6260.  
  6261.  
  6262.  
  6263.  
  6264.  
  6265.           Function 20. Get/Set Handle Name
  6266.           Set Handle Name subfunction
  6267.  
  6268.  
  6269.  
  6270.                AH = 80h   NON-RECOVERABLE.
  6271.                    The manager has detected a malfunction in the memory
  6272.                    manager software.
  6273.  
  6274.                AH = 81h   NON-RECOVERABLE.
  6275.                    The manager has detected a malfunction in the expanded
  6276.                    memory hardware.
  6277.  
  6278.                AH = 83h   NON-RECOVERABLE.
  6279.                    The manager couldn't find the specified EMM handle.  The
  6280.                    manager doesn't currently have any information pertain-
  6281.                    ing to the specified EMM handle.  The program may have
  6282.                    corrupted its EMM handle.
  6283.  
  6284.                AH = 84h   NON-RECOVERABLE.
  6285.                    The function code passed to the manager is not defined.
  6286.  
  6287.                AH = 8Fh   NON-RECOVERABLE.
  6288.                    The subfunction parameter is invalid.
  6289.  
  6290.                AH = A1h   RECOVERABLE.
  6291.                    A handle with this name already exists.  The specified
  6292.                    handle was not assigned a name.
  6293.  
  6294.  
  6295.           EXAMPLE
  6296.  
  6297.           handle_name                    DB 'AARDVARK'
  6298.           emm_handle                     DW ?
  6299.  
  6300.           MOV   AX,SEG handle_name
  6301.           MOV   DS,AX
  6302.           LEA   SI,handle_name           ; DS:SI points to handle_name
  6303.           MOV   DX,emm_handle            ; specify EMM handle
  6304.           MOV   AX,5301h                 ; load function code
  6305.           INT   67h                      ; call the memory manager
  6306.           OR    AH,AH                    ; check EMM status
  6307.           JNZ   emm_err_handler          ; jump to error handler on error
  6308.  
  6309.  
  6310.  
  6311.  
  6312.  
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.           EMM Functions                                                 101
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.           Function 21. Get Handle Directory
  6325.           Get Handle Directory subfunction
  6326.  
  6327.  
  6328.  
  6329.           PURPOSE
  6330.  
  6331.                This function returns an array which contains all active
  6332.                handles and the names associated with each.  Handles which
  6333.                have not been assigned names have a default name of all
  6334.                ASCII nulls (binary zeros).  When a handle is first allo-
  6335.                cated, or when all the pages belonging to a handle are
  6336.                deallocated (that is, an open handle is closed), its default
  6337.                name is set to ASCII nulls.  It takes a subsequent assign-
  6338.                ment of a name for a handle to have a name after it has been
  6339.                opened.  The full range of values may be assigned to each
  6340.                character in a name (that is, 00h through FFh).
  6341.  
  6342.                The number of bytes required by the array is:
  6343.  
  6344.                            10 bytes * total number of handles
  6345.  
  6346.                The maximum size of this array is:
  6347.  
  6348.                            (10 bytes/entry) * 255 entries = 2550 bytes.
  6349.  
  6350.  
  6351.           CALLING PARAMETERS
  6352.  
  6353.                AX = 5400h
  6354.                    Contains the Get Handle Directory function.
  6355.  
  6356.                    handle_dir_struct               STRUC
  6357.                        handle_value                DW ?
  6358.                        handle_name                 DB 8 DUP (?)
  6359.                    handle_dir_struct               ENDS
  6360.  
  6361.                ES:DI = pointer to handle_dir
  6362.                    Contains a pointer to an area of memory into which the
  6363.                    memory manager will copy the handle directory.  The
  6364.                    handle directory is an array of structures.  There are
  6365.                    as many entries in the array as there are open EMM
  6366.                    handles.  The structure consists of the following
  6367.                    elements:
  6368.  
  6369.                    .handle_value
  6370.                        The first member is a word which contains the value
  6371.                        of the open EMM handle.
  6372.  
  6373.  
  6374.  
  6375.  
  6376.  
  6377.           EMM Functions                                                 102
  6378.  
  6379.  
  6380.  
  6381.  
  6382.  
  6383.           Function 21. Get Handle Directory
  6384.           Get Handle Directory subfunction
  6385.  
  6386.  
  6387.  
  6388.                    .handle_name
  6389.                        The second member is an 8 byte array which contains
  6390.                        the ASCII name associated with the EMM handle.  If
  6391.                        there is no name currently associated with the
  6392.                        handle, it has a value of all zeros (ASCII nulls).
  6393.  
  6394.  
  6395.           RESULTS
  6396.  
  6397.                These results are valid only if the status returned is zero.
  6398.  
  6399.                handle_dir
  6400.                    Contains the handle values and handle names associated
  6401.                    with each handle value.
  6402.  
  6403.                AL = number of entries in the handle_dir array
  6404.                    Contains the number of entries in the handle directory
  6405.                    array.  This is also the same as the number of open
  6406.                    handles.  For example, if only one handle is active, AL
  6407.                    will contain a one.
  6408.  
  6409.  
  6410.           REGISTERS MODIFIED
  6411.  
  6412.                AX
  6413.  
  6414.  
  6415.           STATUS
  6416.  
  6417.                AH = 0   SUCCESSFUL.
  6418.                    The handle directory has been returned.
  6419.  
  6420.                AH = 80h   NON-RECOVERABLE.
  6421.                    The manager has detected a malfunction in the memory
  6422.                    manager software.
  6423.  
  6424.                AH = 81h   NON-RECOVERABLE.
  6425.                    The manager has detected a malfunction in the expanded
  6426.                    memory hardware.
  6427.  
  6428.                AH = 84h   NON-RECOVERABLE.
  6429.                    The function code passed to the manager is not defined.
  6430.  
  6431.                AH = 8Fh   NON-RECOVERABLE.
  6432.                    The subfunction parameter is invalid.
  6433.  
  6434.  
  6435.  
  6436.           EMM Functions                                                 103
  6437.  
  6438.  
  6439.  
  6440.  
  6441.  
  6442.           Function 21. Get Handle Directory
  6443.           Get Handle Directory subfunction
  6444.  
  6445.  
  6446.  
  6447.           EXAMPLE
  6448.  
  6449.           handle_dir                    handle_dir_struct 255 DUP (?)
  6450.  
  6451.           num_entries_in_handle_dir     DB ?
  6452.  
  6453.           MOV   AX,SEG handle_dir
  6454.           MOV   ES,AX
  6455.           LEA   DI,handle_dir                 ; ES:DI points to handle_dir
  6456.           MOV   AX,5400h                      ; load function code
  6457.           INT   67h                           ; call the memory manager
  6458.           OR    AH,AH                         ; check EMM status
  6459.           JNZ   emm_err_handler               ; jump to error handler on   
  6460.                                               ; error
  6461.           MOV   num_entries_in_handle_dir,AL  ; save number of entries
  6462.  
  6463.  
  6464.  
  6465.  
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.  
  6475.  
  6476.  
  6477.  
  6478.  
  6479.  
  6480.  
  6481.  
  6482.  
  6483.  
  6484.  
  6485.  
  6486.  
  6487.  
  6488.  
  6489.  
  6490.  
  6491.  
  6492.  
  6493.  
  6494.  
  6495.           EMM Functions                                                 104
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.           Function 21. Get Handle Directory
  6502.           Search For Named Handle subfunction
  6503.  
  6504.  
  6505.  
  6506.           PURPOSE
  6507.  
  6508.                This subfunction searches the handle name directory for a
  6509.                handle with a particular name.  If the named handle is
  6510.                found, this subfunction returns the handle number associated
  6511.                with the name.  At the time of installation, all handles
  6512.                have their names initialized to ASCII nulls.  A handle with
  6513.                a name which is all ASCII nulls has, by definition, no name. 
  6514.                When a handle is assigned a name, at least one character in
  6515.                the name must be a non-null character in order to distin-
  6516.                guish it from a handle without a name.
  6517.  
  6518.  
  6519.           CALLING PARAMETERS
  6520.  
  6521.                AX = 5401h
  6522.                    Contains the Search for Named Handle subfunction.
  6523.  
  6524.                DS:SI = handle_name
  6525.                    Contains a pointer to an 8-byte string that contains the
  6526.                    name of the handle being searched for.
  6527.  
  6528.  
  6529.           RESULTS
  6530.  
  6531.                These results are valid only if the status returned is zero.
  6532.  
  6533.                DX = value of named handle
  6534.                    The value of the handle which matches the handle name
  6535.                    specified.
  6536.  
  6537.  
  6538.           REGISTERS MODIFIED
  6539.  
  6540.                AX, DX
  6541.  
  6542.  
  6543.           STATUS
  6544.  
  6545.                AH = 0   SUCCESSFUL.
  6546.                    The handle value for the named handle has been found.
  6547.  
  6548.                AH = 80h   NON-RECOVERABLE.
  6549.                    The manager has detected a malfunction in the memory
  6550.                    manager software.
  6551.  
  6552.  
  6553.  
  6554.           EMM Functions                                                 105
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.           Function 21. Get Handle Directory
  6561.           Search For Named Handle subfunction
  6562.  
  6563.  
  6564.  
  6565.                AH = 81h   NON-RECOVERABLE.
  6566.                    The manager has detected a malfunction in the expanded
  6567.                    memory hardware.
  6568.  
  6569.                AH = 84h   NON-RECOVERABLE.
  6570.                    The function code passed to the manager is not defined.
  6571.  
  6572.                AH = 8Fh   NON-RECOVERABLE.
  6573.                    The subfunction parameter is invalid.
  6574.  
  6575.                AH = A0h   NON-RECOVERABLE.
  6576.                    No corresponding handle could be found for the handle
  6577.                    name specified.
  6578.  
  6579.                AH = A1h   NON-RECOVERABLE.
  6580.                    A handle found had no name (all ASCII nulls).
  6581.  
  6582.  
  6583.           EXAMPLE
  6584.  
  6585.           named_handle                   DB 'AARDVARK'
  6586.           named_handle_value             DW ?
  6587.  
  6588.           MOV   AX,SEG named_handle
  6589.           MOV   DS,AX
  6590.           LEA   SI,named_handle          ; DS:SI points to named_handle
  6591.           MOV   AX,5401h                 ; load function code
  6592.           INT   67h                      ; call the memory manager
  6593.           OR    AH,AH                    ; check EMM status
  6594.           JNZ   emm_err_handler          ; jump to error handler on error
  6595.           MOV   named_handle_value,DX    ; save value of named handle
  6596.  
  6597.  
  6598.  
  6599.  
  6600.  
  6601.  
  6602.  
  6603.  
  6604.  
  6605.  
  6606.  
  6607.  
  6608.  
  6609.  
  6610.  
  6611.  
  6612.  
  6613.           EMM Functions                                                 106
  6614.  
  6615.  
  6616.  
  6617.  
  6618.  
  6619.           Function 21. Get Handle Directory
  6620.           Get Total Handles subfunction
  6621.  
  6622.  
  6623.  
  6624.           PURPOSE
  6625.  
  6626.                This subfunction returns the total number of handles that
  6627.                the memory manager supports, including the operating system
  6628.                handle (handle value 0).
  6629.  
  6630.  
  6631.           CALLING PARAMETERS
  6632.  
  6633.                AX = 5402h
  6634.                    Contains the Get Total Handles subfunction.
  6635.  
  6636.  
  6637.           RESULTS
  6638.  
  6639.                These results are valid only if the status returned is zero.
  6640.  
  6641.                BX = total_handles
  6642.                    The value returned represents the maximum number of
  6643.                    handles which a program may request the memory manager
  6644.                    to allocate memory to.  The value returned includes the
  6645.                    operating system handle (handle value 0).
  6646.  
  6647.  
  6648.           REGISTERS MODIFIED
  6649.  
  6650.                AX, BX
  6651.  
  6652.  
  6653.           STATUS
  6654.  
  6655.                AH = 0   SUCCESSFUL.
  6656.                    The total number of handles supported has been returned.
  6657.  
  6658.                AH = 80h   NON-RECOVERABLE.
  6659.                    The manager has detected a malfunction in the memory
  6660.                    manager software.
  6661.  
  6662.                AH = 81h   NON-RECOVERABLE.
  6663.                    The manager has detected a malfunction in the expanded
  6664.                    memory hardware.
  6665.  
  6666.                AH = 84h   NON-RECOVERABLE.
  6667.                    The function code passed to the manager is not defined.
  6668.  
  6669.                AH = 8Fh   NON-RECOVERABLE.
  6670.                    The subfunction parameter is invalid.
  6671.  
  6672.           EMM Functions                                                 107
  6673.  
  6674.  
  6675.  
  6676.  
  6677.  
  6678.           Function 21. Get Handle Directory
  6679.           Get Total Handles subfunction
  6680.  
  6681.  
  6682.  
  6683.           EXAMPLE
  6684.  
  6685.           total_handles                  DW ?
  6686.  
  6687.           MOV   AX,5402h                 ; load function code
  6688.           INT   67h                      ; call the memory manager
  6689.           OR    AH,AH                    ; check EMM status
  6690.           JNZ   emm_err_handler          ; jump to error handler on error
  6691.           MOV   total_handles,BX         ; save total handle count
  6692.  
  6693.  
  6694.  
  6695.  
  6696.  
  6697.  
  6698.  
  6699.  
  6700.  
  6701.  
  6702.  
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708.  
  6709.  
  6710.  
  6711.  
  6712.  
  6713.  
  6714.  
  6715.  
  6716.  
  6717.  
  6718.  
  6719.  
  6720.  
  6721.  
  6722.  
  6723.  
  6724.  
  6725.  
  6726.  
  6727.  
  6728.  
  6729.  
  6730.  
  6731.           EMM Functions                                                 108
  6732.  
  6733.  
  6734.  
  6735.  
  6736.  
  6737.           Function 22. Alter Page Map & Jump
  6738.  
  6739.  
  6740.  
  6741.           PURPOSE
  6742.  
  6743.                This function alters the memory mapping context and trans-
  6744.                fers control to the specified address.  It is analogous to
  6745.                the FAR JUMP in the 8086 family architecture.  The memory
  6746.                mapping context which existed before the invocation of this
  6747.                function is lost.
  6748.  
  6749.                Mapping no pages and jumping is not considered an error.  If
  6750.                a request to map zero pages and jump is made, control is
  6751.                transferred to the target address, and this function
  6752.                performs a far jump.
  6753.  
  6754.  
  6755.           CALLING PARAMETERS
  6756.  
  6757.                AH = 55h
  6758.                    Contains the Alter Page Map & Jump function.
  6759.  
  6760.                    log_phys_map_struct             STRUC
  6761.                        log_page_number             DW ?
  6762.                        phys_page_number_seg        DW ?
  6763.                    log_phys_map_struct             ENDS
  6764.  
  6765.                    map_and_jump_struct             STRUC
  6766.                        target_address              DD ?
  6767.                        log_phys_map_len            DB ?
  6768.                        log_phys_map_ptr            DD ?
  6769.                    map_and_jump_struct             ENDS
  6770.  
  6771.                AL = physical page number/segment selector
  6772.                    Contains a code which indicates whether the value
  6773.                    contained in the
  6774.  
  6775.                        .log_phys_map.phys_page_number_seg
  6776.  
  6777.                    members are physical page numbers or are the segment
  6778.                    address representation of the physical page numbers.  A
  6779.                    zero in AL indicates that the values are physical page
  6780.                    numbers.  A one in AL indicates that the values in these
  6781.                    members are the segment address representations of the
  6782.                    physical page numbers.
  6783.  
  6784.                DX = handle number
  6785.                    Contains the EMM handle.
  6786.  
  6787.  
  6788.  
  6789.  
  6790.           EMM Functions                                                 109
  6791.  
  6792.  
  6793.  
  6794.  
  6795.  
  6796.           Function 22. Alter Page Map & Jump
  6797.  
  6798.  
  6799.  
  6800.                DS:SI = pointer to map_and_jump structure
  6801.                    Contains a pointer to a structure that contains the
  6802.                    information necessary to map the desired physical pages
  6803.                    and jump to the target address.  The structure consists
  6804.                    of the following elements:
  6805.  
  6806.                    .target_address
  6807.                        The first member is a far pointer which contains the
  6808.                        target address to which control is to be trans-
  6809.                        ferred.  The address is represented in segment:of-
  6810.                        fset format.  The offset portion of the address is
  6811.                        stored in the low portion of the double word.
  6812.  
  6813.                    .log_phys_map_len
  6814.                        The second member is a byte which contains the
  6815.                        number of entries in the array of structures which
  6816.                        immediately follows it.  The array is as long as the
  6817.                        application developer needs in order to map the
  6818.                        desired logical pages into physical pages.  The
  6819.                        number of entries cannot exceed the number of
  6820.                        mappable pages in the system.
  6821.  
  6822.                    .log_phys_map_ptr
  6823.                        The third member is a pointer to an array of struc-
  6824.                        tures which contain the logical page numbers and
  6825.                        physical pages or segment address at which they are
  6826.                        to be mapped.  Each entry in the array of structures
  6827.                        contains the following two elements:
  6828.  
  6829.                    .log_page_number
  6830.                        The first member of this structure is a word which
  6831.                        contains the number of the logical page to be
  6832.                        mapped.
  6833.  
  6834.                    .phys_page_number_seg
  6835.                        The second member of this structure is a word which
  6836.                        contains either the physical page number or the
  6837.                        segment address representation of the physical page
  6838.                        number at which the previous logical page number is
  6839.                        to be mapped.  The value passed in AL determines the
  6840.                        type of representation.
  6841.  
  6842.  
  6843.           REGISTERS MODIFIED
  6844.  
  6845.                AX
  6846.  
  6847.  
  6848.  
  6849.           EMM Functions                                                 110
  6850.  
  6851.  
  6852.  
  6853.  
  6854.  
  6855.           Function 22. Alter Page Map & Jump
  6856.  
  6857.  
  6858.  
  6859.           Note............................................................
  6860.                Values in registers which don't contain required parameters
  6861.                maintain the values across the jump.  The values in regis-
  6862.                ters (with the exception of AX) and the flag state at the
  6863.                beginning of the function are still in the registers and
  6864.                flags when the target address is reached.
  6865.  
  6866.  
  6867.           STATUS
  6868.  
  6869.                AH = 0   SUCCESSFUL.
  6870.                    Control has been transferred to the target address.
  6871.  
  6872.                AH = 80h   NON-RECOVERABLE.
  6873.                    The manager has detected a malfunction in the memory
  6874.                    manager software.
  6875.  
  6876.                AH = 81h   NON-RECOVERABLE.
  6877.                    The manager has detected a malfunction in the expanded
  6878.                    memory hardware.
  6879.  
  6880.                AH = 83h   NON-RECOVERABLE.
  6881.                    The manager could not find the specified EMM handle. 
  6882.                    The manager does not currently have any information
  6883.                    pertaining to the specified EMM handle.  The program may
  6884.                    have corrupted its EMM handle.
  6885.  
  6886.                AH = 84h   NON-RECOVERABLE.
  6887.                    The function code passed to the manager is not defined.
  6888.  
  6889.                AH = 8Ah   RECOVERABLE.
  6890.                    One or more of the logical pages to map into a cor-
  6891.                    responding physical page is out of the range of logical
  6892.                    pages which are allocated to the EMM handle.  The
  6893.                    program can recover from this condition by mapping a
  6894.                    logical page which is within the bounds for the EMM
  6895.                    handle.
  6896.  
  6897.                AH = 8Bh   RECOVERABLE.
  6898.                    One or more of the physical pages is out of the range of
  6899.                    allowable physical pages, or the log_phys_map_len
  6900.                    exceeds the number of mappable pages in the system. 
  6901.                    Physical page numbers are numbered zero-relative.  The
  6902.                    program can recover from this condition by mapping into
  6903.                    memory at a physical page which is in the range of
  6904.                    supported physical pages.
  6905.  
  6906.  
  6907.  
  6908.           EMM Functions                                                 111
  6909.  
  6910.  
  6911.  
  6912.  
  6913.  
  6914.           Function 22. Alter Page Map & Jump
  6915.  
  6916.  
  6917.  
  6918.                AH = 8Fh   NON-RECOVERABLE.
  6919.                    The subfunction parameter is invalid.
  6920.  
  6921.  
  6922.           EXAMPLE
  6923.  
  6924.           log_phys_map              log_phys_map_struct (?) DUP (?)
  6925.  
  6926.           map_and_jump              map_and_jump_struct (?)
  6927.  
  6928.           emm_handle                          DW ?
  6929.           phys_page_or_seg_mode               DB ?
  6930.  
  6931.           MOV   AX,SEG map_and_jump
  6932.           MOV   DS,AX
  6933.           LEA   SI,map_and_jump               ; DS:SI points to
  6934.                                               ; map_and_jump
  6935.           MOV   DX,emm_handle
  6936.           MOV   AH,55h                        ; load function code
  6937.           MOV   AL,phys_page_or_seg_mode      ; specify physical page
  6938.                                               ; or segment mode
  6939.           INT   67h                           ; call memory manager
  6940.           OR    AH,AH                         ; check EMM status
  6941.           JNZ   emm_err_handler               ; jump to error handler on   
  6942.                                               ; error
  6943.  
  6944.  
  6945.  
  6946.  
  6947.  
  6948.  
  6949.  
  6950.  
  6951.  
  6952.  
  6953.  
  6954.  
  6955.  
  6956.  
  6957.  
  6958.  
  6959.  
  6960.  
  6961.  
  6962.  
  6963.  
  6964.  
  6965.  
  6966.  
  6967.           EMM Functions                                                 112
  6968.  
  6969.  
  6970.  
  6971.  
  6972.  
  6973.           Function 23. Alter Page Map & Call
  6974.           Alter Page Map & Call subfunction
  6975.  
  6976.  
  6977.  
  6978.           PURPOSE
  6979.  
  6980.                This subfunction saves the current memory mapping context,
  6981.                alters the specified memory mapping context, and transfers
  6982.                control to the specified address.  It is analogous to the
  6983.                FAR CALL in the 8086 family architecture.  Just as a return
  6984.                from a FAR CALL restores the original value in the code
  6985.                segment register, this subfunction restores the state of the
  6986.                specified mapping context after the return.
  6987.  
  6988.                There is no explicit expanded memory subfunction which
  6989.                emulates a return from a FAR CALL.  However, this facility
  6990.                is implicitly available through the standard return from a
  6991.                FAR CALL.  The following paragraphs describe how this works:
  6992.  
  6993.                After this function is invoked, unless an error is detected,
  6994.                the memory manager will transfer control to the address
  6995.                specified.  If an error occurs, the memory manager returns
  6996.                immediately with the error code in the AH register. 
  6997.                Otherwise, the memory manager pushes on the stack informa-
  6998.                tion which enables it to restore the mapping context after
  6999.                the return.
  7000.  
  7001.                When the called procedure wants to return to the calling
  7002.                procedure, it simply issues a standard FAR RETURN.  The
  7003.                memory manager traps this return, restores the specified
  7004.                mapping context, and returns to the calling procedure.  The
  7005.                memory manager also returns a status from a successful
  7006.                return just as it does for all functions.
  7007.  
  7008.                Developers using this subfunction must make allowances for
  7009.                the additional stack space this subfunction will use.
  7010.  
  7011.  
  7012.           CALLING PARAMETERS
  7013.  
  7014.                AH = 56h
  7015.                    Contains the Alter Page Map & Call function.
  7016.  
  7017.                    log_phys_map_struct             STRUC
  7018.                        log_page_number             DW ?
  7019.                        phys_page_number_seg        DW ?
  7020.                    log_phys_map_struct             ENDS
  7021.  
  7022.  
  7023.  
  7024.  
  7025.  
  7026.           EMM Functions                                                 113
  7027.  
  7028.  
  7029.  
  7030.  
  7031.  
  7032.           Function 23. Alter Page Map & Call
  7033.           Alter Page Map & Call subfunction
  7034.  
  7035.  
  7036.  
  7037.                    map_and_call_struct             STRUC
  7038.                        target_address              DD ?
  7039.                        new_page_map_len            DB ?
  7040.                        new_page_map_ptr            DD ?
  7041.                        old_page_map_len            DB ?
  7042.                        old_page_map_ptr            DD ?
  7043.                        reserved                    DW 4 DUP (?)
  7044.                    map_and_call_struct             ENDS
  7045.  
  7046.                AL = physical page number/segment selector
  7047.                    Contains a code which indicates whether the value
  7048.                    contained in the
  7049.  
  7050.                        .new_page_map.phys_page_number_seg
  7051.                        .old_page_map.phys_page_number_seg
  7052.  
  7053.                    members are physical page numbers or are the segment
  7054.                    address representation of the physical page numbers.  A
  7055.                    value of zero in AL indicates that the values in these
  7056.                    members are physical page numbers.  A value of one in AL
  7057.                    indicates that the values in these members are the
  7058.                    segment address representations of the physical page
  7059.                    numbers.
  7060.  
  7061.                DX = handle number
  7062.                    Contains the EMM handle.
  7063.  
  7064.                DS:SI = pointer to map_and_call structure
  7065.                    Contains a pointer to a structure which contains the
  7066.                    information necessary to map the desired physical pages
  7067.                    and call the target address.  The structure members are
  7068.                    described here:
  7069.  
  7070.                    .target_address
  7071.                        The first member is a far pointer which contains the
  7072.                        target address to which control is to be trans-
  7073.                        ferred.  The address is represented in segment:of-
  7074.                        fset format.  The offset portion of the address is
  7075.                        stored in the low portion of the pointer.  The
  7076.                        application must supply this value.
  7077.  
  7078.                    .new_page_map_len
  7079.                        The second member is a byte which contains the
  7080.                        number of entries in the new mapping context to
  7081.                        which new_page_map_ptr points.  This number cannot
  7082.                        exceed the number of mappable pages in the system.
  7083.  
  7084.  
  7085.           EMM Functions                                                 114
  7086.  
  7087.  
  7088.  
  7089.  
  7090.  
  7091.           Function 23. Alter Page Map & Call
  7092.           Alter Page Map & Call subfunction
  7093.  
  7094.  
  7095.  
  7096.                    .new_page_map_ptr
  7097.                        The third member is a far pointer that points to an
  7098.                        array of structures which contains a list of the
  7099.                        logical page numbers and the physical page num-
  7100.                        bers/segments at which they are to be mapped im-
  7101.                        mediately after the call.  The contents of the new
  7102.                        array of structures are described at the end of the
  7103.                        map_and_call structure.
  7104.  
  7105.                    .old_page_map_len
  7106.                        The fourth member is a byte which contains the
  7107.                        number of entries in the old mapping context to
  7108.                        which old_page_map_ptr points.  This number cannot
  7109.                        exceed the number of mappable pages in the system.
  7110.  
  7111.                    .old_page_map_ptr
  7112.                        The fifth member is a far pointer that points to an
  7113.                        array of structures which contains a list of the
  7114.                        logical page numbers and the physical page num-
  7115.                        bers/segments at which they are to be mapped im-
  7116.                        mediately after the return.  The contents of the old
  7117.                        array of structures are described at the end of the
  7118.                        map_and_call structure.
  7119.  
  7120.                    .reserved
  7121.                        The sixth member is reserved for use by the memory
  7122.                        manager.
  7123.  
  7124.                Each entry in the old and new array of structures contains
  7125.                two elements:
  7126.  
  7127.                    .log_page_number
  7128.                        The first member of this structure is a word which
  7129.                        contains a logical page number which is to be mapped
  7130.                        at the succeeding physical page number/segment
  7131.                        immediately after the CALL (in the case of the new
  7132.                        array of structures) or after the RETURN (in the
  7133.                        case of the old array of structures).
  7134.  
  7135.                    .phys_page_number_seg
  7136.                        The second member of this structure is a word which
  7137.                        contains either the physical page number or the
  7138.                        segment address representation of the physical page
  7139.                        number/segment at which the preceding logical page
  7140.                        is to be mapped immediately after the CALL (in the
  7141.                        case of the new array of structures) or after the
  7142.                        RETURN (in the case of the old array of structures).
  7143.  
  7144.           EMM Functions                                                 115
  7145.  
  7146.  
  7147.  
  7148.  
  7149.  
  7150.           Function 23. Alter Page Map & Call
  7151.           Alter Page Map & Call subfunction
  7152.  
  7153.  
  7154.  
  7155.           REGISTERS MODIFIED
  7156.  
  7157.                AX
  7158.  
  7159.           Note............................................................
  7160.                Values in registers which don't contain required parameters
  7161.                maintain the values across the call.  The values in regis-
  7162.                ters (with the exception of AX) and the flag state at the
  7163.                beginning of the function are still in the registers and
  7164.                flags when the target address is reached.
  7165.  
  7166.  
  7167.           STATUS
  7168.  
  7169.                AH = 0   SUCCESSFUL.
  7170.                    Control has been transferred to the target address.
  7171.  
  7172.                AH = 80h   NON-RECOVERABLE.
  7173.                    The manager has detected a malfunction in the memory
  7174.                    manager software.
  7175.  
  7176.                AH = 81h   NON-RECOVERABLE.
  7177.                    The manager has detected a malfunction in the expanded
  7178.                    memory hardware.
  7179.  
  7180.                AH = 83h   NON-RECOVERABLE.
  7181.                    The manager couldn't find the specified EMM handle.  The
  7182.                    manager doesn't have any information pertaining to the
  7183.                    specified EMM handle.  The program may have corrupted
  7184.                    its EMM handle.
  7185.  
  7186.                AH = 84h   NON-RECOVERABLE.
  7187.                    The function code passed to the manager is not defined.
  7188.  
  7189.                AH = 8Ah   RECOVERABLE.
  7190.                    One or more of the logical pages to map into a cor-
  7191.                    responding physical page is out of the range of logical
  7192.                    pages which are allocated to the EMM handle.  The
  7193.                    program can recover from this condition by mapping a
  7194.                    logical page which is within the bounds for the EMM
  7195.                    handle.
  7196.  
  7197.  
  7198.  
  7199.  
  7200.  
  7201.  
  7202.  
  7203.           EMM Functions                                                 116
  7204.  
  7205.  
  7206.  
  7207.  
  7208.  
  7209.           Function 23. Alter Page Map & Call
  7210.           Alter Page Map & Call subfunction
  7211.  
  7212.  
  7213.  
  7214.                AH = 8Bh   RECOVERABLE.
  7215.                    One or more of the physical pages is out of the range of
  7216.                    allowable physical pages, or you've specified more
  7217.                    physical pages than exist in the system.  Physical page
  7218.                    numbers are numbered zero-relative.  The program can
  7219.                    recover from this condition by mapping a physical page
  7220.                    which is in the range from zero to three.
  7221.  
  7222.                AH = 8Fh   NON-RECOVERABLE.
  7223.                    The subfunction parameter is invalid.
  7224.  
  7225.  
  7226.           EXAMPLE
  7227.  
  7228.           new_page_map              log_phys_map_struct (?) DUP (?)
  7229.  
  7230.           old_page_map              log_phys_map_struct (?) DUP (?)
  7231.  
  7232.           map_and_call              map_and_call_struct (?)
  7233.  
  7234.           emm_handle                DW ?
  7235.           phys_page_or_seg_mode     DB ?
  7236.  
  7237.           MOV   AX,SEG map_and_call
  7238.           MOV   DS,AX
  7239.           LEA   SI,map_and_call               ; DS:SI points to
  7240.                                               ; map_and_call
  7241.           MOV   DX,emm_handle                 ; specify EMM handle
  7242.           MOV   AH,56h                        ; load function code
  7243.           MOV   AL,phys_page_or_seg_mode      ; specify physical page
  7244.                                               ; or segment mode
  7245.           INT   67h                           ; control is actually
  7246.                                               ; transferred to the called
  7247.                                               ; procedure at this point
  7248.           OR    AH,AH                         ; check EMM status
  7249.           JNZ   emm_err_handler               ; jump to error handler on
  7250.                                               ; error
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.  
  7258.  
  7259.  
  7260.  
  7261.  
  7262.           EMM Functions                                                 117
  7263.  
  7264.  
  7265.  
  7266.  
  7267.  
  7268.           Function 23. Alter Page Map & Call
  7269.           Get Page Map Stack Space Size subfunction
  7270.  
  7271.  
  7272.  
  7273.           PURPOSE
  7274.  
  7275.                Since the Alter Page Map & Call function pushes additional
  7276.                information onto the stack, this subfunction returns the
  7277.                number of bytes of stack space the function requires.
  7278.  
  7279.  
  7280.           CALLING PARAMETERS
  7281.  
  7282.                AX = 5602h
  7283.                    Contains the Get Page Map Stack Space Size subfunction.
  7284.  
  7285.  
  7286.           RESULTS
  7287.  
  7288.                These results are valid only if the status returned is zero.
  7289.  
  7290.                BX = stack space required
  7291.                    Contains the number of bytes which the Alter Page Map &
  7292.                    Call function will require.  In other words, BX contains
  7293.                    the number (including the return address) which has to
  7294.                    be added to the stack pointer to remove all elements
  7295.                    from the stack.
  7296.  
  7297.  
  7298.           REGISTERS MODIFIED
  7299.  
  7300.                AX, BX
  7301.  
  7302.  
  7303.           STATUS
  7304.  
  7305.                AH = 0   SUCCESSFUL.
  7306.                    The size of the array has been returned.
  7307.  
  7308.                AH = 80h   NON-RECOVERABLE.
  7309.                    The manager has detected a malfunction in the memory
  7310.                    manager software.
  7311.  
  7312.                AH = 81h   NON-RECOVERABLE.
  7313.                    The manager has detected a malfunction in the expanded
  7314.                    memory hardware.
  7315.  
  7316.                AH = 84h   NON-RECOVERABLE.
  7317.                    The function code passed to the manager is not defined.
  7318.  
  7319.  
  7320.  
  7321.           EMM Functions                                                 118
  7322.  
  7323.  
  7324.  
  7325.  
  7326.  
  7327.           Function 23. Alter Page Map & Call
  7328.           Get Page Map Stack Space Size subfunction
  7329.  
  7330.  
  7331.  
  7332.                AH = 8Fh   NON-RECOVERABLE.
  7333.                    The subfunction parameter is invalid.
  7334.  
  7335.  
  7336.           EXAMPLE
  7337.  
  7338.           stack_space_reqd               DW ?
  7339.  
  7340.           MOV   AX,5602h                 ; load function code
  7341.           INT   67h                      ; call the memory manager
  7342.           OR    AH,AH                    ; check EMM status
  7343.           JNZ   emm_err_handler          ; jump to error handler on error
  7344.           MOV   stack_space_reqd,BX      ; save required stack size count
  7345.  
  7346.  
  7347.  
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361.  
  7362.  
  7363.  
  7364.  
  7365.  
  7366.  
  7367.  
  7368.  
  7369.  
  7370.  
  7371.  
  7372.  
  7373.  
  7374.  
  7375.  
  7376.  
  7377.  
  7378.  
  7379.  
  7380.           EMM Functions                                                 119
  7381.  
  7382.  
  7383.  
  7384.  
  7385.  
  7386.           Function 24. Move/Exchange Memory Region
  7387.           Move Memory Region subfunction
  7388.  
  7389.  
  7390.  
  7391.           PURPOSE
  7392.  
  7393.                This subfunction copies a region of memory in the following
  7394.                memory source/destination combinations.
  7395.  
  7396.                o   conventional memory to conventional memory
  7397.  
  7398.                o   conventional memory to expanded memory
  7399.  
  7400.                o   expanded memory to conventional memory
  7401.  
  7402.                o   expanded memory to expanded memory
  7403.  
  7404.                You do not have to save and restore the expanded memory
  7405.                mapping context to perform these move operations.  The
  7406.                current mapping context is maintained throughout this
  7407.                operation.
  7408.  
  7409.                The length of the region is limited by the amount of
  7410.                expanded memory allocated to the handles specified. 
  7411.                However, in most practical applications, the region length
  7412.                will be considerably smaller.  A region length of zero is
  7413.                not an error, and no move will be performed.
  7414.  
  7415.                A region length which exceeds 16K bytes is not an error.  In
  7416.                this case the function assumes that a group of logical pages
  7417.                is the target for the move.  The logical page specified
  7418.                represents the first logical page in which the move will
  7419.                take place.  If the region length exceeds 16K bytes, or if
  7420.                the region is less than 16K bytes but spans logical pages,
  7421.                there must be sufficient logical pages remaining after the
  7422.                first logical page for the entire region to fit.
  7423.  
  7424.                If your application needs to save a region of conventional
  7425.                memory in expanded memory, you can move it without having to
  7426.                perform a save or restore of the current mapping context. 
  7427.                The memory manager maintains the context.  A move of up to
  7428.                1M bytes may be performed, although practical lengths are
  7429.                substantially less than this value.
  7430.  
  7431.                If the source and destination handles are identical, the
  7432.                source and destination regions are tested for overlap before
  7433.                the move.  If they overlap, the move direction is chosen so
  7434.                that the destination region receives an intact copy of the
  7435.                source region.  A status will be returned indicating that
  7436.                this overlap has occurred.
  7437.  
  7438.  
  7439.           EMM Functions                                                 120
  7440.  
  7441.  
  7442.  
  7443.  
  7444.  
  7445.           Function 24. Move/Exchange Memory Region
  7446.           Move Memory Region subfunction
  7447.  
  7448.  
  7449.  
  7450.           CALLING PARAMETERS
  7451.  
  7452.                AX = 5700h
  7453.                    Contains the Move Memory Region function.
  7454.  
  7455.                    move_source_dest_struct         STRUC
  7456.                        region_length               DD ?
  7457.                        source_memory_type          DB ?
  7458.                        source_handle               DW ?
  7459.                        source_initial_offset       DW ?
  7460.                        source_initial_seg_page     DW ?
  7461.                        dest_memory_type            DB ?
  7462.                        dest_handle                 DW ?
  7463.                        dest_initial_offset         DW ?
  7464.                        dest_initial_seg_page       DW ?
  7465.                    move_source_dest_struct         ENDS
  7466.  
  7467.                DS:SI = pointer to move_source_dest structure
  7468.                    Contains a pointer to a data structure which contains
  7469.                    the source and destination information for the move. 
  7470.                    The structure members are described here:
  7471.  
  7472.                    .region_length
  7473.                        The first member is a double word which specifies
  7474.                        the length of the memory region (in bytes) to be
  7475.                        moved.
  7476.  
  7477.                    .source_memory_type
  7478.                        The second member is a byte which specifies the type
  7479.                        of memory where the source region resides.  A value
  7480.                        of zero indicates that the source region resides in
  7481.                        conventional memory (excluding the page frame seg-
  7482.                        ment).  A value of one indicates that the source
  7483.                        region resides in expanded memory.
  7484.  
  7485.                    .source_handle
  7486.                        If the source region resides in expanded memory, the
  7487.                        third member is a word which specifies the handle
  7488.                        number associated with the source memory region.  If
  7489.                        the source region resides in conventional memory,
  7490.                        this variable has no meaning and should be set to
  7491.                        zero for future compatibility.
  7492.  
  7493.                    .source_initial_offset
  7494.                        The fourth member is a word which specifies the
  7495.                        offset within the source region from which to begin
  7496.                        the move.
  7497.  
  7498.           EMM Functions                                                 121
  7499.  
  7500.  
  7501.  
  7502.  
  7503.  
  7504.           Function 24. Move/Exchange Memory Region
  7505.           Move Memory Region subfunction
  7506.  
  7507.  
  7508.  
  7509.                        If the source region resides in expanded memory, the
  7510.                        source_initial_offset is relative to the beginning
  7511.                        of the 16K logical page.  Because the offset is
  7512.                        relative to the beginning of a 16K expanded memory
  7513.                        page, it may only take on values between 0000h and
  7514.                        3FFFh.
  7515.  
  7516.                        If the source region resides in conventional memory,
  7517.                        the source_initial_offset is a word which specifies
  7518.                        the offset, relative to the beginning of the source
  7519.                        segment, from which to begin the move.  Because the
  7520.                        offset is relative to the beginning of a 64K-byte
  7521.                        conventional memory segment, it may take on values
  7522.                        between 0000h and FFFFh.
  7523.  
  7524.                    .source_initial_seg_page
  7525.                        The fifth member is a word which specifies the
  7526.                        initial segment or logical page number within the
  7527.                        source region from which to begin the move.
  7528.  
  7529.                        If the source region resides in expanded memory, the
  7530.                        value specifies the logical page within the source
  7531.                        region from which to begin the move.
  7532.  
  7533.                        If the source region resides in conventional memory,
  7534.                        the source_initial_seg_page specifies the initial
  7535.                        segment address within conventional memory from
  7536.                        which to begin the move.
  7537.  
  7538.                    .dest_memory_type
  7539.                        The sixth member is a byte which specifies the type
  7540.                        of memory where the destination region resides.  A
  7541.                        value of zero indicates conventional memory; a value
  7542.                        of one indicates expanded memory.
  7543.  
  7544.                    .dest_handle
  7545.                        If the destination region resides in expanded
  7546.                        memory, the seventh member is a word which specifies
  7547.                        the handle number associated with the destination
  7548.                        memory region.  If the destination region resides in
  7549.                        conventional memory, this variable has no meaning
  7550.                        and should be set to zero for future compatibility.
  7551.  
  7552.                    .dest_initial_offset
  7553.                        The eighth member is a word which specifies the
  7554.                        offset within the destination region from which to
  7555.                        begin the move.
  7556.  
  7557.           EMM Functions                                                 122
  7558.  
  7559.  
  7560.  
  7561.  
  7562.  
  7563.           Function 24. Move/Exchange Memory Region
  7564.           Move Memory Region subfunction
  7565.  
  7566.  
  7567.  
  7568.                        If the destination region resides in expanded
  7569.                        memory, the dest_initial_offset is relative to the
  7570.                        beginning of the 16K-byte logical page.  Because the
  7571.                        offset is relative to the beginning of a 16K-byte
  7572.                        expanded memory page, it may only take on values
  7573.                        between 0000h and 3FFFh.
  7574.  
  7575.                        If the destination region resides in conventional
  7576.                        memory, the dest_initial_offset is a word which
  7577.                        specifies the offset, relative to the beginning of
  7578.                        the destination segment, to begin the move.  Because
  7579.                        the offset is relative to the beginning of a 64K
  7580.                        conventional memory segment, it may take on values
  7581.                        between 0000h and FFFFh.
  7582.  
  7583.                    .dest_initial_seg_page
  7584.                        The ninth member is a word which specifies the
  7585.                        initial segment or logical page number within the
  7586.                        destination region from which to begin the move.
  7587.  
  7588.                        If the destination region resides in expanded memory
  7589.                        then the value specifies the logical page within the
  7590.                        destination region from which to begin the move.
  7591.  
  7592.                        If the destination region resides in conventional
  7593.                        memory, the dest_initial_seg_page specifies the
  7594.                        initial segment address within conventional memory
  7595.                        from which to begin the move.
  7596.  
  7597.  
  7598.           REGISTERS MODIFIED
  7599.  
  7600.                AX
  7601.  
  7602.  
  7603.           STATUS
  7604.  
  7605.                AH = 0   SUCCESSFUL.
  7606.                    The memory regions have been moved.
  7607.  
  7608.                AH = 80h   NON-RECOVERABLE.
  7609.                    The manager has detected a malfunction in the memory
  7610.                    manager software.
  7611.  
  7612.                AH = 81h   NON-RECOVERABLE.
  7613.                    The manager has detected a malfunction in the expanded
  7614.                    memory hardware.
  7615.  
  7616.           EMM Functions                                                 123
  7617.  
  7618.  
  7619.  
  7620.  
  7621.  
  7622.           Function 24. Move/Exchange Memory Region
  7623.           Move Memory Region subfunction
  7624.  
  7625.  
  7626.  
  7627.                AH = 83h   NON-RECOVERABLE.
  7628.                    The manager couldn't find either the source or destina-
  7629.                    tion EMM handles.  The memory manager doesn't have any
  7630.                    information on the handles specified.  The program may
  7631.                    have corrupted its EMM handles.
  7632.  
  7633.                AH = 84h   NON-RECOVERABLE.
  7634.                    The function code passed to the manager is not defined.
  7635.  
  7636.                AH = 8Ah   NON-RECOVERABLE.
  7637.                    One or more of the logical pages is out of the range of
  7638.                    logical pages allocated to the source/destination
  7639.                    handle.
  7640.  
  7641.                AH = 8Fh   NON-RECOVERABLE.
  7642.                    The subfunction parameter is invalid.
  7643.  
  7644.                AH = 92h   SUCCESSFUL.
  7645.                    The source and destination expanded memory regions have
  7646.                    the same handle and overlap.  This is valid for a move. 
  7647.                    The move has been completed and the destination region
  7648.                    has a full copy of the source region.  However, at least
  7649.                    a portion of the source region has been overwritten by
  7650.                    the move.  Note that the source and destination expanded
  7651.                    memory regions with different handles will never physi-
  7652.                    cally overlap because the different handles specify
  7653.                    totally different regions of expanded memory.
  7654.  
  7655.                AH = 93h   CONDITIONALLY-RECOVERABLE.
  7656.                    The length of the source or destination expanded memory
  7657.                    region specified exceeds the length of the expanded
  7658.                    memory region allocated either the source or destination
  7659.                    handle.  Insufficient pages are allocated to this handle
  7660.                    to move a region of the size specified.  The program can
  7661.                    recover from this condition by allocating additional
  7662.                    pages to the destination or source handle and attempting
  7663.                    to execute the function again.  However, if the applica-
  7664.                    tion program allocated as much expanded memory as it
  7665.                    thought it needed, this may be a program error and is
  7666.                    not recoverable.
  7667.  
  7668.                AH = 94h   NON-RECOVERABLE.
  7669.                    The conventional memory region and expanded memory
  7670.                    region overlap.  This is invalid, the conventional
  7671.                    memory region cannot overlap the expanded memory region.
  7672.  
  7673.  
  7674.  
  7675.           EMM Functions                                                 124
  7676.  
  7677.  
  7678.  
  7679.  
  7680.  
  7681.           Function 24. Move/Exchange Memory Region
  7682.           Move Memory Region subfunction
  7683.  
  7684.  
  7685.  
  7686.                AH = 95h   NON-RECOVERABLE.
  7687.                    The offset within the logical page exceeds the length of
  7688.                    the logical page.  The initial source or destination
  7689.                    offsets within an expanded memory region must be between
  7690.                    0000h and 3FFFh (16383 or (length of a logical page
  7691.                    - 1)).
  7692.  
  7693.                AH = 96h   NON-RECOVERABLE.
  7694.                    Region length exceeds 1M bytes.
  7695.  
  7696.                AH = 98h   NON-RECOVERABLE.
  7697.                    The memory source and destination types are undefined.
  7698.  
  7699.                AH = A2h   NON-RECOVERABLE.
  7700.                    An attempt was made to wrap around the 1M-byte address
  7701.                    space of conventional memory during the move.  The
  7702.                    combination of source/destination starting address and
  7703.                    length of the region to be moved exceeds 1M bytes.  No
  7704.                    data was moved.
  7705.  
  7706.  
  7707.           EXAMPLE
  7708.  
  7709.           move_source_dest               move_source_dest_struct (?)
  7710.  
  7711.           MOV   AX,SEG move_source_dest
  7712.           MOV   DS,AX
  7713.           LEA   SI,move_source_dest      ; DS:SI points to move_source_dest
  7714.           MOV   AX,5700h                 ; load function code
  7715.           INT   67h                      ; call the memory manager
  7716.           OR    AH,AH                    ; check EMM status
  7717.           JNZ   emm_err_handler          ; jump to error handler on error
  7718.  
  7719.  
  7720.  
  7721.  
  7722.  
  7723.  
  7724.  
  7725.  
  7726.  
  7727.  
  7728.  
  7729.  
  7730.  
  7731.  
  7732.  
  7733.  
  7734.           EMM Functions                                                 125
  7735.  
  7736.  
  7737.  
  7738.  
  7739.  
  7740.           Function 24. Move/Exchange Memory Region
  7741.           Exchange Memory Region subfunction
  7742.  
  7743.  
  7744.  
  7745.           PURPOSE
  7746.  
  7747.                This subfunction exchanges (using a string move) a region of
  7748.                memory in any of the following memory source/destination
  7749.                combinations.
  7750.  
  7751.                o   conventional memory to conventional memory
  7752.  
  7753.                o   conventional memory to expanded memory
  7754.  
  7755.                o   expanded memory to conventional memory
  7756.  
  7757.                o   expanded memory to expanded memory
  7758.  
  7759.                The term expanded memory region refers only to the area of
  7760.                memory above 640K bytes (9FFFFh).  If a system provides
  7761.                mappable conventional memory, this function treats the
  7762.                mappable conventional memory regions as ordinary convention-
  7763.                al memory.  The contents of the source region and the
  7764.                destination region are exchanged.
  7765.  
  7766.                The exchange operation can be performed without having to
  7767.                save and restore the expanded memory mapping context.  The
  7768.                current mapping context is maintained throughout this
  7769.                operation.  The length of the region is limited to the
  7770.                amount of expanded memory allocated to the specified EMM
  7771.                handles.  A length of zero is not an error; however, no
  7772.                exchange will be performed.  A region length which exceeds
  7773.                16K bytes is not an error.  In this case the function
  7774.                assumes that a group of logical pages is the target for the
  7775.                exchange.  The logical page specified represents the first
  7776.                logical page in which the exchange will take place.  If the
  7777.                region length exceeds 16K bytes, or if the region is less
  7778.                than 16K bytes but spans logical pages, there must be
  7779.                sufficient logical pages remaining after the first logical
  7780.                page for the entire region to fit.
  7781.  
  7782.                If your application needs to exchange a region of conven-
  7783.                tional memory with expanded memory, you can simply exchange
  7784.                it with the region of interest without having to perform a
  7785.                save or restore of the current mapping context.  An exchange
  7786.                of up to 1M bytes may be performed, although practical
  7787.                lengths are obviously below that value.  Checking is done
  7788.                before starting the exchange to prevent the possibility of
  7789.                overlap during the exchange operation.  Overlapping source
  7790.                and destination regions for an exchange are invalid, and the
  7791.                exchange will not take place.
  7792.  
  7793.           EMM Functions                                                 126
  7794.  
  7795.  
  7796.  
  7797.  
  7798.  
  7799.           Function 24. Move/Exchange Memory Region
  7800.           Exchange Memory Region subfunction
  7801.  
  7802.  
  7803.  
  7804.           CALLING PARAMETERS
  7805.  
  7806.                AX = 5701h
  7807.                    Contains the Exchange Memory Region function.
  7808.  
  7809.                    xchg_source_dest_struct         STRUC
  7810.                        region_length               DD ?
  7811.                        source_memory_type          DB ?
  7812.                        source_handle               DW ?
  7813.                        source_initial_offset       DW ?
  7814.                        source_initial_seg_page     DW ?
  7815.                        dest_memory_type            DB ?
  7816.                        dest_handle                 DW ?
  7817.                        dest_initial_offset         DW ?
  7818.                        dest_initial_seg_page       DW ?
  7819.                    xchg_source_dest_struct         ENDS
  7820.  
  7821.                DS:SI = pointer to xchg_source_dest structure
  7822.                    Contains a pointer to the data structure which contains
  7823.                    the source and destination information for the exchange. 
  7824.                    The structure members are described here:
  7825.  
  7826.                    .region_length
  7827.                        The first member is a double word which specifies
  7828.                        the length of the memory region to be exchanged.
  7829.  
  7830.                    .source_memory_type
  7831.                        The second member is a byte which specifies the type
  7832.                        of memory where the source region resides.  A value
  7833.                        of zero indicates that the source region resides in
  7834.                        conventional memory.  A value of one indicates that
  7835.                        the source region resides in expanded memory.
  7836.  
  7837.                    .source_handle
  7838.                        If the source region resides in expanded memory, the
  7839.                        third member is a word which specifies the handle
  7840.                        number associated with the source memory region.  If
  7841.                        the source region resides in conventional memory,
  7842.                        this variable has no meaning and should be set to
  7843.                        zero for future compatibility.
  7844.  
  7845.                    .source_initial_offset
  7846.                        The fourth member is a word which specifies the
  7847.                        offset within the source region from which to begin
  7848.                        the exchange.
  7849.  
  7850.  
  7851.  
  7852.           EMM Functions                                                 127
  7853.  
  7854.  
  7855.  
  7856.  
  7857.  
  7858.           Function 24. Move/Exchange Memory Region
  7859.           Exchange Memory Region subfunction
  7860.  
  7861.  
  7862.  
  7863.                        If the source region resides in expanded memory, the
  7864.                        source_initial_offset is relative to the beginning
  7865.                        of the 16K logical page.  Because the offset is
  7866.                        relative to the beginning of a 16K expanded memory
  7867.                        page, it may only take on values between 0000h and
  7868.                        3FFFh.
  7869.  
  7870.                        If the source region resides in conventional memory,
  7871.                        the source_initial_offset is a word which specifies
  7872.                        the offset, relative to the beginning of the source
  7873.                        segment, from which to begin the exchange at. 
  7874.                        Because the offset is relative to the beginning of a
  7875.                        64K-byte conventional memory segment, it may take on
  7876.                        values between 0000h and FFFFh.
  7877.  
  7878.                    .source_initial_seg_page
  7879.                        The fifth member is a word which specifies the
  7880.                        initial segment or logical page number within the
  7881.                        source region from which to begin the exchange.
  7882.  
  7883.                        If the source region resides in expanded memory then
  7884.                        the value specifies the logical page within the
  7885.                        source region from which to begin the exchange.
  7886.  
  7887.                        If the source region resides in conventional memory,
  7888.                        the source_initial_seg_page specifies the initial
  7889.                        segment address within conventional memory from
  7890.                        which to begin the exchange.
  7891.  
  7892.                    .dest_memory_type
  7893.                        The sixth member is a byte which specifies the type
  7894.                        of memory where the destination region resides.  A
  7895.                        value of zero indicates that the destination region
  7896.                        resides in conventional memory (excluding the page
  7897.                        frame segment).  A value of one indicates that the
  7898.                        destination region resides in expanded memory.
  7899.  
  7900.                    .dest_handle
  7901.                        If the destination region resides in expanded
  7902.                        memory, the seventh member is a word which specifies
  7903.                        the handle number associated with the destination
  7904.                        memory region.  If the destination region resides in
  7905.                        conventional memory, this variable has no meaning
  7906.                        and should be set to zero for future compatibility.
  7907.  
  7908.  
  7909.  
  7910.  
  7911.           EMM Functions                                                 128
  7912.  
  7913.  
  7914.  
  7915.  
  7916.  
  7917.           Function 24. Move/Exchange Memory Region
  7918.           Exchange Memory Region subfunction
  7919.  
  7920.  
  7921.  
  7922.                    .dest_initial_offset
  7923.                        The eighth member is a word which specifies the
  7924.                        offset within the destination region from which to
  7925.                        begin the exchange.
  7926.  
  7927.                        If the destination region resides in expanded
  7928.                        memory, the dest_initial_offset is relative to the
  7929.                        beginning of the 16K-byte logical page.  Because the
  7930.                        offset is relative to the beginning of a 16K-byte
  7931.                        expanded memory page, it may only take on values
  7932.                        between 0000h and 3FFFh.
  7933.  
  7934.                        If the destination region resides in conventional
  7935.                        memory, the dest_initial_offset is a word which
  7936.                        specifies the offset, relative to the beginning of
  7937.                        the destination segment, to begin the exchange at. 
  7938.                        Because the offset is relative to the beginning of a
  7939.                        64K conventional memory segment, it may take on
  7940.                        values between 0000h and FFFFh.
  7941.  
  7942.                    .dest_initial_seg_page
  7943.                        The ninth member is a word which specifies the
  7944.                        initial segment or logical page number within the
  7945.                        destination region from which to begin the exchange.
  7946.  
  7947.                        If the destination region resides in expanded memory
  7948.                        then the value specifies the logical page within the
  7949.                        destination region from which to begin the exchange.
  7950.  
  7951.                        If the destination region resides in conventional
  7952.                        memory, the dest_initial_seg_page specifies the
  7953.                        initial segment address within conventional memory
  7954.                        from which to begin the exchange.
  7955.  
  7956.  
  7957.  
  7958.           REGISTERS MODIFIED
  7959.  
  7960.                AX
  7961.  
  7962.  
  7963.           STATUS
  7964.  
  7965.                AH = 0   SUCCESSFUL.
  7966.                    The memory regions have been exchanged.
  7967.  
  7968.  
  7969.  
  7970.           EMM Functions                                                 129
  7971.  
  7972.  
  7973.  
  7974.  
  7975.  
  7976.           Function 24. Move/Exchange Memory Region
  7977.           Exchange Memory Region subfunction
  7978.  
  7979.  
  7980.  
  7981.                AH = 80h   NON-RECOVERABLE.
  7982.                    The manager has detected a malfunction in the memory
  7983.                    manager software.
  7984.  
  7985.                AH = 81h   NON-RECOVERABLE.
  7986.                    The manager has detected a malfunction in the expanded
  7987.                    memory hardware.
  7988.  
  7989.                AH = 83h   NON-RECOVERABLE.
  7990.                    The manager could not find either the source or destina-
  7991.                    tion EMM handles.  The memory manager does not currently
  7992.                    have any information pertaining to the handles speci-
  7993.                    fied.  The program may have corrupted its EMM handles.
  7994.  
  7995.                AH = 84h   NON-RECOVERABLE.
  7996.                    The function code passed to the manager is not defined.
  7997.  
  7998.                AH = 8Ah   NON-RECOVERABLE.
  7999.                    One or more of the logical pages is out of the range of
  8000.                    logical pages allocated to the source/destination
  8001.                    handle.
  8002.  
  8003.                AH = 8Fh   NON-RECOVERABLE.
  8004.                    The subfunction parameter is invalid.
  8005.  
  8006.                AH = 93h   CONDITIONALLY-RECOVERABLE.
  8007.                    The length of the source or destination expanded memory
  8008.                    region specified, exceeds the length of the expanded
  8009.                    memory region allocated to the source or destination
  8010.                    specified EMM handle.  There are insufficient pages
  8011.                    allocated to this handle to exchange a region of the
  8012.                    size specified.  The program can recover from this
  8013.                    condition by attempting to allocate additional pages to
  8014.                    the destination or source handle and attempting to
  8015.                    execute the function again.  However, if the application
  8016.                    program was allocated as much expanded memory as it
  8017.                    thought it needed, this may be a program error and is
  8018.                    therefore not recoverable.
  8019.  
  8020.                AH = 94h   NON-RECOVERABLE.
  8021.                    The conventional memory region and expanded memory
  8022.                    region overlap.  This is invalid, the conventional
  8023.                    memory region cannot overlap the expanded memory region.
  8024.  
  8025.  
  8026.  
  8027.  
  8028.  
  8029.           EMM Functions                                                 130
  8030.  
  8031.  
  8032.  
  8033.  
  8034.  
  8035.           Function 24. Move/Exchange Memory Region
  8036.           Exchange Memory Region subfunction
  8037.  
  8038.  
  8039.  
  8040.                AH = 95h   NON-RECOVERABLE.
  8041.                    The offset within the logical page exceeds the length of
  8042.                    the logical page.  The initial source or destination
  8043.                    offsets within an expanded memory region must be between
  8044.                    0000h and 3FFFh (16383 or (length of a logical page
  8045.                    - 1)).
  8046.  
  8047.                AH = 96h   NON-RECOVERABLE.
  8048.                    Region length exceeds 1M-byte limit.
  8049.  
  8050.                AH = 97h   NON-RECOVERABLE.
  8051.                    The source and destination expanded memory regions have
  8052.                    the same handle and overlap.  This is invalid, the
  8053.                    source and destination expanded memory regions cannot
  8054.                    have the same handle and overlap when they are being
  8055.                    exchanged.  Note that the source and destination
  8056.                    expanded memory regions which have different handles
  8057.                    will never physically overlap because the different
  8058.                    handles specify totally different regions of expanded
  8059.                    memory.
  8060.  
  8061.                AH = 98h   NON-RECOVERABLE.
  8062.                    The memory source and destination types are undefined.
  8063.  
  8064.                AH = A2h   NON-RECOVERABLE.
  8065.                    An attempt was made to wrap around the 1M-byte address
  8066.                    space of conventional memory during the exchange.  The
  8067.                    combination of source/destination starting address and
  8068.                    length of the region to be exchanged exceeds 1M bytes. 
  8069.                    No data was exchanged.
  8070.  
  8071.  
  8072.           EXAMPLE
  8073.  
  8074.           xchg_source_dest               xchg_source_dest_struct (?)
  8075.  
  8076.           MOV   AX,SEG xchg_source_dest
  8077.           MOV   DS,AX
  8078.           LEA   SI,xchg_source_dest      ; DS:SI points to xchg_source_dest
  8079.           MOV   AX,5701h                 ; load function code
  8080.           INT   67h                      ; call the memory manager
  8081.           OR    AH,AH                    ; check EMM status
  8082.           JNZ   emm_err_handler          ; jump to error handler on error
  8083.  
  8084.  
  8085.  
  8086.  
  8087.  
  8088.           EMM Functions                                                 131
  8089.  
  8090.  
  8091.  
  8092.  
  8093.  
  8094.           Function 25. Get Mappable Physical Address Array
  8095.           Get Mappable Physical Address Array subfunction
  8096.  
  8097.  
  8098.  
  8099.           PURPOSE
  8100.  
  8101.                This subfunction returns an array containing the segment
  8102.                address and physical page number for each mappable physical
  8103.                page in a system.  The contents of this array provide a
  8104.                cross reference between physical page numbers and the actual
  8105.                segment addresses for each mappable page in the system.  The
  8106.                array is sorted in ascending segment order.  This does not
  8107.                mean that the physical page numbers associated with the
  8108.                segment addresses are also in ascending order.
  8109.  
  8110.  
  8111.           CALLING PARAMETERS
  8112.  
  8113.                AX = 5800h
  8114.                    Contains the Get Mappable Physical Address Array
  8115.                    subfunction
  8116.  
  8117.                    mappable_phys_page_struct       STRUC
  8118.                        phys_page_segment           DW ?
  8119.                        phys_page_number            DW ?
  8120.                    mappable_phys_page_struct       ENDS
  8121.  
  8122.                ES:DI = mappable_phys_page
  8123.                    Contains a pointer to an application-supplied memory
  8124.                    area where the memory manager will copy the physical
  8125.                    address array.  Each entry in the array is a structure
  8126.                    containing two members:
  8127.  
  8128.                    .phys_page_segment
  8129.                        The first member is a word which contains the
  8130.                        segment address of the mappable physical page
  8131.                        associated with the physical page number following
  8132.                        it.  The array entries are sorted in ascending
  8133.                        segment address order.
  8134.  
  8135.                    .phys_page_number
  8136.                        The second member is a word which contains the
  8137.                        physical page number which corresponds to the
  8138.                        previous segment address.  The physical page numbers
  8139.                        are not necessarily in ascending order.
  8140.  
  8141.  
  8142.  
  8143.  
  8144.  
  8145.  
  8146.  
  8147.           EMM Functions                                                 132
  8148.  
  8149.  
  8150.  
  8151.  
  8152.  
  8153.           Function 25. Get Mappable Physical Address Array
  8154.           Get Mappable Physical Address Array subfunction
  8155.  
  8156.  
  8157.  
  8158.                    Example 1
  8159.  
  8160.                        An expanded memory board has its page frame starting
  8161.                        at address C0000h and has no mappable conventional
  8162.                        memory.  For this configuration, physical page 0
  8163.                        corresponds to segment address C000h, physical page
  8164.                        1 corresponds to segment address C400h, etc.  The
  8165.                        array would contain the following data (in this
  8166.                        order):
  8167.  
  8168.                        C000h, 00h
  8169.                        C400h, 01h
  8170.                        C800h, 02h
  8171.                        CC00h, 03h
  8172.  
  8173.  
  8174.                    Example 2
  8175.  
  8176.                        An expanded memory board has a large page frame
  8177.                        starting at address C0000h and has mappable conven-
  8178.                        tional memory from 90000h through 9FFFFh.  For this
  8179.                        configuration, physical page 0 corresponds to
  8180.                        segment address C000h, physical page 1 corresponds
  8181.                        to segment address C400h, etc.  The array would
  8182.                        contain the following data in the order specified. 
  8183.                        Note that the expanded memory region always has the
  8184.                        lowest numerically valued physical page numbers.
  8185.  
  8186.                        9000h, 0Ch
  8187.                        9400h, 0Dh
  8188.                        9800h, 0Eh
  8189.                        9C00h, 0Fh
  8190.                        C000h, 00h
  8191.                        C400h, 01h
  8192.                        C800h, 02h
  8193.                        CC00h, 03h
  8194.                        D000h, 04h
  8195.                        D400h, 05h
  8196.                        D800h, 06h
  8197.                        DC00h, 07h
  8198.                        E000h, 08h
  8199.                        E400h, 09h
  8200.                        E800h, 0Ah
  8201.                        EC00h, 0Bh
  8202.  
  8203.  
  8204.  
  8205.  
  8206.           EMM Functions                                                 133
  8207.  
  8208.  
  8209.  
  8210.  
  8211.  
  8212.           Function 25. Get Mappable Physical Address Array
  8213.           Get Mappable Physical Address Array subfunction
  8214.  
  8215.  
  8216.  
  8217.           RESULTS
  8218.  
  8219.                These results are valid only if the status returned is zero.
  8220.  
  8221.                CX = number of entries in the mappable_phys_page
  8222.                    Multiply this number by (SIZE mappable_phys_page_struct)
  8223.                    to determine the number of bytes the physical page
  8224.                    address array requires.
  8225.  
  8226.  
  8227.           REGISTERS MODIFIED
  8228.  
  8229.                AX, CX
  8230.  
  8231.  
  8232.           STATUS
  8233.  
  8234.                AH = 0   SUCCESSFUL.
  8235.                    The hardware configuration array has been returned.
  8236.  
  8237.                AH = 80h   NON-RECOVERABLE.
  8238.                    The manager has detected a malfunction in the memory
  8239.                    manager software.
  8240.  
  8241.                AH = 81h   NON-RECOVERABLE.
  8242.                    The manager has detected a malfunction in the expanded
  8243.                    memory hardware.
  8244.  
  8245.                AH = 84h   NON-RECOVERABLE.
  8246.                    The function code passed to the manager is not defined.
  8247.  
  8248.                AH = 8Fh   NON-RECOVERABLE.
  8249.                    The subfunction parameter is invalid.
  8250.  
  8251.  
  8252.  
  8253.  
  8254.  
  8255.  
  8256.  
  8257.  
  8258.  
  8259.  
  8260.  
  8261.  
  8262.  
  8263.  
  8264.  
  8265.           EMM Functions                                                 134
  8266.  
  8267.  
  8268.  
  8269.  
  8270.  
  8271.           Function 25. Get Mappable Physical Address Array
  8272.           Get Mappable Physical Address Array subfunction
  8273.  
  8274.  
  8275.  
  8276.           EXAMPLE
  8277.  
  8278.           mappable_phys_page             mappable_phys_page_struct (?)
  8279.  
  8280.           mappable_page_entry_count      DW ?
  8281.  
  8282.           MOV   AX,SEG mappable_phys_page
  8283.           MOV   ES,AX
  8284.           LEA   DI,mappable_phys_page         ; ES:DI points to
  8285.                                               ; mappable_phys_page
  8286.           MOV   AX,5800h                      ; load function code
  8287.           INT   67h                           ; call the memory
  8288.                                               ; manager
  8289.           OR    AH,AH                         ; check EMM status
  8290.           JNZ   emm_err_handler               ; jump to error handler
  8291.                                               ; on error
  8292.           MOV   mappable_page_entry_count,CX  ; save mappable
  8293.                                               ; page entry count
  8294.  
  8295.  
  8296.  
  8297.  
  8298.  
  8299.  
  8300.  
  8301.  
  8302.  
  8303.  
  8304.  
  8305.  
  8306.  
  8307.  
  8308.  
  8309.  
  8310.  
  8311.  
  8312.  
  8313.  
  8314.  
  8315.  
  8316.  
  8317.  
  8318.  
  8319.  
  8320.  
  8321.  
  8322.  
  8323.  
  8324.           EMM Functions                                                 135
  8325.  
  8326.  
  8327.  
  8328.  
  8329.  
  8330.           Function 25. Get Mappable Physical Address Array
  8331.           Get Mappable Physical Address Array Entries subfunction
  8332.  
  8333.  
  8334.  
  8335.           PURPOSE
  8336.  
  8337.                This subfunction gets the number of entries which will be
  8338.                required for the array the first subfunction returns.
  8339.  
  8340.  
  8341.           CALLING PARAMETERS
  8342.  
  8343.                AX = 5801h
  8344.                    Contains the Get Physical Page Address Array Entries
  8345.                    subfunction.  This subfunction returns a word which
  8346.                    represents the number of entries in the array returned
  8347.                    by the previous subfunction.  This number also repre-
  8348.                    sents the number of mappable physical pages in a system.
  8349.  
  8350.  
  8351.           RESULTS
  8352.  
  8353.                These results are valid only if the status returned is zero.
  8354.  
  8355.                CX = number of entries in the mappable_phys_page
  8356.                    Multiply this number by (SIZE mappable_phys_page_struct)
  8357.                    to determine the number of bytes the physical page
  8358.                    address array will require.
  8359.  
  8360.  
  8361.           REGISTERS MODIFIED
  8362.  
  8363.                AX, CX
  8364.  
  8365.  
  8366.           STATUS
  8367.  
  8368.                AH = 0   SUCCESSFUL.
  8369.                    The number of mappable physical pages has been returned.
  8370.  
  8371.                AH = 80h   NON-RECOVERABLE.
  8372.                    The manager has detected a malfunction in the memory
  8373.                    manager software.
  8374.  
  8375.                AH = 81h   NON-RECOVERABLE.
  8376.                    The manager has detected a malfunction in the expanded
  8377.                    memory hardware.
  8378.  
  8379.                AH = 84h   NON-RECOVERABLE.
  8380.                    The function code passed to the manager is not defined.
  8381.  
  8382.  
  8383.           EMM Functions                                                 136
  8384.  
  8385.  
  8386.  
  8387.  
  8388.  
  8389.           Function 25. Get Mappable Physical Address Array
  8390.           Get Mappable Physical Address Array Entries subfunction
  8391.  
  8392.  
  8393.  
  8394.                AH = 8Fh   NON-RECOVERABLE.
  8395.                    The subfunction parameter is invalid.
  8396.  
  8397.  
  8398.           EXAMPLE
  8399.  
  8400.           mappable_page_entry_count           DW ?
  8401.  
  8402.           MOV   AX,5801h                      ; load function code
  8403.           INT   67h                           ; call memory manager
  8404.           OR    AH,AH                         ; check EMM status
  8405.           JNZ   emm_err_handler               ; jump to error handler
  8406.                                               ; on error
  8407.           MOV   mappable_page_entry_count,CX  ; save mappable
  8408.                                               ; page entry count
  8409.  
  8410.  
  8411.  
  8412.  
  8413.  
  8414.  
  8415.  
  8416.  
  8417.  
  8418.  
  8419.  
  8420.  
  8421.  
  8422.  
  8423.  
  8424.  
  8425.  
  8426.  
  8427.  
  8428.  
  8429.  
  8430.  
  8431.  
  8432.  
  8433.  
  8434.  
  8435.  
  8436.  
  8437.  
  8438.  
  8439.  
  8440.  
  8441.  
  8442.           EMM Functions                                                 137
  8443.  
  8444.  
  8445.  
  8446.  
  8447.  
  8448.           Function 26. Get Expanded Memory Hardware Information
  8449.           Get Hardware Configuration Array subfunction
  8450.  
  8451.  
  8452.  
  8453.           Note............................................................
  8454.                This function is for use by operating systems only.  This
  8455.                function can be disabled at any time by the operating
  8456.                system.  Refer to Function 30 for a description of how an
  8457.                operating system does this.
  8458.  
  8459.  
  8460.           PURPOSE
  8461.  
  8462.                This subfunction returns an array containing expanded memory
  8463.                hardware configuration information for use by an operating
  8464.                system/environment.
  8465.  
  8466.  
  8467.           CALLING PARAMETERS
  8468.  
  8469.                AX = 5900h
  8470.                    Contains the Get Hardware Configuration Array subfunc-
  8471.                    tion.
  8472.  
  8473.                    hardware_info_struct            STRUC
  8474.                        raw_page_size               DW ?
  8475.                        alternate_register_sets     DW ?
  8476.                        context_save_area_size      DW ?
  8477.                        DMA_register_sets           DW ?
  8478.                        DMA_channel_operation       DW ?
  8479.                    hardware_info_struct            ENDS
  8480.  
  8481.                ES:DI = hardware_info
  8482.                    Contains a pointer to a memory area that the operating
  8483.                    system supplies where the memory manager will copy
  8484.                    expanded memory hardware information.  The structure
  8485.                    contains these five members:
  8486.  
  8487.                    .raw_page_size
  8488.                        The first member is a word which contains the size
  8489.                        of a raw mappable physical page in paragraphs (16
  8490.                        bytes).  LIM standard pages are always 16K bytes. 
  8491.                        However, other implementations of expanded memory
  8492.                        boards do not necessarily comply with this standard
  8493.                        and can emulate a 16K-byte page by mapping in
  8494.                        multiple smaller pages.  This member specifies the
  8495.                        size of a mappable physical page viewed from the
  8496.                        hardware implementation level.
  8497.  
  8498.  
  8499.  
  8500.  
  8501.           EMM Functions                                                 138
  8502.  
  8503.  
  8504.  
  8505.  
  8506.  
  8507.           Function 26. Get Expanded Memory Hardware Information
  8508.           Get Hardware Configuration Array subfunction
  8509.  
  8510.  
  8511.  
  8512.                    .alternate_register_sets
  8513.                        The second member is a word which specifies the
  8514.                        number of alternate mapping register sets.  The
  8515.                        additional mapping register sets are termed alter-
  8516.                        nate mapping register sets in this document.
  8517.  
  8518.                        All expanded memory boards have at least one set of
  8519.                        hardware registers to perform the logical to
  8520.                        physical page mapping.  Some expanded memory boards
  8521.                        have more than one set of these mapping registers. 
  8522.                        This member specifies how many of these alternate
  8523.                        mapping register sets exist (beyond the one set that
  8524.                        all expanded memory boards have) on the expanded
  8525.                        memory boards in the system.  If an expanded memory
  8526.                        card has only one set of mapping registers (that is,
  8527.                        no alternate mapping register sets) this member has
  8528.                        a value of zero.
  8529.  
  8530.                    .context_save_area_size
  8531.                        The third member is a word which contains the
  8532.                        storage requirements for the array required to save
  8533.                        a mapping context.  The value returned in this
  8534.                        member is exactly the same as that returned by
  8535.                        Function 15 (Get Size of Page Map Save Array
  8536.                        subfunction).
  8537.  
  8538.                    .DMA_register_sets
  8539.                        The fourth member is a word which contains the
  8540.                        number of register sets that can be assigned to DMA
  8541.                        channels.  These DMA register sets, although similar
  8542.                        in use to alternate register sets, are for DMA
  8543.                        mapping and not task mapping.
  8544.  
  8545.                        If the expanded memory hardware does not support DMA
  8546.                        register sets, care must be taken when DMA is taking
  8547.                        place.
  8548.  
  8549.                        In a multitasking operating system, when one task is
  8550.                        waiting for DMA to complete, it is useful to be able
  8551.                        to switch to another task.  However, if the DMA is
  8552.                        taking place in memory that the second task will
  8553.                        need to remap, remapping would be disastrous.
  8554.  
  8555.  
  8556.  
  8557.  
  8558.  
  8559.  
  8560.           EMM Functions                                                 139
  8561.  
  8562.  
  8563.  
  8564.  
  8565.  
  8566.           Function 26. Get Expanded Memory Hardware Information
  8567.           Get Hardware Configuration Array subfunction
  8568.  
  8569.  
  8570.  
  8571.                        If the expanded memory hardware can detect when DMA
  8572.                        is occurring, the OS/E should allow task switches
  8573.                        and remapping during DMA.  If no special support for
  8574.                        DMA is available, no remapping should be done when
  8575.                        DMA is in progress.
  8576.  
  8577.                    .DMA_channel_operation
  8578.                        The fifth member is a word which specifies a special
  8579.                        case for the DMA register sets.  A value of zero
  8580.                        specifies that the DMA register sets behave as
  8581.                        described in Function 28.  A value of one specifies
  8582.                        that the expanded memory hardware has only one DMA
  8583.                        register set.  In addition, if any channel is mapped
  8584.                        through this register set, then all channels are
  8585.                        mapped through it.  For LIM standard boards, this
  8586.                        value is zero.
  8587.  
  8588.  
  8589.           RESULTS
  8590.  
  8591.                These results are valid only if the status returned is zero.
  8592.  
  8593.                hardware_info
  8594.                    Contains the expanded memory hardware-specific informa-
  8595.                    tion described above.
  8596.  
  8597.  
  8598.           REGISTERS MODIFIED
  8599.  
  8600.                AX
  8601.  
  8602.  
  8603.           STATUS
  8604.  
  8605.                AH = 0   SUCCESSFUL.
  8606.                    The hardware configuration array has been returned.
  8607.  
  8608.                AH = 80h   NON-RECOVERABLE.
  8609.                    The manager has detected a malfunction in the memory
  8610.                    manager software.
  8611.  
  8612.                AH = 81h   NON-RECOVERABLE.
  8613.                    The manager has detected a malfunction in the expanded
  8614.                    memory hardware.
  8615.  
  8616.                AH = 84h   NON-RECOVERABLE.
  8617.                    The function code passed to the manager is not defined.
  8618.  
  8619.           EMM Functions                                                 140
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.           Function 26. Get Expanded Memory Hardware Information
  8626.           Get Hardware Configuration Array subfunction
  8627.  
  8628.  
  8629.  
  8630.                AH = 8Fh   NON-RECOVERABLE.
  8631.                    The subfunction parameter is invalid.
  8632.  
  8633.                AH = A4h   NON-RECOVERABLE.
  8634.                    Access to this function has been denied by the operating
  8635.                    system.  The function cannot be used at this time.
  8636.  
  8637.  
  8638.           EXAMPLE
  8639.  
  8640.           hardware_info                  hardware_info_struct (?)
  8641.  
  8642.           MOV   AX,SEG hardware_info
  8643.           MOV   ES,AX
  8644.           LEA   DI,hardware_info         ; ES:DI points to hardware_info
  8645.           MOV   AX,5900h                 ; load function code
  8646.           INT   67h                      ; call the memory manager
  8647.           OR    AH,AH                    ; check EMM status
  8648.           JNZ   emm_err_handler          ; jump to error handler on error
  8649.  
  8650.  
  8651.  
  8652.  
  8653.  
  8654.  
  8655.  
  8656.  
  8657.  
  8658.  
  8659.  
  8660.  
  8661.  
  8662.  
  8663.  
  8664.  
  8665.  
  8666.  
  8667.  
  8668.  
  8669.  
  8670.  
  8671.  
  8672.  
  8673.  
  8674.  
  8675.  
  8676.  
  8677.  
  8678.           EMM Functions                                                 141
  8679.  
  8680.  
  8681.  
  8682.  
  8683.  
  8684.           Function 26. Get Expanded Memory Hardware Information
  8685.           Get Unallocated Raw Page Count subfunction
  8686.  
  8687.  
  8688.  
  8689.           PURPOSE
  8690.  
  8691.                The Get Unallocated Raw Page Count subfunction returns the
  8692.                number of unallocated non-standard length mappable pages as
  8693.                well as the total number of non-standard length mappable
  8694.                pages in expanded memory to the operating system.
  8695.  
  8696.                One variety of expanded memory board has a page size which
  8697.                is a sub-multiple of 16K bytes.  An expanded memory page
  8698.                which is a sub-multiple of 16K is termed a raw page.  An
  8699.                operating system may deal with mappable physical page sizes
  8700.                which are sub-multiples of 16K bytes.
  8701.  
  8702.                If the expanded memory board supplies pages in exact
  8703.                multiples of 16K bytes, the number of pages this function
  8704.                returns is identical to the number Function 3 (Get Unallo-
  8705.                cated Page Count) returns.  In this case, there is no
  8706.                difference between a page and a raw page.
  8707.  
  8708.  
  8709.           CALLING PARAMETERS
  8710.  
  8711.                AX = 5901h
  8712.                    Contains the Get Unallocated Raw Page Count subfunction.
  8713.  
  8714.  
  8715.           RESULTS
  8716.  
  8717.                These results are valid only if the status returned is zero.
  8718.  
  8719.                BX = unallocated raw pages
  8720.                    The number of raw pages that are currently available for
  8721.                    use.
  8722.  
  8723.                DX = total raw pages
  8724.                    The total number of raw pages in expanded memory.
  8725.  
  8726.  
  8727.           REGISTERS MODIFIED
  8728.  
  8729.                AX, BX, DX
  8730.  
  8731.  
  8732.  
  8733.  
  8734.  
  8735.  
  8736.  
  8737.           EMM Functions                                                 142
  8738.  
  8739.  
  8740.  
  8741.  
  8742.  
  8743.           Function 26. Get Expanded Memory Hardware Information
  8744.           Get Unallocated Raw Page Count subfunction
  8745.  
  8746.  
  8747.  
  8748.           STATUS
  8749.  
  8750.                AH = 0   SUCCESSFUL.
  8751.                    The manager has returned the number of unallocated raw
  8752.                    pages and the number of total raw pages in expanded
  8753.                    memory.
  8754.  
  8755.                AH = 80h   NON-RECOVERABLE.
  8756.                    The manager detected a malfunction in the memory manager
  8757.                    software.
  8758.  
  8759.                AH = 81h   NON-RECOVERABLE.
  8760.                    The manager detected a malfunction in the expanded
  8761.                    memory hardware.
  8762.  
  8763.                AH = 84h   NON-RECOVERABLE.
  8764.                    The function code passed to the memory manager is not
  8765.                    defined.
  8766.  
  8767.                AH = 8Fh   NON-RECOVERABLE.
  8768.                    The subfunction parameter is invalid.
  8769.  
  8770.  
  8771.           EXAMPLE
  8772.  
  8773.           unalloc_raw_pages              DW ?
  8774.           total_raw_pages                DW ?
  8775.  
  8776.           MOV   AX,5901h                 ; load function code
  8777.           INT   67h                      ; call the memory manager
  8778.           OR    AH,AH                    ; check EMM status
  8779.           JNZ   emm_err_handler          ; jump to error handler on error
  8780.           MOV   unalloc_raw_pages,BX     ; save unallocated raw page count
  8781.           MOV   total_raw_pages,DX       ; save total raw page count
  8782.  
  8783.  
  8784.  
  8785.  
  8786.  
  8787.  
  8788.  
  8789.  
  8790.  
  8791.  
  8792.  
  8793.  
  8794.  
  8795.  
  8796.           EMM Functions                                                 143
  8797.  
  8798.  
  8799.  
  8800.  
  8801.  
  8802.           Function 27. Allocate Standard/Raw Pages
  8803.           Allocate Standard Pages subfunction
  8804.  
  8805.  
  8806.  
  8807.           PURPOSE
  8808.  
  8809.                The Allocate Standard Pages subfunction allocates the number
  8810.                of standard size (16K bytes) pages that the operating system
  8811.                requests and assigns a unique EMM handle to these pages. 
  8812.                The EMM handle owns these pages until the operating system
  8813.                deallocates them.  This subfunction allows you to allocate
  8814.                zero pages to a handle, unlike Function 4 (Allocate Pages).
  8815.  
  8816.           Note............................................................
  8817.                This note affects expanded memory manager implementors and
  8818.                operating system developers only.  Applications should not
  8819.                use the following characteristic of the memory manager.  An
  8820.                application violating this rule will be incompatible with
  8821.                future versions of Microsoft's operating systems and
  8822.                environments.
  8823.  
  8824.                To be compatible with this specification, an expanded memory
  8825.                manager will provide a special handle which is available to
  8826.                the operating system only.  This handle will have a value of
  8827.                0000h and will have a set of pages allocated to it when the
  8828.                expanded memory manager driver installs.  The pages that the
  8829.                memory manager will automatically allocate to handle 0000h
  8830.                are those that backfill conventional memory.  Typically,
  8831.                this backfill occurs between addresses 40000h (256K) and
  8832.                9FFFFh (640K).  However, the range can extend below and
  8833.                above this limit if the hardware and memory manager have the
  8834.                capability.
  8835.  
  8836.                An operating system won't have to invoke Function 27 to
  8837.                obtain this handle because it can assume the handle already
  8838.                exists and is available for use immediately after the
  8839.                expanded memory device driver installs.  When an operating
  8840.                system wants to use this handle, it uses the special handle
  8841.                value of 0000h.  The operating system will be able to invoke
  8842.                any EMM function using this special handle value.  To
  8843.                allocate pages to this handle, the operating system need
  8844.                only invoke Function 18 (Reallocate Pages).
  8845.  
  8846.                There are two special cases for this handle:
  8847.  
  8848.                1.  Function 27 (Allocate Standard Pages subfunction).  This
  8849.                    function must never return zero as a handle value. 
  8850.                    Applications must always invoke Function 27 to allocate
  8851.                    pages and obtain a handle which identifies the pages
  8852.                    which belong to it.  Since Function 27 never returns a
  8853.  
  8854.  
  8855.           EMM Functions                                                 144
  8856.  
  8857.  
  8858.  
  8859.  
  8860.  
  8861.           Function 27. Allocate Standard/Raw Pages
  8862.           Allocate Standard Pages subfunction
  8863.  
  8864.  
  8865.  
  8866.                    handle value of zero, an application will never gain
  8867.                    access to this special handle.
  8868.  
  8869.                2.  Function 6 (Deallocate Pages).  If the operating system
  8870.                    uses it to deallocate the pages which are allocated to
  8871.                    this handle, the pages the handle owns will be returned
  8872.                    to the manager for use.  But the handle will not be
  8873.                    available for reassignment.  The manager should treat a
  8874.                    deallocate pages function request for this handle the
  8875.                    same as a reallocate pages function request, where the
  8876.                    number of pages to reallocate to this handle is zero.
  8877.  
  8878.  
  8879.           CALLING PARAMETERS
  8880.  
  8881.                AX = 5A00h
  8882.                    Contains the Allocate Standard Pages subfunction.
  8883.  
  8884.                BX = num_of_standard_pages_to_alloc
  8885.                    Contains the number of standard pages the operating
  8886.                    system wants to allocate.
  8887.  
  8888.  
  8889.           RESULTS
  8890.  
  8891.                These results are valid only if the status returned is zero.
  8892.  
  8893.                DX = handle
  8894.                    Contains a unique EMM handle.  The operating system must
  8895.                    use this EMM handle as a parameter in any function that
  8896.                    requires it.  Up to 255 handles may be obtained.  (Both
  8897.                    Function 27 and Function 4 must share the same 255
  8898.                    handles.)
  8899.  
  8900.                    For all functions using this handle, the length of the
  8901.                    physical and logical pages allocated to it are standard
  8902.                    length (that is, 16K bytes).
  8903.  
  8904.  
  8905.           REGISTERS MODIFIED
  8906.  
  8907.                AX, DX
  8908.  
  8909.  
  8910.  
  8911.  
  8912.  
  8913.  
  8914.           EMM Functions                                                 145
  8915.  
  8916.  
  8917.  
  8918.  
  8919.  
  8920.           Function 27. Allocate Standard/Raw Pages
  8921.           Allocate Standard Pages subfunction
  8922.  
  8923.  
  8924.  
  8925.           STATUS
  8926.  
  8927.                AH = 0   SUCCESSFUL.
  8928.                    The manager has allocated the pages to an assigned EMM
  8929.                    standard handle.
  8930.  
  8931.                AH = 80h   NON-RECOVERABLE.
  8932.                    The manager detected a malfunction in the memory manager
  8933.                    software.
  8934.  
  8935.                AH = 81h   NON-RECOVERABLE.
  8936.                    The manager detected a malfunction in the expanded
  8937.                    memory hardware.
  8938.  
  8939.                AH = 84h   NON-RECOVERABLE.
  8940.                    The function code passed to the memory manager is not
  8941.                    defined.
  8942.  
  8943.                AH = 85h   RECOVERABLE.
  8944.                    All EMM handles are being used.
  8945.  
  8946.                AH = 87h   RECOVERABLE.
  8947.                    There aren't enough expanded memory pages present in the
  8948.                    system to satisfy the operating system's request.
  8949.  
  8950.                AH = 88h   RECOVERABLE.
  8951.                    There aren't enough unallocated pages to satisfy the
  8952.                    operating system's request.
  8953.  
  8954.                AH = 8Fh   NON-RECOVERABLE.
  8955.                    The subfunction parameter is invalid.
  8956.  
  8957.  
  8958.           EXAMPLE
  8959.  
  8960.           num_of_standard_pages_to_alloc      DW ?
  8961.           emm_handle                          DW ?
  8962.  
  8963.           MOV   BX,num_of_standard_pages_to_alloc
  8964.           MOV   AX,5A00h                      ; load function code
  8965.           INT   67h                           ; call the memory manager
  8966.           OR    AH,AH                         ; check EMM status
  8967.           JNZ   emm_err_handler               ; jump to error handler on
  8968.                                               ; error
  8969.           MOV   emm_handle,DX                 ; save handle
  8970.  
  8971.  
  8972.  
  8973.           EMM Functions                                                 146
  8974.  
  8975.  
  8976.  
  8977.  
  8978.  
  8979.           Function 27. Allocate Standard/Raw Pages
  8980.           Allocate Raw Pages subfunction
  8981.  
  8982.  
  8983.  
  8984.           PURPOSE
  8985.  
  8986.                The Allocate Raw Pages function allocates the number of non-
  8987.                standard size pages that the operating system requests and
  8988.                assigns a unique EMM handle to these pages.  The EMM handle
  8989.                owns these pages until the operating system deallocates
  8990.                them.  This function allows you to allocate zero pages to a
  8991.                handle, unlike Function 4 (Allocate Pages).
  8992.  
  8993.                A hardware vendor may design an expanded memory board that
  8994.                has a page size which is a sub-multiple of 16K bytes.  A
  8995.                physical page which is a sub-multiple of 16K is termed a raw
  8996.                page.  The operating system may deal with page sizes which
  8997.                are sub-multiples of 16K bytes.  The memory manager must
  8998.                treat any function using a handle with raw pages allocated
  8999.                to it by Function 27 (Allocate Raw Pages subfunction)
  9000.                differently than it does a handle that has normal 16K-byte
  9001.                pages allocated to it.
  9002.  
  9003.                Handles which are assigned using Function 4 (Allocate Pages)
  9004.                or Function 27 (Allocate Standard Pages subfunction) must
  9005.                have pages which are 16K bytes -- this is the length of a
  9006.                standard expanded memory page.  If the expanded memory board
  9007.                hardware is not able to supply 16K-byte pages, the memory
  9008.                manager must emulate pages which are 16K bytes combining
  9009.                multiple non-standard size pages to form a single 16K-byte
  9010.                page.
  9011.  
  9012.                Handles which are assigned using Function 27 (Allocate Raw
  9013.                Pages subfunction) are called raw handles.  All logical
  9014.                pages allocated to a raw handle may have a non-standard
  9015.                length (that is, not 16K bytes).  However, once the operat-
  9016.                ing system has allocated a number of raw pages to a handle,
  9017.                it is the responsibility of the memory manager to recognize
  9018.                that raw handle as one that has non-standard size pages
  9019.                allocated to it.  The memory manager must identify these
  9020.                handles and treat all functions which use handles which have
  9021.                non-standard page lengths differently.  The logical page
  9022.                length becomes the length of the non-standard size page for
  9023.                any raw handle that Function 27 assigns.
  9024.  
  9025.           Note............................................................
  9026.                This note affects expanded memory manager implementors and
  9027.                operating system developers only.  Applications should not
  9028.                use the following characteristic of the memory manager.  An
  9029.                application violating this rule will be incompatible with
  9030.  
  9031.  
  9032.           EMM Functions                                                 147
  9033.  
  9034.  
  9035.  
  9036.  
  9037.  
  9038.           Function 27. Allocate Standard/Raw Pages
  9039.           Allocate Raw Pages subfunction
  9040.  
  9041.  
  9042.  
  9043.                future versions of Microsoft's operating systems and
  9044.                environments.
  9045.  
  9046.                To be compatible with this specification, an expanded memory
  9047.                manager will provide a special handle which is available to
  9048.                the operating system only.  This handle will have a value of
  9049.                0000h and will have a set of pages allocated to it when the
  9050.                expanded memory manager driver installs.  The pages that the
  9051.                memory manager will automatically allocate to handle 0000h
  9052.                are those that backfill conventional memory.  Typically,
  9053.                this backfill occurs between addresses 40000h (256K) and
  9054.                9FFFFh (640K).  However, the range can extend below and
  9055.                above this limit if the hardware and memory manager have the
  9056.                capability.
  9057.  
  9058.                An operating system won't have to invoke Function 27 to
  9059.                obtain this handle because it can assume the handle already
  9060.                exists and is available for use immediately after the
  9061.                expanded memory device driver installs.  When an operating
  9062.                system wants to use this handle, it uses the special handle
  9063.                value of 0000h.  The operating system will be able to invoke
  9064.                any EMM function using this special handle value.  To
  9065.                allocate pages to this handle, the operating system need
  9066.                only invoke Function 18 (Reallocate Pages).
  9067.  
  9068.                There are two special cases for this handle:
  9069.  
  9070.                1.  Function 27 (Allocate Raw Pages subfunction).  This
  9071.                    function must never return zero as a handle value. 
  9072.                    Applications must always invoke Function 27 to allocate
  9073.                    pages and obtain a handle which identifies the pages
  9074.                    which belong to it.  Since Function 27 never returns a
  9075.                    handle value of zero, an application will never gain
  9076.                    access to this special handle.
  9077.  
  9078.                2.  Function 6 (Deallocate Pages).  If the operating system
  9079.                    uses it to deallocate the pages which are allocated to
  9080.                    this handle, the pages the handle owns will be returned
  9081.                    to the manager for use.  But the handle will not be
  9082.                    available for reassignment.  The manager should treat a
  9083.                    deallocate pages function request for this handle the
  9084.                    same as a reallocate pages function request, where the
  9085.                    number of pages to reallocate to this handle is zero.
  9086.  
  9087.  
  9088.  
  9089.  
  9090.  
  9091.           EMM Functions                                                 148
  9092.  
  9093.  
  9094.  
  9095.  
  9096.  
  9097.           Function 27. Allocate Standard/Raw Pages
  9098.           Allocate Raw Pages subfunction
  9099.  
  9100.  
  9101.  
  9102.           CALLING PARAMETERS
  9103.  
  9104.                AX = 5A01h
  9105.                    Contains the Allocate Raw Pages subfunction.
  9106.  
  9107.                BX = num_of_raw_pages_to_alloc
  9108.                    Contains the number of raw pages the operating system
  9109.                    wishes to allocate.
  9110.  
  9111.  
  9112.           RESULTS
  9113.  
  9114.                These results are valid only if the status returned is zero.
  9115.  
  9116.                DX = raw handle
  9117.                    Contains a unique EMM raw handle.  The operating system
  9118.                    must use this EMM raw handle as a parameter in any
  9119.                    function that requires it.  Up to 255 handles may be
  9120.                    obtained.  (Both Function 4 and Function 27 must share
  9121.                    the same 255 handles).
  9122.  
  9123.                    For all functions using this raw handle, the length of
  9124.                    the physical and logical pages allocated to it may be
  9125.                    non-standard (that is, not 16K bytes).
  9126.  
  9127.  
  9128.           REGISTERS MODIFIED
  9129.  
  9130.                AX, DX
  9131.  
  9132.  
  9133.           STATUS
  9134.  
  9135.                AH = 0   SUCCESSFUL.
  9136.                    The manager has allocated the raw pages to an assigned
  9137.                    EMM raw handle.
  9138.  
  9139.                AH = 80h   NON-RECOVERABLE.
  9140.                    The manager detected a malfunction in the memory manager
  9141.                    software.
  9142.  
  9143.                AH = 81h   NON-RECOVERABLE.
  9144.                    The manager detected a malfunction in the expanded
  9145.                    memory hardware.
  9146.  
  9147.  
  9148.  
  9149.  
  9150.           EMM Functions                                                 149
  9151.  
  9152.  
  9153.  
  9154.  
  9155.  
  9156.           Function 27. Allocate Standard/Raw Pages
  9157.           Allocate Raw Pages subfunction
  9158.  
  9159.  
  9160.  
  9161.                AH = 84h   NON-RECOVERABLE.
  9162.                    The function code passed to the memory manager is not
  9163.                    defined.
  9164.  
  9165.                AH = 85h   RECOVERABLE.
  9166.                    All EMM handles are being used.
  9167.  
  9168.                AH = 87h   RECOVERABLE.
  9169.                    There aren't enough expanded memory raw pages present in
  9170.                    the system to satisfy the operating system's request.
  9171.  
  9172.                AH = 88h   RECOVERABLE.
  9173.                    There aren't enough unallocated raw pages to satisfy the
  9174.                    operating system's request.
  9175.  
  9176.                AH = 8Fh   NON-RECOVERABLE.
  9177.                    The subfunction parameter is invalid.
  9178.  
  9179.  
  9180.           EXAMPLE
  9181.  
  9182.           num_of_raw_pages_to_alloc           DW ?
  9183.           emm_raw_handle                      DW ?
  9184.  
  9185.           MOV   BX,num_of_raw_pages_to_alloc
  9186.           MOV   AX,5A01h                      ; load function code
  9187.           INT   67h                           ; call the memory manager
  9188.           OR    AH,AH                         ; check EMM status
  9189.           JNZ   emm_err_handler               ; jump to error handler
  9190.                                               ; on error
  9191.           MOV   emm_raw_handle,DX             ; save raw handle
  9192.  
  9193.  
  9194.  
  9195.  
  9196.  
  9197.  
  9198.  
  9199.  
  9200.  
  9201.  
  9202.  
  9203.  
  9204.  
  9205.  
  9206.  
  9207.  
  9208.  
  9209.           EMM Functions                                                 150
  9210.  
  9211.  
  9212.  
  9213.  
  9214.  
  9215.           Function 28. Alternate Map Register Set
  9216.  
  9217.  
  9218.  
  9219.           Note............................................................
  9220.                This function is for use by operating systems only.  The
  9221.                operating system can disable this function at any time. 
  9222.                Refer to Function 30 for a description of how an operating
  9223.                system can enable or disable this function.
  9224.  
  9225.  
  9226.           Design Considerations
  9227.  
  9228.                The hardware support for the entire set of subfunctions
  9229.                described is generally not present on every expanded memory
  9230.                board from every vendor of expanded memory board products. 
  9231.                For some of the subfunctions, software emulation is provid-
  9232.                ed.  For other subfunctions, a certain protocol in their use
  9233.                must be observed.  The subfunctions for which this is most
  9234.                crucial are those which address system DMA capabilities.
  9235.  
  9236.  
  9237.           System DMA Capabilities & Expanded Memory Support of DMA
  9238.  
  9239.                In a multitasking operating system, when one task is waiting
  9240.                for DMA to complete, it is useful to be able to switch to
  9241.                another task.  This specification describes a capability
  9242.                which may be designed into expanded memory boards to provide
  9243.                DMA into memory regions which may be mapped out while the
  9244.                DMA is occurring.  For expanded memory boards that do not
  9245.                provide this, it is crucial to understand that while DMA is
  9246.                in progress into a region of mappable memory, the memory
  9247.                mapping context cannot be changed.  That is, all DMA action
  9248.                must be complete before any remapping of pages can be done.
  9249.  
  9250.  
  9251.           Expanded Memory Support of DMA Register Sets
  9252.  
  9253.                Expanded memory boards which have DMA register sets could
  9254.                support DMA into a region of mappable memory while the
  9255.                memory mapping context is being switched.  It is important
  9256.                to realize that these DMA register sets are separate from
  9257.                the alternate map register sets.  An example of how an OS/E
  9258.                might use DMA register sets follows:
  9259.  
  9260.                                       Example 1
  9261.  
  9262.                1.  Allocate a DMA register set.
  9263.  
  9264.                2.  Get current register set.
  9265.  
  9266.                3.  Set the DMA register set.
  9267.  
  9268.           EMM Functions                                                 151
  9269.  
  9270.  
  9271.  
  9272.  
  9273.  
  9274.           Function 28. Alternate Map Register Set
  9275.  
  9276.  
  9277.  
  9278.                4.  Map in the memory desired.
  9279.  
  9280.                5.  Get the DMA register set.
  9281.  
  9282.                6.  Set the original register set.
  9283.  
  9284.                7.  Assign the desired DMA channel to the DMA register set.
  9285.  
  9286.                The preceding set of calls makes all DMA accesses for the
  9287.                desired DMA channel get mapped through the current DMA
  9288.                register set regardless of the current register set.  In
  9289.                other words, the DMA register set overrides the current
  9290.                mapping register set for DMA operations on the DMA channel
  9291.                specified.  A DMA channel that is not assigned to a DMA
  9292.                register set has all its DMA operations mapped through the
  9293.                current mapping register set.
  9294.  
  9295.  
  9296.  
  9297.  
  9298.  
  9299.  
  9300.  
  9301.  
  9302.  
  9303.  
  9304.  
  9305.  
  9306.  
  9307.  
  9308.  
  9309.  
  9310.  
  9311.  
  9312.  
  9313.  
  9314.  
  9315.  
  9316.  
  9317.  
  9318.  
  9319.  
  9320.  
  9321.  
  9322.  
  9323.  
  9324.  
  9325.  
  9326.  
  9327.           EMM Functions                                                 152
  9328.  
  9329.  
  9330.  
  9331.  
  9332.  
  9333.           Function 28. Alternate Map Register Set
  9334.           Get Alternate Map Register Set subfunction
  9335.  
  9336.  
  9337.  
  9338.           Note............................................................
  9339.                This function is for use by operating systems only.  The
  9340.                operating system can disable this function at any time. 
  9341.                Refer to Function 30 for a description of how an operating
  9342.                system can enable or disable this function.
  9343.  
  9344.  
  9345.           PURPOSE
  9346.  
  9347.                The subfunction does one of two things depending on the map
  9348.                register set which is active at the time this function is
  9349.                invoked:
  9350.  
  9351.                1.  If the preceding Set Alternate Map Register Set call was
  9352.                    done with the alternate map register set equal to zero
  9353.                    (BL = 0), these points apply:
  9354.  
  9355.                    a.  The context save area pointer saved within EMM by
  9356.                        the Set Alternate Map Register subfunction is
  9357.                        returned by this call.  This pointer is always
  9358.                        returned for boards which do not supply alternate
  9359.                        mapping register sets.
  9360.  
  9361.                    b.  If the context save area pointer returned is not
  9362.                        equal to zero, this subfunction copies the contents
  9363.                        of the mapping registers on each expanded memory
  9364.                        board in the system into the save area specified by
  9365.                        the pointer.  The format of this save area is the
  9366.                        same as that returned by Function 15 (Get Page Map
  9367.                        subfunction).  This is intended to simulate getting
  9368.                        an alternate map register set.  Note that the memory
  9369.                        manager does not allocate the space for the context: 
  9370.                        the operating system must do so.
  9371.  
  9372.                    c.  If the context save area pointer returned is equal
  9373.                        to zero, this subfunction does not copy the contents
  9374.                        of the mapping registers on each expanded memory
  9375.                        board in the system into the save area specified by
  9376.                        the pointer.
  9377.  
  9378.                    d.  The context save area pointer must have been
  9379.                        initialized by a previous Set Alternate Map Register
  9380.                        Set call.  Note that the value of the context save
  9381.                        area pointer saved within EMM is zero immediately
  9382.                        after installation.
  9383.  
  9384.  
  9385.  
  9386.           EMM Functions                                                 153
  9387.  
  9388.  
  9389.  
  9390.  
  9391.  
  9392.           Function 28. Alternate Map Register Set
  9393.           Get Alternate Map Register Set subfunction
  9394.  
  9395.  
  9396.  
  9397.                    e.  The context save area must be initialized by a
  9398.                        previous Get Page Map call (Function 15).
  9399.  
  9400.                2.  If the preceding Set Alternate Map Register Set call was
  9401.                    done with the alternate map register set greater than
  9402.                    zero (BL > 0), then the number of the alternate map
  9403.                    register set which is in use at the time that this
  9404.                    function is invoked is returned.  The context save area
  9405.                    pointer is not returned in this case.
  9406.  
  9407.  
  9408.           CALLING PARAMETERS
  9409.  
  9410.                AX = 5B00h
  9411.                    Contains the Get Alternate Map Register Set subfunction.
  9412.  
  9413.  
  9414.           RESULTS
  9415.  
  9416.                These results are valid only if the status returned is zero.
  9417.  
  9418.                If BL <> 0, current active alternate map register set number
  9419.                    Contains the alternate map register set which was active
  9420.                    at the time that this function was invoked.
  9421.  
  9422.                ES:DI   Unaffected.
  9423.  
  9424.                If BL = 0
  9425.                    Indicates that a pointer to an area which contains the
  9426.                    state of all the map registers on all boards in the
  9427.                    system, and any additional information necessary to
  9428.                    restore the boards to their original state, has been
  9429.                    returned.
  9430.  
  9431.                ES:DI = pointer to a map register context save area
  9432.                    Contains a pointer to an operating system supplied
  9433.                    context save area.  The pointer is in standard seg-
  9434.                    ment:offset format.  This pointer is always returned if
  9435.                    the expanded memory hardware does not supply alternate
  9436.                    mapping register sets.
  9437.  
  9438.  
  9439.  
  9440.  
  9441.  
  9442.  
  9443.  
  9444.  
  9445.           EMM Functions                                                 154
  9446.  
  9447.  
  9448.  
  9449.  
  9450.  
  9451.           Function 28. Alternate Map Register Set
  9452.           Get Alternate Map Register Set subfunction
  9453.  
  9454.  
  9455.  
  9456.                    The operating system first passes this pointer to the
  9457.                    memory manager whenever it invokes a Set Alternate Map
  9458.                    Register Set subfunction (the description follows).  If
  9459.                    the OS/E invokes this function before invoking a Set
  9460.                    Alternate Map Register Set subfunction, this function
  9461.                    returns a pointer value of zero.  The OS/E must have
  9462.                    allocated the space for the save area.  However, the OS
  9463.                    must request that the memory manager initialize the
  9464.                    contents of this save area before it contains any useful
  9465.                    information.
  9466.  
  9467.                    The OS/E must initialize the save area it has allocated
  9468.                    by invoking Function 15 (Get Page Map subfunction). 
  9469.                    After the OS/E has done this, the save area will contain
  9470.                    the state of all the map registers on all boards in the
  9471.                    system.  The save area will also contain any additional
  9472.                    information necessary to restore the boards to their
  9473.                    original state when the operating system invokes a Set
  9474.                    Alternate Map Register Set subfunction.
  9475.  
  9476.  
  9477.           REGISTERS MODIFIED
  9478.  
  9479.                AX, BX, ES:DI
  9480.  
  9481.  
  9482.           STATUS
  9483.  
  9484.                AH = 0   SUCCESSFUL.
  9485.                    The manager got the alternate map register set.
  9486.  
  9487.                AH = 80h   NON-RECOVERABLE.
  9488.                    The manager detected a malfunction in the memory manager
  9489.                    software.
  9490.  
  9491.                AH = 81h   NON-RECOVERABLE.
  9492.                    The manager detected a malfunction in the expanded
  9493.                    memory hardware.
  9494.  
  9495.                AH = 84h   NON-RECOVERABLE.
  9496.                    The function code passed to the memory manager is not
  9497.                    defined.
  9498.  
  9499.                AH = 8Fh   NON-RECOVERABLE.
  9500.                    The subfunction parameter is invalid.
  9501.  
  9502.  
  9503.  
  9504.           EMM Functions                                                 155
  9505.  
  9506.  
  9507.  
  9508.  
  9509.  
  9510.           Function 28. Alternate Map Register Set
  9511.           Get Alternate Map Register Set subfunction
  9512.  
  9513.  
  9514.  
  9515.                AH = A4h   NON-RECOVERABLE.
  9516.                    The operating system denied access to this function. 
  9517.                    The function cannot be used at this time.
  9518.  
  9519.  
  9520.           EXAMPLE
  9521.  
  9522.           alt_map_reg_set                        DB ?
  9523.           context_save_area_ptr_seg              DW ?
  9524.           context_save_area_ptr_offset           DW ?
  9525.  
  9526.           MOV   AX,5B00h                         ; load function code
  9527.           INT   67h                              ; call the memory manager
  9528.           OR    AH,AH                            ; check EMM status
  9529.           JNZ   emm_err_handler                  ; jump to error handler
  9530.                                                  ; on error
  9531.           MOV   alt_map_reg_set,BL
  9532.           TEST  BL,BL
  9533.           JNZ   no_ptr_returned
  9534.  
  9535.           MOV   context_save_area_ptr_seg,ES     ; save pointer values
  9536.           MOV   context_save_area_ptr_offset,DI
  9537.  
  9538.           no_ptr_returned:
  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.           EMM Functions                                                 156
  9564.  
  9565.  
  9566.  
  9567.  
  9568.  
  9569.           Function 28. Alternate Map Register Set
  9570.           Set Alternate Map Register Set subfunction
  9571.  
  9572.  
  9573.  
  9574.           Note............................................................
  9575.                This function is for use by operating systems only.  The
  9576.                operating system can disable this function at any time. 
  9577.                Refer to Function 30 for a description of how an operating
  9578.                system can enable or disable this function.
  9579.  
  9580.  
  9581.           PURPOSE
  9582.  
  9583.                The subfunction does one of two things, depending on the map
  9584.                register set specified:
  9585.  
  9586.                1.  If the alternate map register set specified is zero, map
  9587.                    register set zero is activated.  If the map register
  9588.                    context restore area pointer is not equal to zero, the
  9589.                    contents of the restore area pointed to by ES:DI are
  9590.                    copied into register set zero on each expanded memory
  9591.                    board in the system.  If the pointer is equal to zero,
  9592.                    the contents are not copied.
  9593.  
  9594.                    Regardless of its value, the map register context
  9595.                    restore area pointer is saved within the memory manager. 
  9596.                    It will be used during the Get Alternate Map Register
  9597.                    Set subfunction.
  9598.  
  9599.                    The operating system must supply the pointer to the
  9600.                    area.  This subfunction is intended to simulate setting
  9601.                    an alternate map register set.  Note that the operating
  9602.                    system must allocate the space for the context.  The
  9603.                    memory manager saves the context save area pointer
  9604.                    internally.
  9605.  
  9606.                2.  If the alternate map register set specified is not zero,
  9607.                    the alternate map register set specified is activated. 
  9608.                    The restore area, which the operating system is pointing
  9609.                    to, is not used.
  9610.  
  9611.  
  9612.           CALLING PARAMETERS
  9613.  
  9614.                AX = 5B01h
  9615.                    Contains the Set Alternate Map Register Set subfunction.
  9616.  
  9617.  
  9618.  
  9619.  
  9620.  
  9621.  
  9622.           EMM Functions                                                 157
  9623.  
  9624.  
  9625.  
  9626.  
  9627.  
  9628.           Function 28. Alternate Map Register Set
  9629.           Set Alternate Map Register Set subfunction
  9630.  
  9631.  
  9632.  
  9633.                BL = new alternate map register set number
  9634.                    Contains the number of the alternate map register set
  9635.                    which is to be activated.
  9636.  
  9637.                    If BL <> 0
  9638.                        A pointer to a map register context restore area is
  9639.                        not required and the contents of ES:DI is unaffected
  9640.                        and ignored.  The alternate map register set
  9641.                        specified in BL is activated if the board supports
  9642.                        it.
  9643.  
  9644.                    If BL = 0
  9645.                        A pointer to an area which contains the state of all
  9646.                        the map registers on all boards in the system, and
  9647.                        any additional information necessary to restore the
  9648.                        boards to their original state, has been passed in
  9649.                        ES:DI.
  9650.  
  9651.                ES:DI = pointer to a map register context restore area
  9652.                    Contains a pointer to an OS/E supplied map register
  9653.                    context restore area.  The pointer is in standard
  9654.                    segment:offset format.  This pointer must always be
  9655.                    passed if the expanded memory hardware does not supply
  9656.                    alternate mapping register sets.
  9657.  
  9658.                    The memory manager must save this pointer whenever the
  9659.                    OS/E invokes this function.  The OS/E must have allo-
  9660.                    cated the space for the restore area.  Additionally, the
  9661.                    contents of this restore area must have been initialized
  9662.                    by the memory manager before it will contain any useful
  9663.                    information.  The OS/E initializes the restore area it
  9664.                    has allocated by invoking Function 15 (Get Page Map
  9665.                    subfunction).  After the OS/E has done this, the restore
  9666.                    area will contain the state of the map registers on all
  9667.                    boards in the system, and any additional information
  9668.                    necessary to restore the boards to their original state
  9669.                    when the operating system invokes a Set Alternate Map
  9670.                    Register Set subfunction.
  9671.  
  9672.  
  9673.           REGISTERS MODIFIED
  9674.  
  9675.                AX
  9676.  
  9677.  
  9678.  
  9679.  
  9680.  
  9681.           EMM Functions                                                 158
  9682.  
  9683.  
  9684.  
  9685.  
  9686.  
  9687.           Function 28. Alternate Map Register Set
  9688.           Set Alternate Map Register Set subfunction
  9689.  
  9690.  
  9691.  
  9692.           STATUS
  9693.  
  9694.                AH = 0   SUCCESSFUL.
  9695.                    The manager set the alternate map register set.
  9696.  
  9697.                AH = 80h   NON-RECOVERABLE.
  9698.                    The manager detected a malfunction in the memory manager
  9699.                    software.
  9700.  
  9701.                AH = 81h   NON-RECOVERABLE.
  9702.                    The manager detected a malfunction in the expanded
  9703.                    memory hardware.
  9704.  
  9705.                AH = 84h   NON-RECOVERABLE.
  9706.                    The function code passed to the memory manager is not
  9707.                    defined.
  9708.  
  9709.                AH = 8Fh   NON-RECOVERABLE.
  9710.                    The subfunction parameter is invalid.
  9711.  
  9712.                AH = 9Ah   NON-RECOVERABLE.
  9713.                    Alternate map register sets are supported, but the
  9714.                    alternate map register set specified is not supported.
  9715.  
  9716.                AH = 9Ch   NON-RECOVERABLE.
  9717.                    Alternate map register sets are not supported, and the
  9718.                    alternate map register set specified is not zero.
  9719.  
  9720.                AH = 9Dh   NON-RECOVERABLE.
  9721.                    Alternate map register sets are supported, but the
  9722.                    alternate map register set specified is either not
  9723.                    defined or not allocated.
  9724.  
  9725.                AH = A3h   NON-RECOVERABLE.
  9726.                    The contents of the source array have been corrupted, or
  9727.                    the pointer passed to the subfunction is invalid.
  9728.  
  9729.                AH = A4h   NON-RECOVERABLE.
  9730.                    The operating system has denied access to this function. 
  9731.                    The function cannot be used at this time.
  9732.  
  9733.  
  9734.  
  9735.  
  9736.  
  9737.  
  9738.  
  9739.  
  9740.           EMM Functions                                                 159
  9741.  
  9742.  
  9743.  
  9744.  
  9745.  
  9746.           Function 28. Alternate Map Register Set
  9747.           Set Alternate Map Register Set subfunction
  9748.  
  9749.  
  9750.  
  9751.           EXAMPLE
  9752.  
  9753.           alt_map_reg_set                        DB ?
  9754.           context_restore_area_ptr_seg           DW ?
  9755.           context_restore_area_ptr_offset        DW ?
  9756.  
  9757.           MOV   AX,5B01h                         ; load function code
  9758.           MOV   BL,alt_map_reg_set
  9759.           TEST  BL,BL
  9760.           JZ    no_ptr_passed
  9761.  
  9762.           MOV   ES,context_restore_area_ptr_seg
  9763.           MOV   DI,context_restore_area_ptr_offset
  9764.  
  9765.           no_ptr_passed:
  9766.  
  9767.           INT   67h                              ; call the memory manger
  9768.           OR    AH,AH                            ; check EMM status
  9769.           JNZ   emm_err_handler                  ; jump to error handler
  9770.                                                  ; on error
  9771.  
  9772.  
  9773.  
  9774.  
  9775.  
  9776.  
  9777.  
  9778.  
  9779.  
  9780.  
  9781.  
  9782.  
  9783.  
  9784.  
  9785.  
  9786.  
  9787.  
  9788.  
  9789.  
  9790.  
  9791.  
  9792.  
  9793.  
  9794.  
  9795.  
  9796.  
  9797.  
  9798.  
  9799.           EMM Functions                                                 160
  9800.  
  9801.  
  9802.  
  9803.  
  9804.  
  9805.           Function 28. Alternate Map Register Set
  9806.           Get Alternate Map Save Array Size subfunction
  9807.  
  9808.  
  9809.  
  9810.           Note............................................................
  9811.                This function is for use by operating systems only.  The
  9812.                operating system can disable this function at any time. 
  9813.                Refer to Function 30 for a description of how an operating
  9814.                system can enable or disable this function.
  9815.  
  9816.  
  9817.           PURPOSE
  9818.  
  9819.                This subfunction returns the storage requirements for the
  9820.                map register context save area referenced by the other
  9821.                subfunctions.
  9822.  
  9823.  
  9824.           CALLING PARAMETERS
  9825.  
  9826.                AX = 5B02h
  9827.                    Contains the Get Alternate Map Save Array Size subfunc-
  9828.                    tion.
  9829.  
  9830.  
  9831.           RESULTS
  9832.  
  9833.                These results are valid only if the status returned is zero.
  9834.  
  9835.                DX = size_of_array
  9836.                    Contains the number of bytes that will be transferred to
  9837.                    the memory area supplied by an operating system whenever
  9838.                    an operating system requests the Get, Set, or Get and
  9839.                    Set subfunction.
  9840.  
  9841.  
  9842.           REGISTERS MODIFIED
  9843.  
  9844.                AX, DX
  9845.  
  9846.  
  9847.           STATUS
  9848.  
  9849.                AH = 0   SUCCESSFUL.
  9850.                    The manager has returned the array size.
  9851.  
  9852.                AH = 80h   NON-RECOVERABLE.
  9853.                    The manager detected a malfunction in the memory manager
  9854.                    software.
  9855.  
  9856.  
  9857.  
  9858.           EMM Functions                                                 161
  9859.  
  9860.  
  9861.  
  9862.  
  9863.  
  9864.           Function 28. Alternate Map Register Set
  9865.           Get Alternate Map Save Array Size subfunction
  9866.  
  9867.  
  9868.  
  9869.                AH = 81h   NON-RECOVERABLE.
  9870.                    The manager detected a malfunction in the expanded
  9871.                    memory hardware.
  9872.  
  9873.                AH = 84h   NON-RECOVERABLE.
  9874.                    The function code passed to the memory manager is not
  9875.                    defined.
  9876.  
  9877.                AH = 8Fh   NON-RECOVERABLE.
  9878.                    The subfunction parameter is invalid.
  9879.  
  9880.                AH = A4h   NON-RECOVERABLE.
  9881.                    The operating system has denied access to this function. 
  9882.                    The function cannot be used at this time.
  9883.  
  9884.  
  9885.           EXAMPLE
  9886.  
  9887.           size_of_array                  DW ?
  9888.  
  9889.           MOV   AX,5B02h                 ; load function code
  9890.           INT   67h                      ; call the memory manager
  9891.           OR    AH,AH                    ; check EMM status
  9892.           JNZ   emm_err_handler          ; jump to error handler on error
  9893.           MOV   size_of_array,DX         ; save size of array
  9894.  
  9895.  
  9896.  
  9897.  
  9898.  
  9899.  
  9900.  
  9901.  
  9902.  
  9903.  
  9904.  
  9905.  
  9906.  
  9907.  
  9908.  
  9909.  
  9910.  
  9911.  
  9912.  
  9913.  
  9914.  
  9915.  
  9916.  
  9917.           EMM Functions                                                 162
  9918.  
  9919.  
  9920.  
  9921.  
  9922.  
  9923.           Function 28. Alternate Map Register Set
  9924.           Allocate Alternate Map Register Set subfunction
  9925.  
  9926.  
  9927.  
  9928.           Note............................................................
  9929.                This function is for use by operating systems only.  The
  9930.                operating system can disable this function at any time. 
  9931.                Refer to Function 30 for a description of how an operating
  9932.                system can enable or disable this function.
  9933.  
  9934.  
  9935.           PURPOSE
  9936.  
  9937.                The Allocate Alternate Map Register Set subfunction gets the
  9938.                number of an alternate map register set for an operating
  9939.                system if an alternate map register set is currently
  9940.                available for use.  If the hardware does not support
  9941.                alternate map register sets, an alternate map register set
  9942.                number of zero will be returned.
  9943.  
  9944.                The alternate map register set allocated may be referred to
  9945.                by this number when using the Get or Set Alternate Map
  9946.                Register Set subfunctions.  The operating system can use
  9947.                these subfunctions to switch map contexts very rapidly on
  9948.                expanded memory boards with alternate map register sets.
  9949.  
  9950.                This subfunction copies the currently active alternate map
  9951.                register set's contents into the newly allocated alternate
  9952.                map register set's mapping registers.  This is done so that
  9953.                when the OS/E performs a Set Alternate Map Register Set
  9954.                subfunction the memory mapped before the allocation of the
  9955.                new alternate map will be available for reading and writing. 
  9956.                This function does not actually change the alternate map
  9957.                register set in use, but in addition to allocating a new
  9958.                alternate map register set, it prepares the new alternate
  9959.                map register set for a subsequent Set Alternate Map Register
  9960.                Set subfunction.
  9961.  
  9962.  
  9963.           CALLING PARAMETERS
  9964.  
  9965.                AX = 5B03h
  9966.                    Contains the Allocate Alternate Map Register Set
  9967.                    subfunction.
  9968.  
  9969.  
  9970.  
  9971.  
  9972.  
  9973.  
  9974.  
  9975.  
  9976.           EMM Functions                                                 163
  9977.  
  9978.  
  9979.  
  9980.  
  9981.  
  9982.           Function 28. Alternate Map Register Set
  9983.           Allocate Alternate Map Register Set subfunction
  9984.  
  9985.  
  9986.  
  9987.           RESULTS
  9988.  
  9989.                These results are valid only if the status returned is zero.
  9990.  
  9991.                BL = alternate map register set number
  9992.                    Contains the number of an alternate map register set. 
  9993.                    If there are no alternate map register sets supported by
  9994.                    the hardware, a zero will be returned.  In this case,
  9995.                    the Get Alternate Map function (Function 28) should be
  9996.                    invoked in order to obtain a pointer to a map register
  9997.                    context save area.  The OS/E must supply this area.  The
  9998.                    save area is necessary because the hardware doesn't
  9999.                    support alternate map register sets.
  10000.  
  10001.  
  10002.           REGISTERS MODIFIED
  10003.  
  10004.                AX, BX
  10005.  
  10006.  
  10007.           STATUS
  10008.  
  10009.                AH = 0   SUCCESSFUL.
  10010.                    The manager has returned the alternate map register set
  10011.                    number.
  10012.  
  10013.                AH = 80h   NON-RECOVERABLE.
  10014.                    The manager detected a malfunction in the memory manager
  10015.                    software.
  10016.  
  10017.                AH = 81h   NON-RECOVERABLE.
  10018.                    The manager detected a malfunction in the expanded
  10019.                    memory hardware.
  10020.  
  10021.                AH = 84h   NON-RECOVERABLE.
  10022.                    The function code passed to the memory manager is not
  10023.                    defined.
  10024.  
  10025.                AH = 8Fh   NON-RECOVERABLE.
  10026.                    The subfunction parameter is invalid.
  10027.  
  10028.                AH = 9Bh   NON-RECOVERABLE.
  10029.                    Alternate map register sets are supported.  However, all
  10030.                    alternate map register sets are currently allocated.
  10031.  
  10032.  
  10033.  
  10034.  
  10035.           EMM Functions                                                 164
  10036.  
  10037.  
  10038.  
  10039.  
  10040.  
  10041.           Function 28. Alternate Map Register Set
  10042.           Allocate Alternate Map Register Set subfunction
  10043.  
  10044.  
  10045.  
  10046.                AH = A4h   NON-RECOVERABLE.
  10047.                    The operating system has denied access to this function. 
  10048.                    The function cannot be used at this time.
  10049.  
  10050.  
  10051.           EXAMPLE
  10052.  
  10053.           alt_map_reg_num                DB ?
  10054.  
  10055.           MOV   AX,5B03h                 ; load function code
  10056.           INT   67h                      ; call the memory manager
  10057.           OR    AH,AH                    ; check EMM status
  10058.           JNZ   emm_err_handler          ; jump to error handler on error
  10059.           MOV   alt_map_reg_num,BL       ; save number of
  10060.                                          ; alternate map register set
  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.           EMM Functions                                                 165
  10095.  
  10096.  
  10097.  
  10098.  
  10099.  
  10100.           Function 28. Alternate Map Register Set
  10101.           Deallocate Alternate Map Register Set subfunction
  10102.  
  10103.  
  10104.  
  10105.           Note............................................................
  10106.                This function is for use by operating systems only.  The
  10107.                operating system can disable this function at any time. 
  10108.                Refer to Function 30 for a description of how an operating
  10109.                system can enable or disable this function.
  10110.  
  10111.  
  10112.           PURPOSE
  10113.  
  10114.                The Deallocate Alternate Map Register Set subfunction
  10115.                returns the alternate map register set to the memory manager
  10116.                for future use.  The memory manager may reallocate the
  10117.                alternate map register set when needed.
  10118.  
  10119.                This subfunction also makes the mapping context of the
  10120.                alternate map register specified unavailable for reading or
  10121.                writing (unmapping).  This protects the pages previously
  10122.                mapped in an alternate map register set by making them
  10123.                inaccessible.  Note that the current alternate map register
  10124.                set cannot be deallocated.  This makes all memory which was
  10125.                currently mapped into conventional and expanded memory
  10126.                inaccessible.
  10127.  
  10128.  
  10129.           CALLING PARAMETERS
  10130.  
  10131.                AX = 5B04h
  10132.                    Contains the Deallocate Alternate Map Register Set
  10133.                    subfunction.
  10134.  
  10135.                BL = alternate register set number
  10136.                    Contains the number of the alternate map register set to
  10137.                    deallocate.  Map register set zero cannot be allocated
  10138.                    or deallocated.  However, if alternate map register set
  10139.                    zero is specified and this subfunction is invoked, no
  10140.                    error will be returned.  The function invocation is
  10141.                    ignored in this case.
  10142.  
  10143.  
  10144.           REGISTERS MODIFIED
  10145.  
  10146.                AX
  10147.  
  10148.  
  10149.  
  10150.  
  10151.  
  10152.  
  10153.           EMM Functions                                                 166
  10154.  
  10155.  
  10156.  
  10157.  
  10158.  
  10159.           Function 28. Alternate Map Register Set
  10160.           Deallocate Alternate Map Register Set subfunction
  10161.  
  10162.  
  10163.  
  10164.           STATUS
  10165.  
  10166.                AH = 0   SUCCESSFUL.
  10167.                    The manager has deallocated the alternate map register
  10168.                    set.
  10169.  
  10170.                AH = 80h   NON-RECOVERABLE.
  10171.                    The manager detected a malfunction in the memory manager
  10172.                    software.
  10173.  
  10174.                AH = 81h   NON-RECOVERABLE.
  10175.                    The manager detected a malfunction in the expanded
  10176.                    memory hardware.
  10177.  
  10178.                AH = 84h   NON-RECOVERABLE.
  10179.                    The function code passed to the memory manager is not
  10180.                    defined.
  10181.  
  10182.                AH = 8Fh   NON-RECOVERABLE.
  10183.                    The subfunction parameter is invalid.
  10184.  
  10185.                AH = 9Ch   NON-RECOVERABLE.
  10186.                    Alternate map register sets are not supported and the
  10187.                    alternate map register set specified is not zero.
  10188.  
  10189.                AH = 9Dh   NON-RECOVERABLE.
  10190.                    Alternate map register sets are supported, but the
  10191.                    alternate map register set specified is either not
  10192.                    defined or not allocated.
  10193.  
  10194.                AH = A4h   NON-RECOVERABLE.
  10195.                    The operating system has denied access to this function. 
  10196.                    The function cannot be used at this time.
  10197.  
  10198.  
  10199.           EXAMPLE
  10200.  
  10201.           alternate_map_reg_set               DB ?
  10202.  
  10203.           MOV   BL,alternate_map_reg_set      ; specify alternate map
  10204.                                               ; register set
  10205.           MOV   AX,5B04h                      ; load function code
  10206.           INT   67h                           ; call the memory manager
  10207.           OR    AH,AH                         ; check EMM status
  10208.           JNZ   emm_err_handler               ; jump to error handler
  10209.                                               ; on error
  10210.  
  10211.  
  10212.           EMM Functions                                                 167
  10213.  
  10214.  
  10215.  
  10216.  
  10217.  
  10218.           Function 28. Alternate Map Register Set
  10219.           Allocate DMA Register Set subfunction
  10220.  
  10221.  
  10222.  
  10223.           Note............................................................
  10224.                This function is for use by operating systems only.  The
  10225.                operating system can disable this function at any time. 
  10226.                Refer to Function 30 for a description of how an operating
  10227.                system can enable or disable this function.
  10228.  
  10229.  
  10230.           PURPOSE
  10231.  
  10232.                The Allocate DMA Register Set subfunction gets the number of
  10233.                a DMA register set for an OS/E, if a DMA register set is
  10234.                currently available for use.  If the hardware does not
  10235.                support DMA register sets, a DMA register set number of zero
  10236.                will be returned.
  10237.  
  10238.                In a multitasking operating system, when one task is waiting
  10239.                for DMA to complete, it is useful to be able to switch to
  10240.                another task.  However, if the DMA is being mapped through
  10241.                the current register set, the switching cannot occur.  That
  10242.                is, all DMA action must be complete before any remapping of
  10243.                pages can be done.
  10244.  
  10245.                The operating system would initiate a DMA operation on a
  10246.                specific DMA channel using a specific alternate map register
  10247.                set.  This alternate map register set would not be used
  10248.                again, by the operating system or an application, until
  10249.                after the DMA operation is complete.  The operating system
  10250.                guarantees this by not changing the contents of the alter-
  10251.                nate map register set, or allowing an application to change
  10252.                the contents of the alternate map register set, for the
  10253.                duration of the DMA operation.
  10254.  
  10255.  
  10256.           CALLING PARAMETERS
  10257.  
  10258.                AX = 5B05h
  10259.                    Contains the Allocate DMA Register Set subfunction.
  10260.  
  10261.  
  10262.           RESULTS
  10263.  
  10264.                These results are valid only if the status returned is zero.
  10265.  
  10266.                BL = DMA register set number
  10267.                    Contains the number of a DMA register set.  If there are
  10268.                    no DMA register sets supported by the hardware, a zero
  10269.                    will be returned.
  10270.  
  10271.           EMM Functions                                                 168
  10272.  
  10273.  
  10274.  
  10275.  
  10276.  
  10277.           Function 28. Alternate Map Register Set
  10278.           Allocate DMA Register Set subfunction
  10279.  
  10280.  
  10281.  
  10282.           REGISTERS MODIFIED
  10283.  
  10284.                AX, BX
  10285.  
  10286.  
  10287.           STATUS
  10288.  
  10289.                AH = 0   SUCCESSFUL.
  10290.                    The manager has allocated the DMA register set.
  10291.  
  10292.                AH = 80h   NON-RECOVERABLE.
  10293.                    The manager detected a malfunction in the memory manager
  10294.                    software.
  10295.  
  10296.                AH = 81h   NON-RECOVERABLE.
  10297.                    The manager detected a malfunction in the expanded
  10298.                    memory hardware.
  10299.  
  10300.                AH = 84h   NON-RECOVERABLE.
  10301.                    The function code passed to the memory manager is not
  10302.                    defined.
  10303.  
  10304.                AH = 8Fh   NON-RECOVERABLE.
  10305.                    The subfunction parameter is invalid.
  10306.  
  10307.                AH = 9Bh   NON-RECOVERABLE.
  10308.                    DMA register sets are supported.  However, all DMA
  10309.                    register sets are currently allocated.
  10310.  
  10311.                AH = A4h   NON-RECOVERABLE.
  10312.                    Access to this function has been denied by the operating
  10313.                    system.  The function cannot be used at this time.
  10314.  
  10315.  
  10316.           EXAMPLE
  10317.  
  10318.           DMA_reg_set_number                  DB ?
  10319.  
  10320.           MOV   AX,5B05h                      ; load function code
  10321.           INT   67h                           ; call memory manager
  10322.           OR    AH,AH                         ; check EMM status
  10323.           JNZ   emm_err_handler               ; jump to error handler
  10324.                                               ; on error
  10325.           MOV   DMA_reg_set_number,BL         ; save number of DMA
  10326.                                               ; register set
  10327.  
  10328.  
  10329.  
  10330.           EMM Functions                                                 169
  10331.  
  10332.  
  10333.  
  10334.  
  10335.  
  10336.           Function 28. Alternate Map Register Set
  10337.           Enable DMA on Alternate Map Register Set subfunction
  10338.  
  10339.  
  10340.  
  10341.           Note............................................................
  10342.                This function is for use by operating systems only.  The
  10343.                operating system can disable this function at any time. 
  10344.                Refer to Function 30 for a description of how an operating
  10345.                system can enable or disable this function.
  10346.  
  10347.  
  10348.           PURPOSE
  10349.  
  10350.                This subfunction allows DMA accesses on a specific DMA
  10351.                channel to be associated with a specific alternate map
  10352.                register set.  In a multitasking operating system, when a
  10353.                task is waiting for the completion of DMA, it is useful to
  10354.                be able to switch to another task until the DMA operation
  10355.                completes.
  10356.  
  10357.                Any DMA on the specified channel will go through the speci-
  10358.                fied DMA register set regardless of the current register
  10359.                set.  If a DMA channel is not assigned to a DMA register
  10360.                set, DMA for that channel will be mapped through the current
  10361.                register set.
  10362.  
  10363.  
  10364.           CALLING PARAMETERS
  10365.  
  10366.                AX = 5B06h
  10367.                    Contains the Enable DMA on Alternate Map Register Set
  10368.                    subfunction.
  10369.  
  10370.                BL = DMA register set number
  10371.                    Contains the number of the alternate map register set to
  10372.                    be used for DMA operations on the DMA channel specified
  10373.                    by DL.  If the alternate map register set specified is
  10374.                    zero, no special action will be taken on DMA accesses
  10375.                    for the DMA channel specified.
  10376.  
  10377.                DL = DMA channel number
  10378.                    Contains the DMA channel which is to be associated with
  10379.                    the DMA map register set specified in BL.
  10380.  
  10381.  
  10382.           REGISTERS MODIFIED
  10383.  
  10384.                AX
  10385.  
  10386.  
  10387.  
  10388.  
  10389.           EMM Functions                                                 170
  10390.  
  10391.  
  10392.  
  10393.  
  10394.  
  10395.           Function 28. Alternate Map Register Set
  10396.           Enable DMA on Alternate Map Register Set subfunction
  10397.  
  10398.  
  10399.  
  10400.           STATUS
  10401.  
  10402.                AH = 0   SUCCESSFUL.
  10403.                    The manager has enabled DMA on the DMA register set and
  10404.                    the DMA channel specified.
  10405.  
  10406.                AH = 80h   NON-RECOVERABLE.
  10407.                    The manager detected a malfunction in the memory manager
  10408.                    software.
  10409.  
  10410.                AH = 81h   NON-RECOVERABLE.
  10411.                    The manager detected a malfunction in the expanded
  10412.                    memory hardware.
  10413.  
  10414.                AH = 84h   NON-RECOVERABLE.
  10415.                    The function code passed to the memory manager is not
  10416.                    defined.
  10417.  
  10418.                AH = 8Fh   NON-RECOVERABLE.
  10419.                    The subfunction parameter is invalid.
  10420.  
  10421.                AH = 9Ah   NON-RECOVERABLE.
  10422.                    Alternate DMA register sets are supported, but the
  10423.                    alternate DMA register set specified is not supported.
  10424.  
  10425.                AH = 9Ch   NON-RECOVERABLE.
  10426.                    Alternate DMA register sets are not supported, and the
  10427.                    DMA register set specified is not zero.
  10428.  
  10429.                AH = 9Dh   NON-RECOVERABLE.
  10430.                    DMA register sets are supported, but the DMA register
  10431.                    set specified is either not defined or not allocated.
  10432.  
  10433.                AH = 9Eh   NON-RECOVERABLE.
  10434.                    Dedicated DMA channels are not supported.
  10435.  
  10436.                AH = 9Fh   NON-RECOVERABLE.
  10437.                    Dedicated DMA channels are supported, but the DMA
  10438.                    channel specified is not supported.
  10439.  
  10440.                AH = A4h   NON-RECOVERABLE.
  10441.                    The operating system has denied access to this function. 
  10442.                    The function cannot be used at this time.
  10443.  
  10444.  
  10445.  
  10446.  
  10447.  
  10448.           EMM Functions                                                 171
  10449.  
  10450.  
  10451.  
  10452.  
  10453.  
  10454.           Function 28. Alternate Map Register Set
  10455.           Enable DMA on Alternate Map Register Set subfunction
  10456.  
  10457.  
  10458.  
  10459.           EXAMPLE
  10460.  
  10461.           alt_map_reg_set                DB ?
  10462.           DMA_channel_num                DB ?
  10463.  
  10464.           MOV   BL,alt_map_reg_set
  10465.           MOV   DL,DMA_channel_num
  10466.           MOV   AX,5B06h                 ; load function code
  10467.           INT   67h                      ; call the memory manager
  10468.           OR    AH,AH                    ; check EMM status
  10469.           JNZ   emm_err_handler          ; jump to error handler on error
  10470.  
  10471.  
  10472.  
  10473.  
  10474.  
  10475.  
  10476.  
  10477.  
  10478.  
  10479.  
  10480.  
  10481.  
  10482.  
  10483.  
  10484.  
  10485.  
  10486.  
  10487.  
  10488.  
  10489.  
  10490.  
  10491.  
  10492.  
  10493.  
  10494.  
  10495.  
  10496.  
  10497.  
  10498.  
  10499.  
  10500.  
  10501.  
  10502.  
  10503.  
  10504.  
  10505.  
  10506.  
  10507.           EMM Functions                                                 172
  10508.  
  10509.  
  10510.  
  10511.  
  10512.  
  10513.           Function 28. Alternate Map Register Set
  10514.           Disable DMA on Alternate Map Register Set subfunction
  10515.  
  10516.  
  10517.  
  10518.           Note............................................................
  10519.                This function is for use by operating systems only.  The
  10520.                operating system can disable this function at any time. 
  10521.                Refer to Function 30 for a description of how an operating
  10522.                system can enable or disable this function.
  10523.  
  10524.  
  10525.           PURPOSE
  10526.  
  10527.                This subfunction disables DMA accesses for all DMA channels
  10528.                which were associated with a specific alternate map register
  10529.                set.
  10530.  
  10531.  
  10532.           CALLING PARAMETERS
  10533.  
  10534.                AX = 5B07h
  10535.                    Contains the Disable DMA on Alternate Map Register Set
  10536.                    subfunction.
  10537.  
  10538.                BL = alternate register set number
  10539.                    Contains the number of the DMA register set for which
  10540.                    all operations are to be disabled.  If the alternate map
  10541.                    register set specified is zero, no action will be taken.
  10542.  
  10543.  
  10544.           REGISTERS MODIFIED
  10545.  
  10546.                AX
  10547.  
  10548.  
  10549.           STATUS
  10550.  
  10551.                AH = 0   SUCCESSFUL.
  10552.                    The manager has disabled DMA operations on the alternate
  10553.                    DMA register set.
  10554.  
  10555.                AH = 80h   NON-RECOVERABLE.
  10556.                    The manager detected a malfunction in the memory manager
  10557.                    software.
  10558.  
  10559.                AH = 81h   NON-RECOVERABLE.
  10560.                    The manager detected a malfunction in the expanded
  10561.                    memory hardware.
  10562.  
  10563.  
  10564.  
  10565.  
  10566.           EMM Functions                                                 173
  10567.  
  10568.  
  10569.  
  10570.  
  10571.  
  10572.           Function 28. Alternate Map Register Set
  10573.           Disable DMA on Alternate Map Register Set subfunction
  10574.  
  10575.  
  10576.  
  10577.                AH = 84h   NON-RECOVERABLE.
  10578.                    The function code passed to the memory manager is not
  10579.                    defined.
  10580.  
  10581.                AH = 8Fh   NON-RECOVERABLE.
  10582.                    The subfunction parameter is invalid.
  10583.  
  10584.                AH = 9Ah   NON-RECOVERABLE.
  10585.                    Alternate DMA register sets are supported, but the
  10586.                    alternate DMA register set specified is not supported.
  10587.  
  10588.                AH = 9Ch   NON-RECOVERABLE.
  10589.                    Alternate DMA register sets are not supported, and the
  10590.                    DMA register set specified is not zero.
  10591.  
  10592.                AH = 9Dh   NON-RECOVERABLE.
  10593.                    DMA register sets are supported, but the DMA register
  10594.                    set specified is either not defined or not allocated.
  10595.  
  10596.                AH = 9Eh   NON-RECOVERABLE.
  10597.                    Dedicated DMA channels are not supported.
  10598.  
  10599.                AH = 9Fh   NON-RECOVERABLE.
  10600.                    Dedicated DMA channels are supported, but the DMA
  10601.                    channel specified is not supported.
  10602.  
  10603.                AH = A4h   NON-RECOVERABLE.
  10604.                    The operating system has denied access to this function. 
  10605.                    The function cannot be used at this time.
  10606.  
  10607.  
  10608.           EXAMPLE
  10609.  
  10610.           DMA_reg_set                    DB ?
  10611.  
  10612.           MOV   BL,DMA_reg_set
  10613.           MOV   AX,5B07h                 ; load function code
  10614.           INT   67h                      ; call the memory manager
  10615.           OR    AH,AH                    ; check EMM status
  10616.           JNZ   emm_err_handler          ; jump to error handler on error
  10617.  
  10618.  
  10619.  
  10620.  
  10621.  
  10622.  
  10623.  
  10624.  
  10625.           EMM Functions                                                 174
  10626.  
  10627.  
  10628.  
  10629.  
  10630.  
  10631.           Function 28. Alternate Map Register Set
  10632.           Deallocate DMA Register Set subfunction
  10633.  
  10634.  
  10635.  
  10636.           Note............................................................
  10637.                This function is for use by operating systems only.  The
  10638.                operating system can disable this function at any time. 
  10639.                Refer to Function 30 for a description of how an operating
  10640.                system can enable or disable this function.
  10641.  
  10642.  
  10643.           PURPOSE
  10644.  
  10645.                The Deallocate DMA Register Set subfunction deallocates the
  10646.                specified DMA register set.
  10647.  
  10648.  
  10649.           CALLING PARAMETERS
  10650.  
  10651.                AX = 5B08h
  10652.                    Contains the Deallocate DMA Register Set subfunction.
  10653.  
  10654.                BL = DMA register set number
  10655.                    Contains the number of the DMA register set which should
  10656.                    not be used for DMA operations any longer.  The DMA
  10657.                    register set would have been previously allocated and
  10658.                    enabled for DMA operations on a specific DMA channel. 
  10659.                    If the DMA register set specified is zero, no action
  10660.                    will be taken.
  10661.  
  10662.  
  10663.           REGISTERS MODIFIED
  10664.  
  10665.                AX
  10666.  
  10667.  
  10668.           STATUS
  10669.  
  10670.                AH = 0   SUCCESSFUL.
  10671.                    The manager has deallocated the DMA register set.
  10672.  
  10673.                AH = 80h   NON-RECOVERABLE.
  10674.                    The manager detected a malfunction in the memory manager
  10675.                    software.
  10676.  
  10677.                AH = 81h   NON-RECOVERABLE.
  10678.                    The manager detected a malfunction in the expanded
  10679.                    memory hardware.
  10680.  
  10681.  
  10682.  
  10683.  
  10684.           EMM Functions                                                 175
  10685.  
  10686.  
  10687.  
  10688.  
  10689.  
  10690.           Function 28. Alternate Map Register Set
  10691.           Deallocate DMA on Alternate Map Register Set subfunction
  10692.  
  10693.  
  10694.  
  10695.                AH = 84h   NON-RECOVERABLE.
  10696.                    The function code passed to the memory manager is not
  10697.                    defined.
  10698.  
  10699.                AH = 8Fh   NON-RECOVERABLE.
  10700.                    The subfunction parameter is invalid.
  10701.  
  10702.                AH = 9Ch   NON-RECOVERABLE.
  10703.                    DMA register sets are not supported, and the DMA
  10704.                    register set specified is not zero.
  10705.  
  10706.                AH = 9Dh   NON-RECOVERABLE.
  10707.                    DMA register sets are supported, but the DMA register
  10708.                    set specified is either not defined or not allocated.
  10709.  
  10710.                AH = A4h   NON-RECOVERABLE.
  10711.                    The operating system has denied access to this function. 
  10712.                    The function cannot be used at this time.
  10713.  
  10714.  
  10715.           EXAMPLE
  10716.  
  10717.           DMA_reg_set_num                DB ?
  10718.  
  10719.           MOV   BL,DMA_reg_set_num
  10720.           MOV   AX,5B08h                 ; load function code
  10721.           INT   67h                      ; call the memory manager
  10722.           OR    AH,AH                    ; check EMM status
  10723.           JNZ   emm_err_handler          ; jump to error handler on error
  10724.  
  10725.  
  10726.  
  10727.  
  10728.  
  10729.  
  10730.  
  10731.  
  10732.  
  10733.  
  10734.  
  10735.  
  10736.  
  10737.  
  10738.  
  10739.  
  10740.  
  10741.  
  10742.  
  10743.           EMM Functions                                                 176
  10744.  
  10745.  
  10746.  
  10747.  
  10748.  
  10749.           Function 29. Prepare Expanded Memory Hardware For Warm Boot
  10750.  
  10751.  
  10752.  
  10753.           PURPOSE
  10754.  
  10755.                This function prepares the expanded memory hardware for an
  10756.                impending warm boot.  This function assumes that the next
  10757.                operation that the operating system performs is a warm boot
  10758.                of the system.  In general, this function will effect the
  10759.                current mapping context, the alternate register set in use,
  10760.                and any other expanded memory hardware dependencies which
  10761.                need to be initialized at boot time.  If an application
  10762.                decides to map memory below 640K, the application must trap
  10763.                all possible conditions leading to a warm boot and invoke
  10764.                this function before performing the warm boot itself.
  10765.  
  10766.  
  10767.           CALLING PARAMETERS
  10768.  
  10769.                AH = 5Ch
  10770.                    Contains the Prepare Expanded Memory Hardware for Warm
  10771.                    Boot function.
  10772.  
  10773.  
  10774.           REGISTERS MODIFIED
  10775.  
  10776.                AX
  10777.  
  10778.  
  10779.           STATUS
  10780.  
  10781.                AH = 0   SUCCESSFUL.
  10782.                    The manager has prepared the expanded memory hardware
  10783.                    for a warm boot.
  10784.  
  10785.                AH = 80h   NON-RECOVERABLE.
  10786.                    The manager detected a malfunction in the memory manager
  10787.                    software.
  10788.  
  10789.                AH = 81h   NON-RECOVERABLE.
  10790.                    The manager detected a malfunction in the expanded
  10791.                    memory hardware.
  10792.  
  10793.                AH = 84h   NON-RECOVERABLE.
  10794.                    The function code passed to the memory manager is not
  10795.                    defined.
  10796.  
  10797.  
  10798.  
  10799.  
  10800.  
  10801.  
  10802.           EMM Functions                                                 177
  10803.  
  10804.  
  10805.  
  10806.  
  10807.  
  10808.           Function 29. Prepare Expanded Memory Hardware for Warm Boot
  10809.  
  10810.  
  10811.  
  10812.           EXAMPLE
  10813.  
  10814.           MOV   AH,5Ch                   ; load function code
  10815.           INT   67h                      ; call the memory manager
  10816.           OR    AH,AH                    ; check EMM status
  10817.           JNZ   emm_err_handler          ; jump to error handler on error
  10818.  
  10819.  
  10820.  
  10821.  
  10822.  
  10823.  
  10824.  
  10825.  
  10826.  
  10827.  
  10828.  
  10829.  
  10830.  
  10831.  
  10832.  
  10833.  
  10834.  
  10835.  
  10836.  
  10837.  
  10838.  
  10839.  
  10840.  
  10841.  
  10842.  
  10843.  
  10844.  
  10845.  
  10846.  
  10847.  
  10848.  
  10849.  
  10850.  
  10851.  
  10852.  
  10853.  
  10854.  
  10855.  
  10856.  
  10857.  
  10858.  
  10859.  
  10860.  
  10861.           EMM Functions                                                 178
  10862.  
  10863.  
  10864.  
  10865.  
  10866.  
  10867.           Function 30. Enable/Disable OS/E Function Set Functions
  10868.           Enable OS/E Function Set subfunction
  10869.  
  10870.  
  10871.  
  10872.           Note............................................................
  10873.                This function is for use by operating systems only.  The
  10874.                operating system can disable this function at any time.
  10875.  
  10876.  
  10877.           PURPOSE
  10878.  
  10879.                This subfunction provides an OS/E with the ability to enable
  10880.                all programs or device drivers to use the OS/E specific
  10881.                functions.  The capability is provided only for an OS/E
  10882.                which manages regions of mappable conventional memory and
  10883.                cannot permit programs to use any of the functions which
  10884.                affect mappable conventional memory regions, but must be
  10885.                able to use these functions itself.  When an OS/E disables
  10886.                these functions and a program attempts to use them, the
  10887.                memory manager returns a status to the program indicating
  10888.                that the OS/E has denied the program access to the function. 
  10889.                In other words, the functions will not work when disabled. 
  10890.                However, all programs may use them when enabled.
  10891.  
  10892.                The OS/E (Operating System/Environment) functions this
  10893.                subfunction enables are:
  10894.  
  10895.                Function 26.  Get Expanded Memory Hardware Information.
  10896.                Function 28.  Alternate Map Register Sets.
  10897.                Function 30.  Enable/Disable Operating System Functions.
  10898.  
  10899.                It appears contradictory that the OS/E can re-enable these
  10900.                functions when the function which re-enables them is itself
  10901.                disabled.  An overview of the process follows.
  10902.  
  10903.                The memory manager enables all the OS/E specific functions,
  10904.                including this one, when it is loaded.  The OS/E gets
  10905.                exclusive access to these functions by invoking either of
  10906.                the Enable/Disable OS/E Function Set subfunctions before any
  10907.                other software does.
  10908.  
  10909.                On the first invocation of either of these subfunctions, the
  10910.                memory manager returns an access_key which the OS/E must use
  10911.                in all future invocations of either of these subfunctions. 
  10912.                The memory manager does not require the access_key on the
  10913.                first invocation of the Enable/Disable OS/E Function Set
  10914.                subfunctions.
  10915.  
  10916.  
  10917.  
  10918.  
  10919.  
  10920.           EMM Functions                                                 179
  10921.  
  10922.  
  10923.  
  10924.  
  10925.  
  10926.           Function 30. Enable/Disable OS/E Function Set Functions
  10927.           Enable OS/E Function Set subfunction
  10928.  
  10929.  
  10930.  
  10931.                On all subsequent invocations, the access_key is required
  10932.                for either the Enable or Disable OS/E Function Set subfunc-
  10933.                tions.  Since the access_key is returned only on the first
  10934.                invocation of the Enable/Disable OS/E Function Set subfunc-
  10935.                tions, and presumably the OS/E is the first software to
  10936.                invoke this function, only the OS/E obtains a copy of this
  10937.                key.  The memory manager must return an access key with a
  10938.                random value, a fixed value key defeats the purpose of
  10939.                providing this level of security for an OS/E.
  10940.  
  10941.  
  10942.           CALLING PARAMETERS
  10943.  
  10944.                AX = 5D00h
  10945.                    Contains the Enable OS/E Function Set subfunction.
  10946.  
  10947.                BX,CX = access_key
  10948.                    Required on all function invocations after the first. 
  10949.                    The access_key value returned by the first function
  10950.                    invocation is required.
  10951.  
  10952.  
  10953.           RESULTS
  10954.  
  10955.                These results are valid only if the status returned is zero.
  10956.  
  10957.                BX,CX = access_key
  10958.                    Returned only on the first function invocation, the
  10959.                    memory manager returns a random valued key which will be
  10960.                    required thereafter for the execution of this function. 
  10961.                    On all invocations after the first, this key is not
  10962.                    returned.  Neither BX nor CX is affected after the first
  10963.                    time this function is invoked.
  10964.  
  10965.  
  10966.           REGISTERS MODIFIED
  10967.  
  10968.                AX, BX, CX
  10969.  
  10970.  
  10971.           STATUS
  10972.  
  10973.                AH = 0   SUCCESSFUL.
  10974.                    The operating system function set has been enabled.
  10975.  
  10976.  
  10977.  
  10978.  
  10979.           EMM Functions                                                 180
  10980.  
  10981.  
  10982.  
  10983.  
  10984.  
  10985.           Function 30. Enable/Disable OS/E Function Set Functions
  10986.           Enable OS/E Function Set subfunction
  10987.  
  10988.  
  10989.  
  10990.                AH = 80h   NON-RECOVERABLE.
  10991.                    The manager detected a malfunction in the memory manager
  10992.                    software.
  10993.  
  10994.                AH = 81h   NON-RECOVERABLE.
  10995.                    The manager detected a malfunction in the expanded
  10996.                    memory hardware.
  10997.  
  10998.                AH = 84h   NON-RECOVERABLE.
  10999.                    The function code passed to the memory manager is not
  11000.                    defined.
  11001.  
  11002.                AH = 8Fh   NON-RECOVERABLE.
  11003.                    The subfunction parameter is invalid.
  11004.  
  11005.                AH = A4h   NON-RECOVERABLE.
  11006.                    The operating system has denied access to this function. 
  11007.                    The function cannot be used at this time.  The value of
  11008.                    the key which was passed to this function does not
  11009.                    entitle the program to execute this function.
  11010.  
  11011.  
  11012.           EXAMPLE
  11013.  
  11014.           First invocation
  11015.  
  11016.           access_key                     DW 2 DUP (?)
  11017.  
  11018.           MOV   AX,5D00h                 ; load function code
  11019.           INT   67h                      ; call the memory manager
  11020.           OR    AH,AH                    ; check EMM status
  11021.           JNZ   emm_err_handler          ; jump to error handler on error
  11022.           MOV   access_key[0],BX
  11023.           MOV   access_key[2],CX
  11024.  
  11025.  
  11026.           All invocations after the first
  11027.  
  11028.           access_key                     DW 2 DUP (?)
  11029.  
  11030.           MOV   BX,access_key[0]
  11031.           MOV   CX,access_key[2]
  11032.           MOV   AX,5D00h                 ; load function code
  11033.           INT   67h                      ; call the memory manager
  11034.           OR    AH,AH                    ; check EMM status
  11035.           JNZ   emm_err_handler          ; jump to error handler on error
  11036.  
  11037.  
  11038.           EMM Functions                                                 181
  11039.  
  11040.  
  11041.  
  11042.  
  11043.  
  11044.           Function 30. Enable/Disable OS/E Function Set Functions
  11045.           Disable OS/E Function Set subfunction
  11046.  
  11047.  
  11048.  
  11049.           Note............................................................
  11050.                This function is for use by operating systems only.  The
  11051.                operating system can disable this function at any time.
  11052.  
  11053.  
  11054.           PURPOSE
  11055.  
  11056.                This subfunction provides an OS/E with the ability to
  11057.                disable all programs or device drivers from using the OS/E
  11058.                specific functions.  The capability is provided only for an
  11059.                OS/E which manages regions of mappable conventional memory
  11060.                and cannot permit programs to use any of the functions which
  11061.                would affect mappable conventional memory regions.  When an
  11062.                OS/E disables these functions and a program attempts to use
  11063.                them, the memory manager returns a status to the program
  11064.                indicating that the OS/E has denied the program access to
  11065.                the function.  In other words, the functions will not work
  11066.                when disabled.
  11067.  
  11068.                The OS/E (Operating System) functions which are disabled by
  11069.                this subfunction are:
  11070.  
  11071.                Function 26.  Get Expanded Memory Hardware Information.
  11072.                Function 28.  Alternate Map Register Sets.
  11073.                Function 30.  Enable/Disable Operating System Functions.
  11074.  
  11075.  
  11076.           CALLING PARAMETERS
  11077.  
  11078.                AX = 5D01h
  11079.                    Contains the Disable OS/E Function Set subfunction.
  11080.  
  11081.                BX,CX = access_key
  11082.                    Required on all function invocations after the first. 
  11083.                    The access_key value returned by the first function
  11084.                    invocation is required.
  11085.  
  11086.  
  11087.  
  11088.  
  11089.  
  11090.  
  11091.  
  11092.  
  11093.  
  11094.  
  11095.  
  11096.  
  11097.           EMM Functions                                                 182
  11098.  
  11099.  
  11100.  
  11101.  
  11102.  
  11103.           Function 30. Enable/Disable OS/E Function Set Functions
  11104.           Disable OS/E Function Set subfunction
  11105.  
  11106.  
  11107.  
  11108.           RESULTS
  11109.  
  11110.                These results are valid only if the status returned is zero.
  11111.  
  11112.                BX,CX = access_key
  11113.                    Returned only on the first function invocation, the
  11114.                    memory manager returns a random valued key which will be
  11115.                    required thereafter for the execution of this function. 
  11116.                    On all invocations after the first, this key is not
  11117.                    returned.  Neither BX nor CX is affected after the first
  11118.                    time this function is invoked.
  11119.  
  11120.  
  11121.           REGISTERS MODIFIED
  11122.  
  11123.                AX, BX, CX
  11124.  
  11125.  
  11126.           STATUS
  11127.  
  11128.                AH = 0   SUCCESSFUL.
  11129.                    The operating system function set has been disabled.
  11130.  
  11131.                AH = 80h   NON-RECOVERABLE.
  11132.                    The manager detected a malfunction in the memory manager
  11133.                    software.
  11134.  
  11135.                AH = 81h   NON-RECOVERABLE.
  11136.                    The manager detected a malfunction in the expanded
  11137.                    memory hardware.
  11138.  
  11139.                AH = 84h   NON-RECOVERABLE.
  11140.                    The function code passed to the memory manager is not
  11141.                    defined.
  11142.  
  11143.                AH = 8Fh   NON-RECOVERABLE.
  11144.                    The subfunction parameter is invalid.
  11145.  
  11146.                AH = A4h   NON-RECOVERABLE.
  11147.                    The operating system has denied access to this function. 
  11148.                    The function cannot be used at this time.  The value of
  11149.                    the key which was passed to this function does not
  11150.                    entitle the program to execute this function.
  11151.  
  11152.  
  11153.  
  11154.  
  11155.  
  11156.           EMM Functions                                                 183
  11157.  
  11158.  
  11159.  
  11160.  
  11161.  
  11162.           Function 30. Enable/Disable OS/E Function Set Functions
  11163.           Disable OS/E Function Set subfunction
  11164.  
  11165.  
  11166.  
  11167.           EXAMPLE
  11168.  
  11169.           First Function invocation
  11170.  
  11171.           access_key                     DW 2 DUP (?)
  11172.  
  11173.           MOV   AX,5D01h                 ; load function code
  11174.           INT   67h                      ; call the memory manager
  11175.           OR    AH,AH                    ; check EMM status
  11176.           JNZ   emm_err_handler          ; jump to error handler on error
  11177.           MOV   access_key[0],BX
  11178.           MOV   access_key[2],CX
  11179.  
  11180.  
  11181.           All invocations after the first
  11182.  
  11183.           access_key                     DW 2 DUP (?)
  11184.  
  11185.           MOV   BX,access_key[0]
  11186.           MOV   CX,access_key[2]
  11187.           MOV   AX,5D01h                 ; load function code
  11188.           INT   67h                      ; call the memory manager
  11189.           OR    AH,AH                    ; check EMM status
  11190.           JNZ   emm_err_handler          ; jump to error handler on error
  11191.  
  11192.  
  11193.  
  11194.  
  11195.  
  11196.  
  11197.  
  11198.  
  11199.  
  11200.  
  11201.  
  11202.  
  11203.  
  11204.  
  11205.  
  11206.  
  11207.  
  11208.  
  11209.  
  11210.  
  11211.  
  11212.  
  11213.  
  11214.  
  11215.           EMM Functions                                                 184
  11216.  
  11217.  
  11218.  
  11219.  
  11220.  
  11221.           Function 30. Enable/Disable OS/E Function Set Functions
  11222.           Return Access Key subfunction
  11223.  
  11224.  
  11225.  
  11226.           Note............................................................
  11227.                This function is for use by operating systems only.  The
  11228.                operating system can disable this function at any time.
  11229.  
  11230.  
  11231.           PURPOSE
  11232.  
  11233.                This subfunction provides an OS/E with the ability to return
  11234.                the access key to the memory manager.  Returning the access
  11235.                key to the memory manager places the memory manager in the
  11236.                state it is in at installation time (regarding the use of
  11237.                the OS/E function set and the access key).  That is, access
  11238.                to the OS/E function set is enabled.  Upon execution of the
  11239.                next enable/disable OS/E function set subfunction, the
  11240.                access key will once again be returned.
  11241.  
  11242.  
  11243.           CALLING PARAMETERS
  11244.  
  11245.                AX = 5D02h
  11246.                    Contains the Return Access Key subfunction.
  11247.  
  11248.                BX,CX = access_key
  11249.                    Required on all function invocations.  The access_key
  11250.                    value returned by the first function invocation of the
  11251.                    enable or disable subfunctions is required.
  11252.  
  11253.  
  11254.           REGISTERS MODIFIED
  11255.  
  11256.                AX
  11257.  
  11258.  
  11259.           STATUS
  11260.  
  11261.                AH = 0   SUCCESSFUL.
  11262.                    The access key has been returned to the memory manager.
  11263.  
  11264.                AH = 80h   NON-RECOVERABLE.
  11265.                    The manager detected a malfunction in the memory manager
  11266.                    software.
  11267.  
  11268.                AH = 81h   NON-RECOVERABLE.
  11269.                    The manager detected a malfunction in the expanded
  11270.                    memory hardware.
  11271.  
  11272.  
  11273.  
  11274.           EMM Functions                                                 185
  11275.  
  11276.  
  11277.  
  11278.  
  11279.  
  11280.           Function 30. Enable/Disable OS/E Function Set Functions
  11281.           Return Access Key subfunction
  11282.  
  11283.  
  11284.  
  11285.                AH = 84h   NON-RECOVERABLE.
  11286.                    The function code passed to the memory manager is not
  11287.                    defined.
  11288.  
  11289.                AH = 8Fh   NON-RECOVERABLE.
  11290.                    The subfunction parameter is invalid.
  11291.  
  11292.                AH = A4h   NON-RECOVERABLE.
  11293.                    The operating system has denied access to this function. 
  11294.                    The function cannot be used at this time.  The value of
  11295.                    the key which was passed to this function does not
  11296.                    entitle the program to execute this function.
  11297.  
  11298.  
  11299.           EXAMPLE
  11300.  
  11301.           access_key                     DW 2 DUP (?)
  11302.  
  11303.           MOV   BX,access_key[0]
  11304.           MOV   CX,access_key[2]
  11305.           MOV   AX,5D02h                 ; load function code
  11306.           INT   67h                      ; call the memory manager
  11307.           OR    AH,AH                    ; check EMM status
  11308.           JNZ   emm_err_handler          ; jump to error handler on error
  11309.  
  11310.  
  11311.  
  11312.  
  11313.  
  11314.  
  11315.  
  11316.  
  11317.  
  11318.  
  11319.  
  11320.  
  11321.  
  11322.  
  11323.  
  11324.  
  11325.  
  11326.  
  11327.  
  11328.  
  11329.  
  11330.  
  11331.  
  11332.  
  11333.           EMM Functions                                                 186
  11334.  
  11335.  
  11336.  
  11337.  
  11338.  
  11339.           Appendix A
  11340.           FUNCTION AND STATUS CODE CROSS REFERENCE TABLES
  11341.  
  11342.  
  11343.  
  11344.                This appendix contains two cross reference tables:  one
  11345.                lists the function codes and the status codes they return;
  11346.                the other lists the status codes and the functions that
  11347.                return them.
  11348.  
  11349.  
  11350.           Table A-1.  Function and Status Code Cross Reference
  11351.           ----------------------------------------------------------------
  11352.  
  11353.           Function        Status                 Description
  11354.  
  11355.           ----------------------------------------------------------------
  11356.  
  11357.              40h    00h, 80h, 81h, 84h   Get Memory Manager Status
  11358.  
  11359.              41h    00h, 80h, 81h, 84h   Get Page Frame Segment Address
  11360.  
  11361.              42h    00h, 80h, 81h, 84h   Get Unallocated Page Count
  11362.  
  11363.              43h    00h, 80h, 81h, 84h   Allocate Pages
  11364.                     85h, 87h, 88h, 89h
  11365.  
  11366.              44h    00h, 80h, 81h, 83h   Map/Unmap Handle Page
  11367.                     84h, 8Ah, 8Bh
  11368.  
  11369.              45h    00h, 80h, 81h, 83h   Deallocate Pages
  11370.                     84h, 86h
  11371.  
  11372.              46h    00h, 80h, 81h, 84h   Get EMM Version
  11373.  
  11374.              47h    00h, 80h, 81h, 83h   Save Page Map
  11375.                     84h, 8Ch, 8Dh
  11376.  
  11377.              48h    00h, 80h, 81h, 83h   Restore Page Map
  11378.                     84h, 8Eh
  11379.  
  11380.              49h                         Reserved
  11381.  
  11382.              4Ah                         Reserved
  11383.  
  11384.              4Bh    00h, 80h, 81h, 84h   Get EMM Handle Count
  11385.  
  11386.              4Ch    00h, 80h, 81h, 83h   Get EMM Handle Pages
  11387.                     84h
  11388.  
  11389.              4Dh    00h, 80h, 81h, 84h   Get All EMM Handle Pages
  11390.  
  11391.  
  11392.           Cross Reference Tables                                        187
  11393.  
  11394.  
  11395.  
  11396.  
  11397.  
  11398.           Table A-1.  Function and Status Code Cross Reference (continued)
  11399.           ----------------------------------------------------------------
  11400.  
  11401.           Function        Status                 Description
  11402.  
  11403.           ----------------------------------------------------------------
  11404.  
  11405.            4E00h    00h, 80h, 81h, 84h   Get Page Map
  11406.                     8Fh
  11407.  
  11408.            4E01h    00h, 80h, 81h, 84h   Set Page Map
  11409.                     8Fh, A3h
  11410.  
  11411.            4E02h    00h, 80h, 81h, 84h   Get & Set Page Map
  11412.                     8Fh, A3h
  11413.  
  11414.            4E03h    00h, 80h, 81h, 84h   Get Size of Page Map Save Array
  11415.                     8Fh
  11416.  
  11417.            4F00h    00h, 80h, 81h, 84h   Get Partial Page Map
  11418.                     8Bh, 8Fh, A3h
  11419.  
  11420.            4F01h    00h, 80h, 81h, 84h   Set Partial Page Map
  11421.                     8Fh, A3h
  11422.  
  11423.            4F02h    00h, 80h, 81h, 84h   Get Size of Partial Page Map Array
  11424.                     8Bh, 8Fh
  11425.  
  11426.            5000h    00h, 80h, 81h, 83h   Map/Unmap Multiple Handle Pages
  11427.                     84h, 8Ah, 8Bh, 8Fh   (physical page number mode)
  11428.  
  11429.            5001h    00h, 80h, 81h, 83h   Map/Unmap Multiple Handle Pages
  11430.                     84h, 8Ah, 8Bh, 8Fh   (segment address mode)
  11431.  
  11432.              51h    00h, 80h, 81h, 83h   Reallocate Pages
  11433.                     84h, 87h, 88h
  11434.  
  11435.            5200h    00h, 80h, 81h, 83h   Get Handle Attribute
  11436.                     84h, 8Fh, 91h
  11437.  
  11438.            5201h    00h, 80h, 81h, 83h   Set Handle Attribute
  11439.                     84h, 8Fh, 90h, 91h
  11440.  
  11441.            5202h    00h, 80h, 81h, 84h   Get Handle Attribute Capability
  11442.                     8Fh
  11443.  
  11444.            5300h    00h, 80h, 81h, 83h   Get Handle Name
  11445.                     84h, 8Fh
  11446.  
  11447.            5301h    00h, 80h, 81h, 83h   Set Handle Name
  11448.                     84h, 8Fh, A1h
  11449.  
  11450.  
  11451.           Cross Reference Tables                                        188
  11452.  
  11453.  
  11454.  
  11455.  
  11456.  
  11457.           Table A-1.  Function and Status Code Cross Reference (continued)
  11458.           ----------------------------------------------------------------
  11459.  
  11460.           Function        Status                 Description
  11461.  
  11462.           ----------------------------------------------------------------
  11463.  
  11464.            5400h    00h, 80h, 81h, 84h   Get Handle Directory
  11465.                     8Fh
  11466.  
  11467.            5401h    00h, 80h, 81h, 84h   Search for Named Handle
  11468.                     8Fh, A0h, A1h
  11469.  
  11470.            5402h    00h, 80h, 81h, 84h   Get Total Handles
  11471.                     8Fh
  11472.  
  11473.            5500h    00h, 80h, 81h, 83h   Alter Page Map & Jump (Physical   
  11474.                     84h, 8Ah, 8Bh, 8Fh   page mode)
  11475.  
  11476.            5501h    00h, 80h, 81h, 83h   Alter Page Map & Jump (Segment    
  11477.                     84h, 8Ah, 8Bh, 8Fh   address mode)
  11478.  
  11479.            5600h    00h, 80h, 81h, 83h   Alter Page Map & Call (Physical   
  11480.                     84h, 8Ah, 8Bh, 8Fh   page mode)
  11481.  
  11482.            5601h    00h, 80h, 81h, 83h   Alter Page Map & Call (Segment    
  11483.                     84h, 8Ah, 8Bh, 8Fh   address mode)
  11484.  
  11485.            5602h    00h, 80h, 81h, 84h   Get Alter Page Map & Call Stack   
  11486.                     8Fh                  Space Size
  11487.  
  11488.            5700h    00h, 80h, 81h, 83h   Move Memory Region
  11489.                     84h, 8Ah, 8Fh, 92h
  11490.                     93h, 94h, 95h, 96h
  11491.                     98h, A2h
  11492.  
  11493.            5701h    00h, 80h, 81h, 83h   Exchange Memory Region
  11494.                     84h, 8Ah, 8Fh, 93h
  11495.                     94h, 95h, 96h, 97h
  11496.                     98h, A2h
  11497.  
  11498.            5800h    00h, 80h, 81h, 84h   Get Mappable Physical Address     
  11499.                     8Fh                  Array
  11500.  
  11501.            5801h    00h, 80h, 81h, 84h   Get Mappable Physical Address     
  11502.                     8Fh                  Array Entries
  11503.  
  11504.            5900h    00h, 80h, 81h, 84h   Get Expanded Memory Hardware      
  11505.                     8Fh, A4h             Information
  11506.  
  11507.            5901h    00h, 80h, 81h, 84h   Get Unallocated Raw Page Count
  11508.                     8Fh
  11509.  
  11510.           Cross Reference Tables                                        189
  11511.  
  11512.  
  11513.  
  11514.  
  11515.  
  11516.           Table A-1.  Function and Status Code Cross Reference (continued)
  11517.           ----------------------------------------------------------------
  11518.  
  11519.           Function        Status                 Description
  11520.  
  11521.           ----------------------------------------------------------------
  11522.  
  11523.            5A00h    00h, 80h, 81h, 84h   Allocate Standard Pages
  11524.                     85h, 87h, 88h, 8Fh
  11525.  
  11526.            5A01h    00h, 80h, 81h, 84h   Allocate Raw Pages
  11527.                     85h, 87h, 88h, 8Fh
  11528.  
  11529.            5B00h    00h, 80h, 81h, 84h   Get Alternate Map Register Set
  11530.                     8Fh, A4h
  11531.  
  11532.            5B01h    00h, 80h, 81h, 84h   Set Alternate Map Register Set
  11533.                     8Fh, 9Ah, 9Ch, 9Dh
  11534.                     A3h, A4h
  11535.  
  11536.            5B02h    00h, 80h, 81h, 84h   Get Alternate Map Save Array Size
  11537.                     8Fh, A4h
  11538.  
  11539.            5B03h    00h, 80h, 81h, 84h   Allocate Alternate Map Register   
  11540.                     8Fh, 9Bh, A4h        Set
  11541.  
  11542.            5B04h    00h, 80h, 81h, 84h   Deallocate Alternate Map Register 
  11543.                     8Fh, 9Ch, 9Dh, A4h   Set
  11544.  
  11545.            5B05h    00h, 80h, 81h, 84h   Allocate DMA Register Set
  11546.                     8Fh, 9Bh, A4h
  11547.  
  11548.            5B06h    00h, 80h, 81h, 84h   Enable DMA on Alternate Map       
  11549.                     8Fh, 9Ah, 9Ch, 9Dh   Register Set
  11550.                     9Eh, 9Fh, A4h
  11551.  
  11552.            5B07h    00h, 80h, 81h, 84h   Disable DMA on Alternate Map      
  11553.                     8Fh, 9Ah, 9Ch, 9Dh   Register Set
  11554.                     9Eh, 9Fh, A4h
  11555.  
  11556.            5B08h    00h, 80h, 81h, 84h   Deallocate DMA Register Set
  11557.                     8Fh, 9Ch, 9Dh, A4h
  11558.  
  11559.              5Ch    00h, 80h, 81h, 84h   Prepare Expanded Memory Hardware
  11560.                                          for Warmboot
  11561.  
  11562.            5D00h    00h, 80h, 81h, 84h   Enable Operating System Function  
  11563.                     8Fh, A4h             Set
  11564.  
  11565.            5D01h    00h, 80h, 81h, 84h   Disable Operating System Function 
  11566.                     8Fh, A4h             Set
  11567.  
  11568.  
  11569.           Cross Reference Tables                                        190
  11570.  
  11571.  
  11572.  
  11573.  
  11574.  
  11575.           Table A-1.  Function and Status Code Cross Reference (continued)
  11576.           ----------------------------------------------------------------
  11577.  
  11578.           Function        Status                 Description
  11579.  
  11580.           ----------------------------------------------------------------
  11581.  
  11582.            5D02h    00h, 80h, 81h, 84h   Return Operating System Access Key
  11583.                     8Fh, A4h
  11584.           ----------------------------------------------------------------
  11585.  
  11586.  
  11587.  
  11588.  
  11589.  
  11590.  
  11591.  
  11592.  
  11593.  
  11594.  
  11595.  
  11596.  
  11597.  
  11598.  
  11599.  
  11600.  
  11601.  
  11602.  
  11603.  
  11604.  
  11605.  
  11606.  
  11607.  
  11608.  
  11609.  
  11610.  
  11611.  
  11612.  
  11613.  
  11614.  
  11615.  
  11616.  
  11617.  
  11618.  
  11619.  
  11620.  
  11621.  
  11622.  
  11623.  
  11624.  
  11625.  
  11626.  
  11627.  
  11628.           Cross Reference Tables                                        191
  11629.  
  11630.  
  11631.  
  11632.  
  11633.  
  11634.           Table A-2.  Status and Function Code Cross Reference
  11635.           ----------------------------------------------------------------
  11636.  
  11637.           Status      Function                   Description
  11638.  
  11639.           ----------------------------------------------------------------
  11640.  
  11641.            00h   All                  The function completed normally.
  11642.  
  11643.            80h   All                  The memory manager has detected a
  11644.                                       malfunction in the expanded memory
  11645.                                       software.  A condition has been
  11646.                                       detected which would not have
  11647.                                       occurred if the memory manager had
  11648.                                       been operating correctly.
  11649.  
  11650.            81h   All                  The memory manager has detected a
  11651.                                       malfunction in the expanded memory
  11652.                                       hardware.  A condition has been
  11653.                                       detected which would not occur if the
  11654.                                       memory hardware were working correct-
  11655.                                       ly.  Diagnostics should be run on the
  11656.                                       expanded memory system to determine
  11657.                                       the source of the problem.
  11658.  
  11659.            82h   None                 This error code is not returned in
  11660.                                       version 3.2 of the memory manager or
  11661.                                       above.  In earlier versions of the
  11662.                                       memory manager this code meant a
  11663.                                       "busy" status.  This status indicated
  11664.                                       that the memory manager was already
  11665.                                       processing an expanded memory request
  11666.                                       when the current request was made and
  11667.                                       is unable to process another request. 
  11668.                                       In versions 3.2 of the memory manager
  11669.                                       and above, the memory manager is
  11670.                                       never "busy" and can always honor
  11671.                                       requests.
  11672.  
  11673.            83h   44h, 45h, 47h, 48h   The memory manager can not find the
  11674.                  4Ch, 5000h, 5001h    handle specified.  The program has
  11675.                  51h, 5200h, 5201h    probably corrupted its specified
  11676.                  5300h, 5301h         handle.  The memory manager does not
  11677.                  5500h, 5501h         have any information pertaining to
  11678.                  5600h, 5601h         the  specified handle.  The program
  11679.                  5700h, 5701h         has probably corrupted its handle.
  11680.  
  11681.            84h   All                  The function code passed to the
  11682.                                       manager is not currently defined. 
  11683.                                       Function codes in the range 40h
  11684.                                       through 5Dh are currently defined.
  11685.  
  11686.  
  11687.           Cross Reference Tables                                        192
  11688.  
  11689.  
  11690.  
  11691.  
  11692.  
  11693.           Table A-2.  Status and Function Code Cross Reference (continued)
  11694.           ----------------------------------------------------------------
  11695.  
  11696.           Status      Function                   Description
  11697.  
  11698.           ----------------------------------------------------------------
  11699.  
  11700.            85h   43h, 5A00h, 5A01h    No handles are currently available. 
  11701.                                       All assignable handles are currently
  11702.                                       in use.  The program may re-request
  11703.                                       the assignment of a handle in the
  11704.                                       hope that another program has
  11705.                                       released a handle.  The maximum
  11706.                                       number of handles that may be
  11707.                                       supported is 255.
  11708.  
  11709.            86h   45h                  A mapping context restoration error
  11710.                                       has been detected.  This error occurs
  11711.                                       when a program attempts to return a
  11712.                                       handle and there is still a "mapping
  11713.                                       context" on the context stack for the
  11714.                                       indicated handle.  A program can
  11715.                                       recover from this error by restoring
  11716.                                       the mapping context before returning
  11717.                                       the handle.
  11718.  
  11719.            87h   43h, 51h, 5A00h,     The number of total pages that are
  11720.                  5A01h                available in the system is insuffi-
  11721.                                       cient to honor the request.  The
  11722.                                       program can recover from this
  11723.                                       condition by requesting fewer pages.
  11724.  
  11725.            88h   43h, 51h, 5A00h,     The number of unallocated pages
  11726.                  5A01h                currently available is insufficient
  11727.                                       to honor the allocation request.  The
  11728.                                       program can recover from this
  11729.                                       condition by re-posting the request
  11730.                                       or by requesting fewer pages.
  11731.  
  11732.            89h   43h                  A Function 4 (Allocate Pages) request
  11733.                                       has been made specifying zero pages. 
  11734.                                       Zero pages cannot be assigned to a
  11735.                                       handle with Function 4 (Allocate
  11736.                                       Pages).  If it is necessary to assign
  11737.                                       zero pages to a handle, Function 27
  11738.                                       (Allocate Standard Pages and Allocate
  11739.                                       Raw Pages subfunctions) may be used.
  11740.  
  11741.  
  11742.  
  11743.  
  11744.  
  11745.  
  11746.           Cross Reference Tables                                        193
  11747.  
  11748.  
  11749.  
  11750.  
  11751.  
  11752.           Table A-2.  Status and Function Code Cross Reference (continued)
  11753.           ----------------------------------------------------------------
  11754.  
  11755.           Status      Function                   Description
  11756.  
  11757.           ----------------------------------------------------------------
  11758.  
  11759.            8Ah   44h, 5000h, 5001h    The logical page to map into memory
  11760.                  5500h, 5501h         is out of the range of logical pages
  11761.                  5600h, 5601h         which are allocated to the handle. 
  11762.                  5700h, 5701h         The program can recover from this
  11763.                                       condition by attempting to map a
  11764.                                       logical page which is within the
  11765.                                       bounds for the handle.
  11766.  
  11767.            8Bh   44h, 4F00h, 4F02h    One or more of the physical pages is
  11768.                  5000h, 5001h         out of the range of allowable
  11769.                  5600h, 5601h         physical pages.  Physical page
  11770.                  5500h, 5501          numbers are numbered zero-relative. 
  11771.                                       The program can recover from this
  11772.                                       condition by mapping at a physical
  11773.                                       page which is in the range from zero
  11774.                                       to three.
  11775.  
  11776.            8Ch   47h                  The mapping register context save
  11777.                                       area is full.  The program can
  11778.                                       recover from this condition by
  11779.                                       attempting to save the mapping
  11780.                                       registers again.
  11781.  
  11782.            8Dh   47h                  The mapping register context stack
  11783.                                       already has a context associated with
  11784.                                       the handle.  The program has at-
  11785.                                       tempted to save the mapping register
  11786.                                       context when there was already a
  11787.                                       context for the handle on the stack. 
  11788.                                       The program can recover from this
  11789.                                       condition by not attempting to save
  11790.                                       the context again (this assumes the
  11791.                                       mapping register context on the stack
  11792.                                       for the handle is correct).
  11793.  
  11794.  
  11795.  
  11796.  
  11797.  
  11798.  
  11799.  
  11800.  
  11801.  
  11802.  
  11803.  
  11804.  
  11805.           Cross Reference Tables                                        194
  11806.  
  11807.  
  11808.  
  11809.  
  11810.  
  11811.           Table A-2.  Status and Function Code Cross Reference (continued)
  11812.           ----------------------------------------------------------------
  11813.  
  11814.           Status      Function                   Description
  11815.  
  11816.           ----------------------------------------------------------------
  11817.  
  11818.            8Eh   48h                  The mapping register context stack
  11819.                                       does not have a context associated
  11820.                                       with the handle.  The program has
  11821.                                       attempted to restore the mapping
  11822.                                       register context when there was no
  11823.                                       context for the handle on the stack. 
  11824.                                       The program can recover from this
  11825.                                       condition by not attempting to
  11826.                                       restore the context again (this
  11827.                                       assumes the current mapping register
  11828.                                       context is correct).
  11829.  
  11830.            8Fh   All functions        The subfunction parameter passed to
  11831.                  requiring            the function is not defined.
  11832.                  subfunction codes
  11833.  
  11834.            90h   5201h                The attribute type is undefined.
  11835.  
  11836.            91h   5200h, 5201h         The system configuration does not
  11837.                                       support non-volatility.
  11838.  
  11839.            92h   5700h                The source and destination expanded
  11840.                                       memory regions have the same handle
  11841.                                       and overlap.  This is valid for a
  11842.                                       move.  The move has been completed
  11843.                                       and the destination region has a full
  11844.                                       copy of the source region.  However,
  11845.                                       at least a portion of the source
  11846.                                       region has been overwritten by the
  11847.                                       move.  Note that the source and
  11848.                                       destination expanded memory regions
  11849.                                       with different handles will never
  11850.                                       physically overlap because the
  11851.                                       different handles specify totally
  11852.                                       different regions of expanded memory.
  11853.  
  11854.  
  11855.  
  11856.  
  11857.  
  11858.  
  11859.  
  11860.  
  11861.  
  11862.  
  11863.  
  11864.           Cross Reference Tables                                        195
  11865.  
  11866.  
  11867.  
  11868.  
  11869.  
  11870.           Table A-2.  Status and Function Code Cross Reference (continued)
  11871.           ----------------------------------------------------------------
  11872.  
  11873.           Status      Function                   Description
  11874.  
  11875.           ----------------------------------------------------------------
  11876.  
  11877.            93h   5700h, 5701h         The length of the specified source or
  11878.                                       destination expanded memory region
  11879.                                       exceeds the length of the expanded
  11880.                                       memory region allocated to the
  11881.                                       specified source or destination
  11882.                                       handle.  There are insufficient pages
  11883.                                       allocated to this handle to move/ex-
  11884.                                       change a region of the size speci-
  11885.                                       fied.  The program can recover from
  11886.                                       this condition by attempting to
  11887.                                       allocate additional pages to the
  11888.                                       destination or source handle or by
  11889.                                       reducing the specified length. 
  11890.                                       However, if the application program
  11891.                                       has allocated as much expanded memory
  11892.                                       as it thought it needed, this may be
  11893.                                       a program error and is therefore not
  11894.                                       recoverable.
  11895.  
  11896.            94h   5700h, 5701h         The conventional memory region and
  11897.                                       expanded memory region overlap.  This
  11898.                                       is invalid, the conventional memory
  11899.                                       region cannot overlap the expanded
  11900.                                       memory region.
  11901.  
  11902.            95h   5700h, 5701h         The offset within the logical page
  11903.                                       exceeds the length of the logical
  11904.                                       page.  The initial source or destina-
  11905.                                       tion offsets within an expanded
  11906.                                       memory region must be between 0 and
  11907.                                       the (length of a logical page - 1) or
  11908.                                       16383 (3FFFh).
  11909.  
  11910.            96h   5700h, 5701h         Region length exceeds 1M-byte limit.
  11911.  
  11912.  
  11913.  
  11914.  
  11915.  
  11916.  
  11917.  
  11918.  
  11919.  
  11920.  
  11921.  
  11922.  
  11923.           Cross Reference Tables                                        196
  11924.  
  11925.  
  11926.  
  11927.  
  11928.  
  11929.           Table A-2.  Status and Function Code Cross Reference (continued)
  11930.           ----------------------------------------------------------------
  11931.  
  11932.           Status      Function                   Description
  11933.  
  11934.           ----------------------------------------------------------------
  11935.  
  11936.            97h   5701h                The source and destination expanded
  11937.                                       memory regions have the SAME handle
  11938.                                       AND overlap.  This is invalid; the
  11939.                                       source and destination expanded
  11940.                                       memory regions cannot have the same
  11941.                                       handle and overlap when they are
  11942.                                       being exchanged.  Note that the
  11943.                                       source and destination expanded
  11944.                                       memory regions with different handles
  11945.                                       will never physically overlap because
  11946.                                       the different handles specify totally
  11947.                                       different regions of expanded memory.
  11948.  
  11949.            98h   5700h, 5701h         The memory source and destination
  11950.                                       types are undefined/not supported.
  11951.  
  11952.            9Ah   5B01h, 5B06h         Alternate map register sets are
  11953.                  5B07h                supported, but the alternate map
  11954.                                       register set specified is not
  11955.                                       supported.
  11956.  
  11957.            9Bh   5B03h, 5B05h         Alternate map/DMA register sets are
  11958.                                       supported.  However, all alternate
  11959.                                       map/DMA register sets are currently
  11960.                                       allocated.
  11961.  
  11962.            9Ch   5B01h, 5B04h         Alternate map/DMA register sets are
  11963.                  5B06h, 5B07h         not supported, and the alternate
  11964.                  5B08h                map/DMA register set specified is not
  11965.                                       zero.
  11966.  
  11967.            9Dh   5B01h, 5B04h         Alternate map/DMA register sets are
  11968.                  5B06h, 5B07h         supported, but the alternate map
  11969.                  5B08h                register set specified is not
  11970.                                       defined, not allocated, or is the
  11971.                                       currently allocated map register set.
  11972.  
  11973.            9Eh   5B06h, 5B07h         Dedicated DMA channels are not
  11974.                                       supported.
  11975.  
  11976.            9Fh   5B06h, 5B07h         Dedicated DMA channels are supported. 
  11977.                                       But the DMA channel specified is not
  11978.                                       supported.
  11979.  
  11980.  
  11981.  
  11982.           Cross Reference Tables                                        197
  11983.  
  11984.  
  11985.  
  11986.  
  11987.  
  11988.           Table A-2.  Status and Function Code Cross Reference (continued)
  11989.           ----------------------------------------------------------------
  11990.  
  11991.           Status      Function                   Description
  11992.  
  11993.           ----------------------------------------------------------------
  11994.  
  11995.            A0h   5401h                No corresponding handle value could
  11996.                                       be found for the handle name speci-
  11997.                                       fied.
  11998.  
  11999.            A1h   5301h, 5401h         A handle with this name already
  12000.                                       exists.  The specified handle was not
  12001.                                       assigned a name.
  12002.  
  12003.            A2h   5700h, 5701h         An attempt was made to "wrap around"
  12004.                                       the 1M-byte address space during the
  12005.                                       move/exchange.  The source starting
  12006.                                       address together with the length of
  12007.                                       the region to be moved/exchanged
  12008.                                       exceeds 1M bytes.  No data was
  12009.                                       moved/exchanged.
  12010.  
  12011.            A3h   4E01h, 4E02h         The contents of the data structure
  12012.                  4F00h, 4F01h         passed to the function have either
  12013.                  5B01h                been corrupted or are meaningless.
  12014.  
  12015.            A4h   5900h, 5B00h         The operating system has denied
  12016.                  5B01h, 5B02h         access to this function.  The 
  12017.                  5B03h, 5B04h         function cannot be used at this time.
  12018.                  5B05h, 5B06h
  12019.                  5B07h, 5B08h
  12020.                  5D00h, 5D01h
  12021.                  5D02h
  12022.  
  12023.           ----------------------------------------------------------------
  12024.  
  12025.  
  12026.  
  12027.  
  12028.  
  12029.  
  12030.  
  12031.  
  12032.  
  12033.  
  12034.  
  12035.  
  12036.  
  12037.  
  12038.  
  12039.  
  12040.  
  12041.           Cross Reference Tables                                        198
  12042.  
  12043.  
  12044.  
  12045.  
  12046.  
  12047.           Appendix B
  12048.           TESTING FOR THE PRESENCE OF THE EXPANDED MEMORY MANAGER
  12049.  
  12050.  
  12051.  
  12052.                Before an application program can use the Expanded Memory
  12053.                Manager, it must determine whether DOS has loaded the
  12054.                manager.  This appendix describes two methods your program
  12055.                can use to test for the presence of the memory manager and
  12056.                how to choose the correct one for your situation.
  12057.  
  12058.                The first method uses the DOS "open handle" technique; the
  12059.                second method uses the DOS "get interrupt vector" technique.
  12060.  
  12061.  
  12062.           Which method should your program use?
  12063.  
  12064.                The majority of application programs can use either the
  12065.                "open handle" or the "get interrupt vector" method. 
  12066.                However, if your program is a device driver or if it
  12067.                interrupts DOS during file system operations, you must use
  12068.                only the "get interrupt vector" method.
  12069.  
  12070.                Device drivers execute from within DOS and can't access the
  12071.                DOS file system; programs that interrupt DOS during file
  12072.                system operations have a similar restriction.  During their
  12073.                interrupt processing procedures, they can't access the DOS
  12074.                file system because another program may be using the system. 
  12075.                Since the "get interrupt vector" method doesn't require the
  12076.                DOS file system, you must use it for these types of pro-
  12077.                grams.
  12078.  
  12079.  
  12080.           The "open handle" technique
  12081.  
  12082.                Most application programs can use the DOS "open handle"
  12083.                technique to test for the presence of the memory manager. 
  12084.                This section describes how to use the technique and gives an
  12085.                example.
  12086.  
  12087.           Caution.........................................................
  12088.                Don't use this technique if your program is a device driver
  12089.                or if it interrupts DOS during file system operations.  Use
  12090.                the "get interrupt vector" technique described later in this
  12091.                appendix.
  12092.  
  12093.  
  12094.           Using the "open handle" technique
  12095.  
  12096.                This section describes how to use the DOS "open handle"
  12097.                technique to test for the presence of the memory manager. 
  12098.                Follow these steps in order:
  12099.  
  12100.           Testing For The Presence Of The EMM                           199
  12101.  
  12102.  
  12103.  
  12104.  
  12105.  
  12106.                1.  Issue an "open handle" command (DOS function 3Dh) in
  12107.                    "read only" access mode (register AL = 0).  This
  12108.                    function requires your program to point to an ASCII
  12109.                    string which contains the path name of the file or
  12110.                    device in which you're interested (register set DS:DX
  12111.                    contains the pointer).  In this case the file is
  12112.                    actually the name of the memory manager.
  12113.  
  12114.                    You should format the ASCII string as follows:
  12115.  
  12116.                    ASCII_device_name  DB  'EMMXXXX0', 0
  12117.  
  12118.                    The ASCII codes for the capital letters EMMXXXX0 are
  12119.                    terminated by a byte containing a value of zero.
  12120.  
  12121.                2.  If DOS returns no error status code, skip Steps 3 and 4
  12122.                    and go to Step 5.  If DOS returns a "Too many open
  12123.                    files" error status code, go to Step 3.  If DOS returns
  12124.                    a "File/Path not found" error status code, skip Step 3
  12125.                    and go to Step 4.
  12126.  
  12127.                3.  If DOS returns a "Too many open files" (not enough
  12128.                    handles) status code, your program should invoke the
  12129.                    "open file" command before it opens any other files. 
  12130.                    This will guarantee that at least one file handle will
  12131.                    be available to perform the function without causing
  12132.                    this error.
  12133.  
  12134.                    After the program performs the "open file" command, it
  12135.                    should perform the test described in Step 6 and close
  12136.                    the "file handle" (DOS function 3Eh).  Don't keep the
  12137.                    manager "open" after this status test is performed since
  12138.                    "manager" functions are not available through DOS.  Go
  12139.                    to Step 6.
  12140.  
  12141.                4.  If DOS returns a "File/Path not found," the memory
  12142.                    manager is not installed.  If your application requires
  12143.                    the memory manager, the user will have to reboot the
  12144.                    system with a disk containing the memory manager and the
  12145.                    appropriate CONFIG.SYS file before proceeding.
  12146.  
  12147.                5.  If DOS doesn't return an error status code you can
  12148.                    assume that either a device with the name EMMXXXX0 is
  12149.                    resident in the system, or a file with this name is on
  12150.                    disk in the current disk drive.  Go to Step 6.
  12151.  
  12152.                6.  Issue an "I/O Control for Devices" command (DOS function
  12153.                    44h) with a "get device information" command (register
  12154.                    AL = 0).  DOS function 44h determines whether EMMXXXX0
  12155.                    is a device or a file.
  12156.  
  12157.  
  12158.  
  12159.           Testing For The Presence Of The EMM                           200
  12160.  
  12161.  
  12162.  
  12163.  
  12164.  
  12165.                    You must use the file handle (register BX) which you
  12166.                    obtained in Step 1 to access the "EMM" device.
  12167.  
  12168.                    This function returns the "device information" in a word
  12169.                    (register DX).  Go to Step 7.
  12170.  
  12171.                7.  If DOS returns any error status code, you should assume
  12172.                    that the memory manager device driver is not installed. 
  12173.                    If your application requires the memory manager, the
  12174.                    user will have to reboot the system with a disk contain-
  12175.                    ing the memory manager and the appropriate CONFIG.SYS
  12176.                    file before proceeding.
  12177.  
  12178.                8.  If DOS didn't return an error status, test the contents
  12179.                    of bit 7 (counting from 0) of the "device information"
  12180.                    word (register DX) the function returned.  Go to Step 9.
  12181.  
  12182.                9.  If bit 7 of the "device information" word contains a
  12183.                    zero, then EMMXXXX0 is a file, and the memory manager
  12184.                    device driver is not present.  If your application
  12185.                    requires the memory manager, the user will have to
  12186.                    reboot the system with a disk containing the memory
  12187.                    manager and the appropriate CONFIG.SYS file before
  12188.                    proceeding.
  12189.  
  12190.                    If bit 7 contains a one, then EMMXXXX0 is a device.  Go
  12191.                    to Step 10.
  12192.  
  12193.                10. Issue an "I/O Control for Devices" command (DOS function
  12194.                    44h) with a "get output status" command (register AL =
  12195.                    7).
  12196.  
  12197.                    You must use the file handle you obtained in Step 1 to
  12198.                    access the "EMM" device (register BX).  Go to Step 11.
  12199.  
  12200.                11. If the expanded memory device driver is "ready," the
  12201.                    memory manager passes a status value of "FFh" in
  12202.                    register AL.  The status value is "00h" if the device
  12203.                    driver is "not ready."
  12204.  
  12205.                    If the memory manager device driver is "not ready" and
  12206.                    your application requires its presence, the user will
  12207.                    have to reboot the system with a disk containing the
  12208.                    memory manager and the appropriate CONFIG.SYS file
  12209.                    before proceeding.
  12210.  
  12211.                    If the memory manager device driver is "ready," go to
  12212.                    Step 12.
  12213.  
  12214.  
  12215.  
  12216.  
  12217.  
  12218.           Testing For The Presence Of The EMM                           201
  12219.  
  12220.  
  12221.  
  12222.  
  12223.  
  12224.                12. Issue a "Close File Handle" command (DOS function 3Eh)
  12225.                    to close the expanded memory device driver.  You must
  12226.                    use the file handle you obtained in Step 1 to close the
  12227.                    "EMM" device (register BX).
  12228.  
  12229.  
  12230.  
  12231.  
  12232.  
  12233.  
  12234.  
  12235.  
  12236.  
  12237.  
  12238.  
  12239.  
  12240.  
  12241.  
  12242.  
  12243.  
  12244.  
  12245.  
  12246.  
  12247.  
  12248.  
  12249.  
  12250.  
  12251.  
  12252.  
  12253.  
  12254.  
  12255.  
  12256.  
  12257.  
  12258.  
  12259.  
  12260.  
  12261.  
  12262.  
  12263.  
  12264.  
  12265.  
  12266.  
  12267.  
  12268.  
  12269.  
  12270.  
  12271.  
  12272.  
  12273.  
  12274.  
  12275.  
  12276.  
  12277.           Testing For The Presence Of The EMM                           202
  12278.  
  12279.  
  12280.  
  12281.  
  12282.  
  12283.           An example of the "open handle" technique
  12284.  
  12285.                The following procedure is an example of the "open handle"
  12286.                technique outlined in the previous section.
  12287.  
  12288.           ;--------------------------------------------------------------;
  12289.           ;    The following procedure tests for the presence of the     ;
  12290.           ;    EMM in the system.  It returns the CARRY FLAG SET if      ;
  12291.           ;    the EMM is present.  If the EMM is not present, this      ;
  12292.           ;    procedure returns the CARRY FLAG CLEAR.                   ;
  12293.           ;--------------------------------------------------------------;
  12294.  
  12295.           first_test_for_EMM  PROC  NEAR
  12296.           PUSH  DS
  12297.           PUSH  CS
  12298.           POP   DS
  12299.           MOV   AX,3D00h                       ; issue "device open" in
  12300.           LEA   DX,ASCII_device_name           ; "read only" mode
  12301.           INT   21h
  12302.           JC    first_test_for_EMM_error_exit  ; test for error
  12303.                                                ; during "device open"
  12304.           MOV   BX,AX                          ; get the "file
  12305.                                                ; handle" returned by DOS
  12306.           MOV   AX,4400h                       ; issue "IOCTL
  12307.           INT   21h                            ; get device info"
  12308.           JC    first_test_for_EMM_error_exit  ; test for error
  12309.                                                ; during "get device info"
  12310.           TEST  DX,0080h                       ; test to determine
  12311.           JZ    first_test_for_EMM_error_exit  ; ASCII_device_name
  12312.                                                ; is a device or a file
  12313.           MOV   AX,4407h                       ; issue "IOCTL"
  12314.           INT   21h
  12315.           JC    first_test_for_EMM_error_exit  ; test for error
  12316.                                                ; during "IOCTL"
  12317.           PUSH  AX                             ; save "IOCTL" status
  12318.           MOV   AH,3Eh                         ; issue "close
  12319.           INT   21h                            ; file handle"
  12320.           POP   AX                             ; restore "IOCTL" status
  12321.           CMP   AL,0FFh                        ; test for "device
  12322.           JNE   first_test_for_EMM_error_exit  ; ready" status
  12323.                                                ; returned by the driver
  12324.           first_test_for_EMM_exit:
  12325.           POP   DS                             ; EMM is present
  12326.           STC                                  ; in the system
  12327.           RET
  12328.  
  12329.           first_test_for_EMM_error_exit:
  12330.           POP   DS                             ; EMM is NOT present
  12331.           CLC                                  ; in the system
  12332.           RET
  12333.           ASCII_device_name   DB  'EMMXXXX0', 0
  12334.           first_test_for_EMM  ENDP
  12335.  
  12336.           Testing For The Presence Of The EMM                           203
  12337.  
  12338.  
  12339.  
  12340.  
  12341.  
  12342.           The "get interrupt vector" technique
  12343.  
  12344.                Any type of program can use the DOS "get interrupt vector"
  12345.                technique to test for the presence of the memory manager. 
  12346.                This section describes how to use the technique and gives an
  12347.                example.
  12348.  
  12349.           Caution.........................................................
  12350.                Be sure to use this technique (and not the "open handle"
  12351.                technique) if your program is a device driver or if it
  12352.                interrupts DOS during file system operations.
  12353.  
  12354.  
  12355.           Using the "get interrupt vector" technique
  12356.  
  12357.                This section describes how to use the DOS "get interrupt
  12358.                vector" technique to test for the presence of the memory
  12359.                manager.  Follow these steps in order:
  12360.  
  12361.                1.  Issue a "get vector" command (DOS function 35h) to
  12362.                    obtain the contents of interrupt vector array entry
  12363.                    number 67h (addresses 0000:019Ch thru 0000:019Fh).
  12364.  
  12365.                    The memory manager uses this interrupt vector to perform
  12366.                    all manager functions.  The offset portion of this
  12367.                    interrupt service routine address is stored in the word
  12368.                    located at address 0000:019Ch; the segment portion is
  12369.                    stored in the word located at address 0000:019Eh.
  12370.  
  12371.                2.  Compare the "device name field" with the contents of the
  12372.                    ASCII string which starts at the address specified by
  12373.                    the segment portion of the contents of interrupt vector
  12374.                    address 67h and a fixed offset of 000Ah.  If DOS loaded
  12375.                    the memory manager at boot time this name field will
  12376.                    have the name of the device in it.
  12377.  
  12378.                    Since the memory manager is implemented as a character
  12379.                    device driver, its program origin is 0000h.  Device
  12380.                    drivers are required to have a "device header" located
  12381.                    at the program origin.  Within the "device header" is an
  12382.                    8 byte "device name field."  For a character mode device
  12383.                    driver this name field is always located at offset 000Ah
  12384.                    within the device header.  The device name field
  12385.                    contains the name of the device which DOS uses when it
  12386.                    references the device.
  12387.  
  12388.                    If the result of the "string compare" in this technique
  12389.                    is positive, the memory manager is present.
  12390.  
  12391.  
  12392.  
  12393.  
  12394.  
  12395.           Testing For The Presence Of The EMM                           204
  12396.  
  12397.  
  12398.  
  12399.  
  12400.  
  12401.           An example of the "get interrupt vector" technique
  12402.  
  12403.                The following procedure is an example of the "get interrupt
  12404.                vector" technique outlined in the previous section.
  12405.  
  12406.  
  12407.           ;--------------------------------------------------------------;
  12408.           ;    The following procedure tests for the presence of the     ;
  12409.           ;    EMM in the system.  It returns the CARRY FLAG SET if      ;
  12410.           ;    the EMM is present.  If the EMM is not present, this      ;
  12411.           ;    procedure returns the CARRY FLAG CLEAR.                   ;
  12412.           ;--------------------------------------------------------------;
  12413.  
  12414.  
  12415.           second_test_for_EMM  PROC  NEAR
  12416.           PUSH  DS
  12417.           PUSH  CS
  12418.           POP   DS
  12419.           MOV   AX,3567h                       ; issue "get interrupt
  12420.                                                ; vector"
  12421.           INT   21h
  12422.           MOV   DI,000Ah                       ; use the segment in ES
  12423.                                                ; returned by DOS, place
  12424.                                                ; the "device name field"
  12425.                                                ; OFFSET in DI
  12426.           LEA   SI,ASCII_device_name           ; place the OFFSET of the
  12427.                                                ; device name string in SI,
  12428.                                                ; the SEGMENT is already
  12429.                                                ; in DS
  12430.           MOV   CX,8                           ; compare the name strings
  12431.           CLD
  12432.           REPE  CMPSB
  12433.           JNE   second_test_for_EMM_error_exit
  12434.  
  12435.           second_test_for_EMM_exit:
  12436.           POP   DS                             ; EMM is present in
  12437.           STC                                  ; the system
  12438.           RET
  12439.  
  12440.           second_test_for_EMM_error_exit:
  12441.           POP   DS                             ; EMM is NOT present
  12442.           CLC                                  ; in the system
  12443.           RET
  12444.  
  12445.           ASCII_device_name   DB  'EMMXXXX0'
  12446.           second_test_for_EMM ENDP
  12447.  
  12448.  
  12449.  
  12450.  
  12451.  
  12452.  
  12453.  
  12454.           Testing For The Presence Of The EMM                           205
  12455.  
  12456.  
  12457.  
  12458.  
  12459.  
  12460.           Appendix C
  12461.           EXPANDED MEMORY MANAGER IMPLEMENTATION GUIDELINES
  12462.  
  12463.  
  12464.  
  12465.                In addition to the functional specification, the expanded
  12466.                memory manager should provide certain resources.  The
  12467.                following guidelines are provided so required resources are
  12468.                present in expanded memory managers which comply with this
  12469.                version of the LIM specification.
  12470.  
  12471.                o   The amount of expanded memory supported:
  12472.                    Up to a maximum of 32M bytes of expanded memory should
  12473.                    be supported.
  12474.  
  12475.                o   The number of handles supported:
  12476.                    The maximum number of expanded memory handles provided
  12477.                    should be 255, the minimum should be 64.
  12478.  
  12479.                o   Handle Numbering:
  12480.                    Although a handle is a word quantity, there is a maximum
  12481.                    of 255 handles, including the operating system handle. 
  12482.                    This specification defines the handle word as follows: 
  12483.                    the low byte of the word is the actual handle value, the
  12484.                    high byte of the handle is set to 00h by the memory
  12485.                    manager.  Previous versions of this specification did
  12486.                    not specify the value of handles.
  12487.  
  12488.                o   New handle type:  Handles versus Raw Handles:
  12489.                    The difference between a raw handle and a regular handle
  12490.                    is slight.  If you use Function 27 to "Allocate raw
  12491.                    pages to a handle," what is returned in DX is termed a
  12492.                    raw handle.  The raw handle does not necessarily refer
  12493.                    to 16K-byte pages.  Instead it refers to the "raw" page
  12494.                    size, which depends on the expanded memory hardware.
  12495.  
  12496.                    An application program can use Function 26 to find the
  12497.                    raw page size, and by using the raw handle Function 27
  12498.                    returns, it can access them with the finer resolution
  12499.                    that a particular expanded memory board may allow.
  12500.  
  12501.                    On the other hand, applications which use Function 4 to
  12502.                    "allocate pages to handle" receive a handle which always
  12503.                    refers to 16K-byte pages.  On expanded memory boards
  12504.                    with smaller raw pages, the EMM driver will allocate and
  12505.                    maintain the number of raw pages it takes to create a
  12506.                    single composite 16K-byte page.  The difference between
  12507.                    the expanded memory boards' raw page size and the 16K-
  12508.                    byte LIM page size is transparent to the application
  12509.                    when it is using a handle obtained with Function 4.
  12510.  
  12511.  
  12512.  
  12513.           EMM Implementation Guidelines                                 206
  12514.  
  12515.  
  12516.  
  12517.  
  12518.  
  12519.                    The memory manager must differentiate between pages
  12520.                    allocated to handles and pages allocated to raw handles. 
  12521.                    The meaning of a call to the driver changes depending on
  12522.                    whether a handle or a raw handle is passed to the memory
  12523.                    manager.  If, for example, a handle is passed to
  12524.                    Function 18 (Reallocate), the memory manager will
  12525.                    increase or decrease the number of 16K-byte pages
  12526.                    allocated to the handle.  If Function 18 is passed a raw
  12527.                    handle, the memory manager will increase or decrease the
  12528.                    number of raw (non-16K-byte) pages allocated to the raw
  12529.                    handle.  For LIM standard boards, there is no difference
  12530.                    between pages and raw pages.
  12531.  
  12532.                o   The system Raw Handle (Raw Handle = 0000h):
  12533.                    For expanded memory boards that can remap the memory in
  12534.                    the lower 640K-byte address space, managing the pages of
  12535.                    memory which are used to fill in the lower 640K can be a
  12536.                    problem.  To solve this problem, the memory manager will
  12537.                    create a raw handle with a value of 0000h when DOS loads
  12538.                    the manager.  This raw handle is called the system
  12539.                    handle.
  12540.  
  12541.                    At power up, the memory manager will allocate all of the
  12542.                    pages that are mapped into the lower 640K bytes to the
  12543.                    system handle.  These pages should be mapped in their
  12544.                    logical order.  For example, if the system board
  12545.                    supplies 256K bytes of RAM, and the 384K bytes above it
  12546.                    is mappable, the system handle should have its logical
  12547.                    page zero mapped into the first physical page at 256K,
  12548.                    its logical page one mapped into the next physical page,
  12549.                    and so on.
  12550.  
  12551.                    The system handle should deal with raw pages.  To
  12552.                    release some of these pages so application programs can
  12553.                    use them, an operating system could decrease the number
  12554.                    of pages allocated to the system handle with the
  12555.                    "Reallocate" function.  Invoking the "Deallocate"
  12556.                    function would decrease the system handle to zero size,
  12557.                    but it must not deallocate the raw handle itself.  The
  12558.                    "Deallocate" function treats the system handle dif-
  12559.                    ferently than it treats other raw handles.  If the
  12560.                    operating system can ever be "exited" (for example, the
  12561.                    way Windows can be exited), it must increase the size of
  12562.                    the system handle back to what is needed to fill 640K
  12563.                    and map these logical pages back into physical memory
  12564.                    before returning to DOS.
  12565.  
  12566.  
  12567.  
  12568.  
  12569.  
  12570.  
  12571.  
  12572.           EMM Implementation Guidelines                                 207
  12573.  
  12574.  
  12575.  
  12576.  
  12577.  
  12578.                    There are two functional special cases for this handle:
  12579.  
  12580.                    -   The first special case deals with Function 4
  12581.                        (Allocate Pages).  This function must never return
  12582.                        zero as a handle value.  Applications must always
  12583.                        invoke Function 4 to allocate pages and obtain a
  12584.                        handle which identifies its pages.  Since Function 4
  12585.                        will never return a handle value of zero, an
  12586.                        application will never gain access to this special
  12587.                        handle.
  12588.  
  12589.                    -   The second special case deals with Function 6
  12590.                        (Deallocate Pages).  If the operating system uses
  12591.                        Function 6 to deallocate the pages which are
  12592.                        allocated to the system handle, the pages will be
  12593.                        returned to the manager for use, but the handle will
  12594.                        not be available for reassignment.  The manager
  12595.                        should treat a "deallocate pages" function request
  12596.                        for this handle the same as a "reallocate pages"
  12597.                        function request, where the number of pages to
  12598.                        reallocate to this handle is zero.
  12599.  
  12600.                o   Terminate and Stay Resident (TSR) Program Cooperation:
  12601.                    In order for TSR's to cooperate with each other and with
  12602.                    other applications, TSR's must follow this rule:  a
  12603.                    program may only remap the DOS partition it lives in. 
  12604.                    This rule applies at all times, even when no expanded
  12605.                    memory is present.
  12606.  
  12607.                o   Accelerator Cards:
  12608.                    To support generic accelerator cards, the support of
  12609.                    Function 34, as defined by AST, is encouraged.
  12610.  
  12611.  
  12612.  
  12613.  
  12614.  
  12615.  
  12616.  
  12617.  
  12618.  
  12619.  
  12620.  
  12621.  
  12622.  
  12623.  
  12624.  
  12625.  
  12626.  
  12627.  
  12628.  
  12629.  
  12630.  
  12631.           EMM Implementation Guidelines                                 208
  12632.  
  12633.  
  12634.  
  12635.  
  12636.  
  12637.           Appendix D
  12638.           OPERATING SYSTEM/ENVIRONMENT USE OF FUNCTION 28
  12639.  
  12640.  
  12641.  
  12642.                All expanded memory boards have a set of registers that
  12643.                "remember" the logical to physical page mappings.  Some
  12644.                boards have extra (or alternate) sets of these mapping
  12645.                registers.  Because no expanded memory board can supply an
  12646.                infinite number of alternate map register sets, this
  12647.                specification provides a way to simulate them using Function
  12648.                28 (Alternate Map Register Set).
  12649.  
  12650.  
  12651.           Examples
  12652.  
  12653.                For the examples in this section, assume the hardware
  12654.                supports alternate map register sets.  First Windows is
  12655.                brought up, then "Reversi" is started.  Then control is
  12656.                switched back to the MS-DOS Executive.  For this procedure,
  12657.                here are the calls to the expanded memory manager:
  12658.  
  12659.                                       Example 1
  12660.  
  12661.           Allocate alt reg set           ; Start up the MS-DOS
  12662.           (for MS-DOS Executive)         ; Executive
  12663.  
  12664.           Set alt reg set
  12665.           (for MS-DOS Executive)
  12666.  
  12667.           Allocate alt reg set           ; Start up Reversi
  12668.           (for Reversi)
  12669.  
  12670.           Set alt reg set
  12671.           (for Reversi)
  12672.  
  12673.           Map pages
  12674.           (for Reversi)
  12675.  
  12676.           Set alt ret set                ; Switch back to MS-DOS
  12677.           (for MS-DOS Executive)         ; Executive
  12678.  
  12679.  
  12680.  
  12681.  
  12682.  
  12683.  
  12684.  
  12685.  
  12686.  
  12687.  
  12688.  
  12689.  
  12690.           Operating System Use Of Function 28                           209
  12691.  
  12692.  
  12693.  
  12694.  
  12695.  
  12696.                Notice this procedure needed no "get" calls because the
  12697.                register set contained all the information needed to save a
  12698.                context.  However, using "Get" calls would have no ill
  12699.                effects.
  12700.  
  12701.                                       Example 2
  12702.  
  12703.           Allocate alt reg set           ; Start up MS-DOS
  12704.           (for MS-DOS Executive)         ; Executive
  12705.  
  12706.           Set alt reg set
  12707.           (for MS-DOS Executive)
  12708.  
  12709.           Get alt reg set
  12710.           (for MS-DOS Executive)
  12711.  
  12712.           Allocate alt reg set           ; Start up Reversi
  12713.           (for Reversi)
  12714.  
  12715.           Set alt reg set
  12716.           (for Reversi)
  12717.  
  12718.           Map pages
  12719.           (for Reversi)
  12720.  
  12721.           Get alt reg set
  12722.           (for Reversi)
  12723.  
  12724.           Set alt reg set                ; Switch back to MS-DOS
  12725.           (for MS-DOS Executive)         ; Executive
  12726.  
  12727.                The important point to follow is that a Set must always
  12728.                precede a Get.  The model of Set then Get is the inverse of
  12729.                what interrupt handlers use, which is Get then Set (Get the
  12730.                old map context and Set the new one).  Another crucial point
  12731.                is that an alternate map register set must have the current
  12732.                mapping when allocated; otherwise, the Set will create
  12733.                chaos.
  12734.  
  12735.                What happens if this is simulated in software?  The same Set
  12736.                and Get model applies.  The main difference is where the
  12737.                context is saved.
  12738.  
  12739.  
  12740.  
  12741.  
  12742.  
  12743.  
  12744.  
  12745.  
  12746.  
  12747.  
  12748.  
  12749.           Operating System Use Of Function 28                           210
  12750.  
  12751.  
  12752.  
  12753.  
  12754.  
  12755.                Since the allocate call is dynamic and there is no limit on
  12756.                the number of sets allocated, the OS/E must supply the space
  12757.                required.  Device drivers cannot allocate space dynamically,
  12758.                since the request would fail.  If the Allocate register set
  12759.                call returns a status indicating the alternate map register
  12760.                sets aren't supported, the OS/E must allocate space for the
  12761.                context.  It must also initialize the context using Function
  12762.                15.  At that point it can do the Set, passing a pointer to
  12763.                the map context space.  On the Get call, the EMM driver is
  12764.                to return a pointer to the same context space.
  12765.  
  12766.                                       Example 3
  12767.  
  12768.           Allocate alt reg set           ; Start up MS-DOS
  12769.           (for MS-DOS Executive)         ; Executive
  12770.  
  12771.           Get Page Map
  12772.           (for MS-DOS Executive)
  12773.  
  12774.           Set alt reg set
  12775.           (for MS-DOS Executive)
  12776.  
  12777.           Allocate alt reg set           ; Start up Reversi
  12778.           (for Reversi)
  12779.  
  12780.           Set alt reg set
  12781.           (for Reversi)
  12782.  
  12783.           Map pages
  12784.           (for Reversi)
  12785.  
  12786.           Get Page Map
  12787.           (for Reversi)
  12788.  
  12789.           Set alt ret set                ; Switch back to MS-DOS
  12790.           (for MS-DOS Executive)         ; Executive
  12791.  
  12792.  
  12793.  
  12794.  
  12795.  
  12796.  
  12797.  
  12798.  
  12799.  
  12800.  
  12801.  
  12802.  
  12803.  
  12804.  
  12805.  
  12806.  
  12807.  
  12808.           Operating System Use Of Function 28                           211
  12809.  
  12810.  
  12811.  
  12812.  
  12813.  
  12814.           GLOSSARY
  12815.  
  12816.  
  12817.  
  12818.                The following terms are used frequently in this specifica-
  12819.                tion:
  12820.  
  12821.  
  12822.           Allocate                 To reserve a specified amount of
  12823.                                    expanded memory pages.
  12824.  
  12825.           Application Program      An application program is the program
  12826.                                    you write and your customer uses.  Some
  12827.                                    categories of application software are
  12828.                                    word processors, database managers,
  12829.                                    spreadsheet managers, and project
  12830.                                    managers.
  12831.  
  12832.           Conventional memory      The memory between 0 and 640K bytes,
  12833.                                    address range 00000h thru 9FFFFh.
  12834.  
  12835.           Deallocate               To return previously allocated expanded
  12836.                                    memory to the memory manager.
  12837.  
  12838.           EMM                      See Expanded Memory Manager.
  12839.  
  12840.           Expanded memory          Expanded memory is memory outside DOS's
  12841.                                    640K-byte limit (usually in the range of
  12842.                                    C0000h thru EFFFFh).
  12843.  
  12844.           Expanded Memory          A device driver that controls the
  12845.             Manager (EMM)          interface between DOS application
  12846.                                    programs and expanded memory.
  12847.  
  12848.           Extended memory          The 15M-byte address range between
  12849.                                    100000h thru FFFFFFh available on an
  12850.                                    80286 processor when it is operating in
  12851.                                    protected virtual address mode.
  12852.  
  12853.           Handle                   A value that the EMM assigns and uses to
  12854.                                    identify a block of memory requested by
  12855.                                    an application program.  All allocated
  12856.                                    logical pages are associated with a
  12857.                                    particular handle.
  12858.  
  12859.           Logical Page             The EMM allocates expanded memory in
  12860.                                    units (typically 16K bytes) called
  12861.                                    logical pages.
  12862.  
  12863.           Mappable Segment         A 16K-byte region of memory which can
  12864.                                    have a logical page mapped at it.
  12865.  
  12866.  
  12867.           Glossary                                                      212
  12868.  
  12869.  
  12870.  
  12871.  
  12872.  
  12873.           Map Registers            The set of registers containing the
  12874.                                    current mapping context of the EMM
  12875.                                    hardware.
  12876.  
  12877.           Mapping                  The process of making a logical page of
  12878.                                    memory appear at a physical page.
  12879.  
  12880.           Mapping Context          The contents of the mapping registers at
  12881.                                    a specific instant.  This context
  12882.                                    represents a map state.
  12883.  
  12884.           Page Frame               A collection of 16K-byte contiguous
  12885.                                    physical pages from which an application
  12886.                                    program accesses expanded memory.
  12887.  
  12888.           Page Frame               A page frame base address is the
  12889.             Base Address           location (in segment format) of the
  12890.                                    first byte of the page frame.
  12891.  
  12892.           Physical Page            A physical page is the range of memory
  12893.                                    addresses occupied by a single 16K-byte
  12894.                                    page.
  12895.  
  12896.           Raw Page                 The smallest unit of mappable memory
  12897.                                    that an expanded memory board can
  12898.                                    supply.
  12899.  
  12900.           Resident Application     A resident application program is loaded
  12901.             Program                by DOS, executes, and remains resident
  12902.                                    in the system after it returns control
  12903.                                    to DOS.  This type of program occupies
  12904.                                    memory and is usually invoked by the
  12905.                                    operating system, an application
  12906.                                    program, or the hardware.  Some example
  12907.                                    of resident application programs are RAM
  12908.                                    disks, print spoolers, and "pop-up"
  12909.                                    desktop programs.
  12910.  
  12911.           Status code              A code that an EMM function returns
  12912.                                    which indicates something about the
  12913.                                    result of running the function.  Some
  12914.                                    status codes indicate whether the
  12915.                                    function worked correctly and others may
  12916.                                    tell you something about the expanded
  12917.                                    memory hardware or software.
  12918.  
  12919.  
  12920.  
  12921.  
  12922.  
  12923.  
  12924.  
  12925.  
  12926.           Glossary                                                      213
  12927.  
  12928.  
  12929.  
  12930.  
  12931.  
  12932.           Transient Application    A transient application program is
  12933.             Program                loaded by DOS, executes, and doesn't
  12934.                                    remain in the system after it returns
  12935.                                    control to DOS.  After a transient
  12936.                                    application program returns control to
  12937.                                    DOS, the memory it used is available for
  12938.                                    other programs.
  12939.  
  12940.           Unmap                    To make a logical page inaccessible for
  12941.                                    reading or writing.
  12942.  
  12943.  
  12944.  
  12945.  
  12946.  
  12947.  
  12948.  
  12949.  
  12950.  
  12951.  
  12952.  
  12953.  
  12954.  
  12955.  
  12956.  
  12957.  
  12958.  
  12959.  
  12960.  
  12961.  
  12962.  
  12963.  
  12964.  
  12965.  
  12966.  
  12967.  
  12968.  
  12969.  
  12970.  
  12971.  
  12972.  
  12973.  
  12974.  
  12975.  
  12976.  
  12977.  
  12978.  
  12979.  
  12980.  
  12981.  
  12982.  
  12983.  
  12984.  
  12985.           Glossary                                                      214
  12986.  
  12987.  
  12988.  
  12989.  
  12990.  
  12991.           INDEX
  12992.  
  12993.  
  12994.  
  12995.                Allocate Alternate Map Register Set  36, 163
  12996.                Allocate DMA Register Set  36, 168, 190
  12997.                Allocate Pages  5, 14, 23, 30, 34, 42, 43, 47, 49, 144,
  12998.                    147, 148, 193, 206, 208
  12999.                Allocate Raw Pages  36, 46, 80, 89, 147-149, 190, 193,
  13000.                    206
  13001.                Allocate Standard Pages  36, 42, 46, 80, 89, 144, 145,
  13002.                    147, 190, 193
  13003.                Alter Page Map & Call  7, 10, 35, 113, 118, 189
  13004.                Alter Page Map & Jump  7, 10, 35, 109, 189
  13005.                Alternate Map  10, 36, 151, 153-155, 157-159, 161, 163,
  13006.                    164, 165-168, 170, 173, 175, 179, 182, 190, 197,
  13007.                    209, 210, 211
  13008.                Alternate Map Register Set  10, 36, 151, 153-155, 157,
  13009.                    158, 159, 161, 163-168, 170, 173, 175, 190, 197,
  13010.                    209, 210
  13011.                Alternate Mapping and Unmapping Methods  81
  13012.                Alternate Register  139, 166, 173, 177
  13013.                Data Aliasing  12
  13014.                Deallocate Alternate Map Register Set  36, 166
  13015.                Deallocate DMA Register Set  36, 175, 190
  13016.                Deallocate Pages  5, 14, 25, 31, 34, 43, 49, 88, 145,
  13017.                    148, 208
  13018.                Design Considerations  91, 151
  13019.                Device Driver  1, 15, 43, 53, 55, 144, 148, 199, 201,
  13020.                    202, 204, 212
  13021.                Disable DMA on Alternate Map Register Set  173
  13022.                Disable OS/E Function Set  36, 179, 180, 182, 185
  13023.                DMA  36, 138-140, 151, 152, 168-176, 190, 197
  13024.                DMA Channels  139, 171, 173, 174, 197
  13025.                DMA Register  36, 139, 140, 151, 152, 168-171, 173-176,
  13026.                    190, 197
  13027.                DOS  1, 12, 14, 15, 19, 21, 30, 31, 49, 53, 88, 199-205,
  13028.                    207-214
  13029.                Enable DMA on Alternate Map Register Set  170
  13030.                Enable OS/E Function Set  36, 179, 180
  13031.                Enable/Disable OS/E Function Set  179, 180, 182, 185
  13032.                Exchange Memory Region  7, 10, 35, 120, 126, 127, 189
  13033.                Expanded Memory Support of DMA  151
  13034.                Expanded Memory Support of DMA Register Sets  151
  13035.                Extended Memory  91
  13036.                Function 1  37
  13037.                Function 10  57
  13038.                Function 11  58
  13039.                Function 12  59
  13040.                Function 13  61
  13041.                Function 14  7, 63
  13042.  
  13043.  
  13044.           Index                                                         215
  13045.  
  13046.  
  13047.  
  13048.  
  13049.  
  13050.                Function 15  13, 53, 55, 65, 67, 69, 71, 73, 76, 139,
  13051.                    153, 154, 155, 158, 211
  13052.                Function 16  13, 73, 76, 78
  13053.                Function 17  6, 80, 82, 85
  13054.                Function 18  6, 43, 88, 144, 148, 207
  13055.                Function 19  7, 91, 92, 94, 96
  13056.                Function 2  4, 38
  13057.                Function 20  7, 98, 100
  13058.                Function 21  7, 42, 102, 105, 107
  13059.                Function 22  109
  13060.                Function 23  113, 118
  13061.                Function 24  7, 120, 126
  13062.                Function 25  6, 8, 46, 74, 85, 132, 136
  13063.                Function 26  138, 142, 179, 182, 206
  13064.                Function 27  42, 46, 80, 89, 144, 145, 147-149, 193, 206
  13065.                Function 28  140, 151, 153, 157, 161, 163, 164, 166,
  13066.                    168, 170, 173, 175, 179, 182, 209
  13067.                Function 29  177
  13068.                Function 3  4, 40, 142
  13069.                Function 30  138, 151, 153, 157, 161, 163, 166, 168,
  13070.                    170, 173, 175, 179, 182, 185
  13071.                Function 4  4, 42, 43, 46, 47, 49, 80, 89, 144, 145,
  13072.                    147, 149, 193, 206, 208
  13073.                Function 5  4, 46, 81
  13074.                Function 6  4, 43, 49, 88, 145, 148, 208
  13075.                Function 7  5, 51
  13076.                Function 8  46, 50, 53, 55
  13077.                Function 9  46, 50, 53, 55
  13078.                Get & Set Page Map  35, 69
  13079.                Get All Handle Pages  9, 34, 63
  13080.                Get Alternate Map Register Set  36, 153, 154, 157, 190
  13081.                Get Alternate Map Save Array Size  36, 161, 190
  13082.                Get Attribute Capability  7, 96
  13083.                Get Expanded Memory Hardware Information  10, 138, 142,
  13084.                    179, 182
  13085.                Get Handle Attribute  35, 92
  13086.                Get Handle Count  9, 34, 59
  13087.                Get Handle Directory  10, 35, 102, 105, 107
  13088.                Get Handle Name  35, 98
  13089.                Get Handle Pages  7, 9, 34, 61
  13090.                Get Hardware Configuration Array  36, 138
  13091.                Get Interrupt Vector  15, 21, 30, 199, 204, 205
  13092.                Get Mappable Physical Address Array  6, 8, 10, 35, 46,
  13093.                    85, 132, 136
  13094.                Get Mappable Physical Address Array Entries  8, 136
  13095.                Get Page Frame Address  5, 34, 38
  13096.                Get Page Map  35, 65, 118, 153-155, 158, 211
  13097.                Get Page Map Stack Space Size  35, 118
  13098.                Get Partial Page Map  35, 73, 78
  13099.                Get Size of Page Map Save Array  35, 65, 67, 71, 139
  13100.                Get Size of Partial Page Map Save Array  74, 76, 78
  13101.                Get Status  5, 34, 37
  13102.  
  13103.           Index                                                         216
  13104.  
  13105.  
  13106.  
  13107.  
  13108.  
  13109.                Get Total Handles  35, 107
  13110.                Get Unallocated Page Count  5, 22, 34, 40, 142
  13111.                Get Unallocated Raw Page Count  36, 142, 189
  13112.                Get Version  5, 34, 51
  13113.                Get/Set Handle Attribute  9, 91, 92, 94, 96
  13114.                Get/Set Handle Name  10, 98, 100
  13115.                Get/Set Page Map  9, 13, 65, 67, 69, 71
  13116.                Get/Set Partial Page Map  9, 13, 73, 76, 78
  13117.                Handle Attribute  9, 35, 91-94, 96, 188
  13118.                Handle Name  6, 7, 10, 35, 98, 100, 105, 106, 188, 198
  13119.                Intel  i, ii, 1, 5, 57, 58
  13120.                Interrupt Vector  12, 15, 21, 30, 199, 204, 205
  13121.                LIM  1, 7, 13, 19, 27, 53, 55, 138, 140, 206, 207
  13122.                Logical Page  1, 5, 12, 16, 19, 23, 28, 31, 32, 46-48,
  13123.                    80-83, 85, 86, 88, 110, 111, 115, 116, 120, 122,
  13124.                    123, 125, 126, 128, 129, 131, 147, 194, 196, 207,
  13125.                    212-214
  13126.                Logical Page/Physical Page Method  82
  13127.                Logical Page/Segment Address Method  85
  13128.                Lotus  i, ii, 1, 5, 57, 58
  13129.                Map Register  10, 13, 36, 53, 55, 151, 153-155, 157-159,
  13130.                    161, 163-168, 170, 173, 175, 179, 182, 190, 197,
  13131.                    209-211
  13132.                Map/Unmap Handle Pages  46
  13133.                Map/Unmap Multiple Handle Pages  9, 35, 80, 82, 85
  13134.                Mapping and Unmapping Multiple Pages Simultaneously  80
  13135.                Mapping Multiple Pages  6, 80
  13136.                Microsoft  i, ii, 1, 5, 14, 30, 42, 57, 58, 144, 148
  13137.                Move Memory Region  35, 120, 121, 189
  13138.                Move/Exchange Memory Region  7, 10, 120, 126
  13139.                Open Handle  64, 102, 199, 200, 203, 204
  13140.                Operating System  3, 8, 10-12, 42, 43, 59, 63, 107, 138,
  13141.                    139, 141, 142, 144-151, 153-159, 161-163, 165-171,
  13142.                    173-177, 179-183, 185, 186, 190, 191, 198, 206,
  13143.                    207-209, 213
  13144.                Page Frame  1-6, 14, 17-19, 24, 28, 31, 34, 38, 39, 47,
  13145.                    53, 55, 121, 128, 133, 187, 213
  13146.                Page Map  7, 9, 10, 13, 34, 35, 50, 53, 55, 65, 67, 69,
  13147.                    71, 73-76, 78, 109, 113, 118, 139, 153-155, 158,
  13148.                    187, 188, 189, 211
  13149.                Page Mapping Register I/O Array  57
  13150.                Page Translation Array  58
  13151.                Physical Page  1, 5, 6, 8, 10, 12, 16, 23, 28, 31, 35,
  13152.                    46, 47, 48, 80-83, 85, 109-112, 114-117, 132-134,
  13153.                    136, 138, 139, 142, 147, 188, 194, 207, 209, 213
  13154.                Prepare Expanded Memory Hardware For Warm Boot  10, 177
  13155.                Raw Handle  147, 149, 150, 206, 207
  13156.                Raw Page  36, 142, 143, 147, 189, 206
  13157.                Reallocate Pages  9, 35, 43, 88, 144, 145, 148, 208
  13158.                Restore Page Map  9, 13, 34, 50, 53, 55
  13159.                Return Access Key  185
  13160.                Save Page Map  9, 13, 34, 50, 53, 55
  13161.  
  13162.           Index                                                         217
  13163.  
  13164.  
  13165.  
  13166.  
  13167.  
  13168.                Search For Named Handle  7, 35, 105
  13169.                Set Alternate Map Register Set  36, 153-155, 157, 158,
  13170.                    163, 190
  13171.                Set Handle Attribute  9, 35, 91, 92, 94, 96
  13172.                Set Handle Name  7, 10, 35, 98, 100
  13173.                Set Page Map  9, 13, 35, 65, 67, 69, 71, 188
  13174.                Set Partial Page Map  9, 13, 35, 73, 76, 78
  13175.                Standard Handle  146
  13176.                Standard Page  147
  13177.                System DMA Capabilities  151
  13178.                TSR  12, 13, 208
  13179.                Unmapping Multiple Pages  6, 80
  13180.  
  13181.  
  13182.  
  13183.  
  13184.  
  13185.  
  13186.  
  13187.  
  13188.  
  13189.  
  13190.  
  13191.  
  13192.  
  13193.  
  13194.  
  13195.  
  13196.  
  13197.  
  13198.  
  13199.  
  13200.  
  13201.  
  13202.  
  13203.  
  13204.  
  13205.  
  13206.  
  13207.  
  13208.  
  13209.  
  13210.  
  13211.  
  13212.  
  13213.  
  13214.  
  13215.  
  13216.  
  13217.  
  13218.  
  13219.  
  13220.  
  13221.           Index                                                         218
  13222.  
  13223.