]> 4ch.mooo.com Git - 16.git/blob - 16/PCGPE10/LIMEMS41.DOC
modified: 16/DOS_GFX.EXE
[16.git] / 16 / PCGPE10 / LIMEMS41.DOC
1 \r
2 \r
3           The associated file (LIMEMS41.DOC) is a complete transcription of\r
4           the Lotus/Intel/Microsoft (LIM) Expanded Memory Specification\r
5           (EMS) Version 4.0, updated October 1987.  It can be printed by\r
6           "COPY LIMEMS41.DOC PRN:"\r
7 \r
8           I created this transcription because of the difficulty I origin-\r
9           ally had finding a copy of the document, because of the number of\r
10           people who have subsequently expressed an interest in having\r
11           access to a machine-readable copy of the specification, and,\r
12           finally, because of the annoying number of typographical errors\r
13           contained in the original and updated documents.\r
14 \r
15           This transcription is not an exact letter-for-letter duplicate of\r
16           the original document.  Some minor changes were necessitated by\r
17           the simple fact that the document's proportionally-spaced, multi-\r
18           fonted typography and line drawings did not lend themselves to\r
19           the generic fixed-spacing, single-fonted, non-graphical ASCII\r
20           transcription I wanted to produce for general dissemination.\r
21 \r
22           Other minor changes were made to correct obvious typographical\r
23           and grammatical errors, or to simply improve the visual aes-\r
24           thetics of the presented material.\r
25 \r
26           In one area, however, I simply trashed their original material\r
27           and substituted my own.  This area is the Index.  The original\r
28           document contains an Index that is little more than a reformatt-\r
29           ing of the Table of Contents.  As anyone who has ever indexed a\r
30           large document knows, it is very difficult to produce an Index\r
31           that is both complete AND easy to use.  I didn't have time to\r
32           produce one that was both, so I aimed for the former.  In fact,\r
33           the Index I have provided is more of an alphabetical listing of\r
34           key words and phrases and the pages where they are referenced,\r
35           than it is a more typical Index with its multi-level headings and\r
36           subheadings.\r
37 \r
38           You should be able obtain a printed, 3-hole-punched, 5.5 x 8.5"\r
39           copy of the original (and uncorrected) document directly from\r
40           Intel by calling their "Information Department" at 1-800-538-3373\r
41           and asking for a copy of the "LIM EMS 4.0 Developer's Kit."  It\r
42           is available free of charge and mine arrived in about two weeks. \r
43           (European availability, however, is reported to be from poor to\r
44           non-existent.)\r
45 \r
46           It is my intent to provide this transcription as a public\r
47           service.  I am, therefore, releasing it into the public domain. \r
48           The original document has also been released into the public\r
49           domain by Lotus, Intel, and Microsoft, though it remains their\r
50           copyrighted property (I'm not quite sure how they manage to do\r
51           that).\r
52 \r
53           I have tried as best I can to provide an accurate and corrected\r
54           transcription of the original document.  It is inevitable,\r
55           however, that some typographical errors have slipped through in\r
56           spite of my hours of bleary-eyed proof reading.  For these errors\r
57           I apologize and plead simple human frailty.\r
58 \r
59                THIS TRANSCRIPTION IS PROVIDED WITHOUT ANY GUARANTEES\r
60                OR WARRANTIES OF ANY KIND, AND I ASSUME ABSOLUTELY NO\r
61                LIABILITY FOR ITS ACCURACY, CONTENT, OR SUBSEQUENT USE.\r
62 \r
63           Dick Flanagan, W6OLD, Ben Lomond, California        November 1987\r
64 \f\r
65 \r
66 \r
67 \r
68 \r
69 \r
70 \r
71 \r
72 \r
73 \r
74 \r
75                            LOTUS(R)/INTEL(R)/MICROSOFT(R)\r
76 \r
77                           EXPANDED MEMORY SPECIFICATION [1]\r
78 \r
79 \r
80 \r
81 \r
82 \r
83 \r
84 \r
85 \r
86 \r
87 \r
88 \r
89 \r
90                                      Version 4.0\r
91                                      300275-005\r
92                                     October, 1987\r
93 \r
94 \r
95 \r
96 \r
97 \r
98 \r
99 \r
100 \r
101 \r
102 \r
103 \r
104 \r
105           Copyright (C) 1987\r
106 \r
107           Lotus Development Corporation\r
108           55 Cambridge Parkway\r
109           Cambridge, MA  02142\r
110 \r
111           Intel Corporation\r
112           5200 NE Elam Young Parkway\r
113           Hillsboro, OR  97124\r
114 \r
115           Microsoft Corporation\r
116           16011 NE 35th Way\r
117           Box 97017\r
118           Redmond, WA  98073\r
119 \r
120 \r
121                [1] Transcribed into machine-readable form by Dick Flanagan,\r
122           Ben Lomond, California.  This transcription is released into the\r
123           public domain without warranty or assumption of liability.\r
124 \f\r
125 \r
126 \r
127 \r
128 \r
129                This specification was jointly developed by Lotus Develop-\r
130                ment Corporation, Intel Corporation, and Microsoft Corpora-\r
131                tion.  Although it has been released into the public domain\r
132                and is not confidential or proprietary, the specification is\r
133                still the copyright and property of Lotus Development\r
134                Corporation, Intel Corporation, and Microsoft Corporation.\r
135 \r
136 \r
137           DISCLAIMER OF WARRANTY\r
138 \r
139                LOTUS DEVELOPMENT CORPORATION, INTEL CORPORATION, AND MICRO-\r
140                SOFT CORPORATION EXCLUDE ANY AND ALL IMPLIED WARRANTIES,\r
141                INCLUDING WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\r
142                PARTICULAR PURPOSE.  NEITHER LOTUS NOR INTEL NOR MICROSOFT\r
143                MAKE ANY WARRANTY OF REPRESENTATION, EITHER EXPRESS OR\r
144                IMPLIED, WITH RESPECT TO THIS SPECIFICATION, ITS QUALITY,\r
145                PERFORMANCE, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR\r
146                PURPOSE.  NEITHER LOTUS NOR INTEL NOR MICROSOFT SHALL HAVE\r
147                ANY LIABILITY FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL\r
148                DAMAGES ARISING OUT OF OR RESULTING FROM THE USE OR MODIF-\r
149                ICATION OF THIS SPECIFICATION.\r
150 \r
151 \r
152 \r
153           This specification uses the following trademarks:\r
154 \r
155           Intel is a trademark of Intel Corporation\r
156           Lotus is a trademark of Lotus Development Corporation\r
157           Microsoft is a trademark of Microsoft Corporation\r
158 \r
159 \r
160 \r
161 \r
162 \r
163 \r
164 \r
165 \r
166 \r
167 \r
168 \r
169 \r
170 \r
171 \r
172 \r
173 \r
174 \r
175 \r
176 \r
177 \r
178 \r
179 \r
180 \r
181 \r
182                                                                          ii\r
183 \f\r
184 \r
185 \r
186 \r
187 \r
188           CONTENTS\r
189 \r
190 \r
191 \r
192           Chapter 1\r
193           INTRODUCTION\r
194             What is Expanded Memory? . . . . . . . . . . . . . . . . .    1\r
195             How Expanded Memory Works  . . . . . . . . . . . . . . . .    1\r
196 \r
197           Chapter 2\r
198           WRITING PROGRAMS THAT USE EXPANDED MEMORY\r
199             What Every Program Must Do . . . . . . . . . . . . . . . .    4\r
200             Advanced Programming . . . . . . . . . . . . . . . . . . .    5\r
201               Saving The State of Mapping Hardware . . . . . . . . . .    6\r
202               Retrieving Handle and Page Counts  . . . . . . . . . . .    6\r
203               Mapping and Unmapping Multiple Pages . . . . . . . . . .    6\r
204               Reallocating Pages . . . . . . . . . . . . . . . . . . .    6\r
205               Using Handles and Assigning Names to Handles . . . . . .    6\r
206               Using Handle Attributes  . . . . . . . . . . . . . . . .    7\r
207               Altering Page Maps and Jumping/Calling . . . . . . . . .    7\r
208               Moving or Exchanging Memory Regions  . . . . . . . . . .    7\r
209               Getting the Amount of Mappable Memory  . . . . . . . . .    8\r
210               Operating System Functions . . . . . . . . . . . . . . .    8\r
211             Programming Guidelines . . . . . . . . . . . . . . . . . .   12\r
212             Examples . . . . . . . . . . . . . . . . . . . . . . . . .   14\r
213               Example 1  . . . . . . . . . . . . . . . . . . . . . . .   14\r
214               Example 2  . . . . . . . . . . . . . . . . . . . . . . .   19\r
215               Example 3  . . . . . . . . . . . . . . . . . . . . . . .   30\r
216               Example 4  . . . . . . . . . . . . . . . . . . . . . . .   32\r
217 \r
218           Chapter 3\r
219           EMM FUNCTIONS\r
220             Function 1. Get Status . . . . . . . . . . . . . . . . . .   37\r
221             Function 2. Get Page Frame Address . . . . . . . . . . . .   38\r
222             Function 3. Get Unallocated Page Count . . . . . . . . . .   40\r
223             Function 4. Allocate Pages . . . . . . . . . . . . . . . .   42\r
224             Function 5. Map/Unmap Handle Pages . . . . . . . . . . . .   46\r
225             Function 6. Deallocate Pages . . . . . . . . . . . . . . .   49\r
226             Function 7. Get Version  . . . . . . . . . . . . . . . . .   51\r
227             Function 8. Save Page Map  . . . . . . . . . . . . . . . .   53\r
228             Function 9. Restore Page Map . . . . . . . . . . . . . . .   55\r
229             Function 10. Reserved  . . . . . . . . . . . . . . . . . .   57\r
230             Function 11. Reserved  . . . . . . . . . . . . . . . . . .   58\r
231             Function 12. Get Handle Count  . . . . . . . . . . . . . .   59\r
232             Function 13. Get Handle Pages  . . . . . . . . . . . . . .   61\r
233             Function 14. Get All Handle Pages  . . . . . . . . . . . .   63\r
234             Function 15. Get/Set Page Map  . . . . . . . . . . . . . .   65\r
235               Get Page Map subfunction . . . . . . . . . . . . . . . .   65\r
236               Set Page Map subfunction . . . . . . . . . . . . . . . .   67\r
237               Get & Set Page Map subfunction . . . . . . . . . . . . .   69\r
238               Get Size of Page Map Save Array subfunction  . . . . . .   71\r
239 \r
240 \r
241                                                                         iii\r
242 \f\r
243 \r
244 \r
245 \r
246 \r
247             Function 16. Get/Set Partial Page Map  . . . . . . . . . .   73\r
248               Get Partial Page Map subfunction . . . . . . . . . . . .   73\r
249               Set Partial Page Map subfunction . . . . . . . . . . . .   76\r
250               Get Size of Partial Page Map Save Array subfunction  . .   78\r
251             Function 17. Map/Unmap Multiple Handle Pages . . . . . . .   80\r
252               Mapping Multiple Pages . . . . . . . . . . . . . . . . .   80\r
253               Unmapping Multiple Pages . . . . . . . . . . . . . . . .   80\r
254               Mapping and Unmapping Multiple Pages Simultaneously  . .   80\r
255               Alternate Mapping and Unmapping Methods  . . . . . . . .   81\r
256               Logical Page/Physical Page Method  . .OF THE EXPANDED MEMORY MANAGER\r
257             Which method should your program use?  . . . . . . . . . .  199\r
258             The "open handle" technique  . . . . . . . . . . . . . . .  199\r
259             The "get interrupt vector" technique . . . . . . . . . . .  204\r
260 \r
261           Appendix C\r
262           EXPANDED MEMORY MANAGER IMPLEMENTATION GUIDELINES\r
263             The amount of expanded memory supported  . . . . . . . . .  206\r
264             The number of handles supported  . . . . . . . . . . . . .  206\r
265             Handle Numbering . . . . . . . . . . . . . . . . . . . . .  206\r
266             New handle type:  Handles versus Raw Handles . . . . . . .  206\r
267             The system Raw Handle (Raw Handle = 0000h) . . . . . . . .  207\r
268             Terminate and Stay Resident (TSR) Program Cooperation  . .  208\r
269             Accelerator Cards  . . . . . . . . . . . . . . . . . . . .  208\r
270 \r
271           Appendix D\r
272           OPERATING SYSTEM/ENVIRONMENT USE OF FUNCTION 28\r
273             Examples . . . . . . . . . . . . . . . . . . . . . . . . .  209\r
274               Example 1  . . . . . . . . . . . . . . . . . . . . . . .  209\r
275               Example 2  . . . . . . . . . . . . . . . . . . . . . . .  210\r
276               Example 3  . . . . . . . . . . . . . . . . . . . . . . .  211\r
277 \r
278           GLOSSARY\r
279 \r
280           INDEX\r
281 \r
282 \r
283 \r
284 \r
285 \r
286 \r
287 \r
288 \r
289 \r
290 \r
291 \r
292 \r
293 \r
294 \r
295 \r
296                                                                           v\r
297 \f\r
298 \r
299 \r
300 \r
301 \r
302           Chapter 1\r
303           INTRODUCTION\r
304 \r
305 \r
306                Because even the maximum amount (640K bytes) of conventional\r
307                memory isn't always enough for large application programs,\r
308                Lotus Development Corporation, Intel Corporation, and Micro-\r
309                soft Corporation created the Lotus/Intel/Microsoft (LIM)\r
310                Expanded Memory Specification.\r
311 \r
312                The LIM Expanded Memory Specification defines the software\r
313                interface between the Expanded Memory Manager (EMM) -- a\r
314                device driver that controls and manages expanded memory --\r
315                and application programs that use expanded memory.\r
316 \r
317 \r
318           What is Expanded Memory?\r
319 \r
320                Expanded memory is memory beyond DOS's 640K-byte limit.  The\r
321                LIM specification supports up to 32M bytes of expanded\r
322                memory.  Because the 8086, 8088, and 80286 (in real mode)\r
323                microprocessors can physically address only 1M bytes of\r
324                memory, they access expanded memory through a window in\r
325                their physical address range.  The next section explains how\r
326                this is done.\r
327 \r
328 \r
329           How Expanded Memory Works\r
330 \r
331                Expanded memory is divided into segments called logical\r
332                pages.  These pages are typically 16K bytes of memory.  Your\r
333                computer accesses logical pages through a physical block of\r
334                memory called a page frame.  The page frame contains\r
335                multiple physical pages, pages that the microprocessor can\r
336                address directly.  Physical pages are also typically 16K\r
337                bytes of memory.\r
338 \r
339                This page frame serves as a window into expanded memory. \r
340                Just as your computer screen is a window into a large\r
341                spreadsheet, so the page frame is a window into expanded\r
342                memory.\r
343 \r
344                A logical page of expanded memory can be mapped into (made\r
345                to appear in) any one of the physical pages in the page\r
346                frame.  Thus, a read or write to the physical page actually\r
347                becomes a read or write to the associated logical page.  One\r
348                logical page can be mapped into the page frame for each\r
349                physical page.\r
350 \r
351                Figure 1-1 shows the relationship among the page frame,\r
352                physical pages, and logical pages.\r
353 \r
354 \r
355           Introduction                                                    1\r
356 \f\r
357 \r
358 \r
359 \r
360 \r
361                                                        32M +--------------+\r
362                                                           /|              |\r
363                                                            |              |\r
364                                                      /     |              |\r
365                                                            |              |\r
366                                                 /          |              |\r
367                                                            |              |\r
368                                            /               |              |\r
369                                                            |   Expanded   |\r
370                                       /                    |    Memory    |\r
371           1024K +--------------+                           |              |\r
372                 | / / / / / /  | /                         |              |\r
373            960K +--------------+                           |              |\r
374                 |  Page Frame  |                           |              |\r
375                 |              |                           |              |\r
376                 | 12 16K-Byte  |                           |              |\r
377                 |   Physical   |                           |              |\r
378                 |    Pages     |                           |              |\r
379            768K +--------------+                           | Divided into |\r
380                 | / / / / / /  | \                         |   logical    |\r
381            640K +--------------+                           |    pages     |\r
382                 |              |   \                       |              |\r
383                 |              |                           |              |\r
384                 |              |     \                     |              |\r
385                 |              |                           |              |\r
386                 | 24 16K-Byte  |       \                   |              |\r
387                 |   Physical   |                           |              |\r
388                 |    Pages*    |         \                 |              |\r
389                 |              |                           |              |\r
390                 |              |           \               |              |\r
391                 |              |                           |              |\r
392                 |              |             \             |              |\r
393            256K +--------------+                           |              |\r
394                 |              |               \           |              |\r
395                 | / / / / / /  |                           |              |\r
396                 |              |                 \         |              |\r
397                 | / / / / / /  |                           |              |\r
398                 |              |                   \       |              |\r
399                 | / / / / / /  |                           |              |\r
400                 |              |                     \     |              |\r
401               0 +--------------+                           |              |\r
402                                                        \   |              |\r
403                                                            |              |\r
404           *Intended for operating                        \ |              |\r
405            system/environment use only                   0 +--------------+\r
406 \r
407 \r
408 \r
409           Figure 1-1.  Expanded Memory\r
410 \r
411 \r
412 \r
413 \r
414           Introduction                                                    2\r
415 \f\r
416 \r
417 \r
418 \r
419 \r
420                The page frame is located above 640K bytes.  Normally, only\r
421                video adapters, network cards, and similar devices exist\r
422                between 640K and 1024K.\r
423 \r
424                This specification also defines methods for operating\r
425                systems and environments to access expanded memory through\r
426                physical pages below 640K bytes.  These methods are intended\r
427                for operating system/environment developers only.\r
428 \r
429 \r
430 \r
431 \r
432 \r
433 \r
434 \r
435 \r
436 \r
437 \r
438 \r
439 \r
440 \r
441 \r
442 \r
443 \r
444 \r
445 \r
446 \r
447 \r
448 \r
449 \r
450 \r
451 \r
452 \r
453 \r
454 \r
455 \r
456 \r
457 \r
458 \r
459 \r
460 \r
461 \r
462 \r
463 \r
464 \r
465 \r
466 \r
467 \r
468 \r
469 \r
470 \r
471 \r
472 \r
473           Introduction                                                    3\r
474 \f\r
475 \r
476 \r
477 \r
478 \r
479           Chapter 2\r
480           WRITING PROGRAMS THAT USE EXPANDED MEMORY\r
481 \r
482 \r
483                This chapter describes what every program must do to use\r
484                expanded memory and describes more advanced techniques of\r
485                using expanded memory.\r
486 \r
487                This chapter also lists programming guidelines you should\r
488                follow when writing programs that use expanded memory and\r
489                provides the listings of some example programs.\r
490 \r
491 \r
492           What Every Program Must Do\r
493 \r
494                This section describes the steps every program must take to\r
495                use expanded memory.\r
496 \r
497                In order to use expanded memory, applications must perform\r
498                these steps in the following order:\r
499 \r
500                1.  Determine if EMM is installed.\r
501 \r
502                2.  Determine if enough expanded memory pages exist for your\r
503                    application.  (Function 3)\r
504 \r
505                3.  Allocate expanded memory pages.  (Function 4, 18, or 27)\r
506 \r
507                4.  Get the page frame base address.  (Function 2)\r
508 \r
509                5.  Map in expanded memory pages.  (Function 5 or 17)\r
510 \r
511                6.  Read/write/execute data in expanded memory, just as if\r
512                    it were conventional memory.\r
513 \r
514                7.  Return expanded memory pages to expand memory pool\r
515                    before exiting.  (Function 6 or 18)\r
516 \r
517                Table 2-1 overviews the functions while Chapter 3 describes\r
518                each of these functions in detail.  Example programs at the\r
519                end of this chapter illustrate using expanded memory.\r
520 \r
521 \r
522 \r
523 \r
524 \r
525 \r
526 \r
527 \r
528 \r
529 \r
530 \r
531 \r
532           Writing Programs That Use Expanded Memory                       4\r
533 \f\r
534 \r
535 \r
536 \r
537 \r
538           Table 2-1.  The Basic Functions\r
539           ----------------------------------------------------------------\r
540 \r
541           Function                        Description\r
542 \r
543           ----------------------------------------------------------------\r
544 \r
545              1         The Get Status Function returns a status code\r
546                        indicating whether the memory manager hardware is\r
547                        working correctly.\r
548 \r
549              2         The Get Page Frame Address function returns the\r
550                        address where the 64K-byte page frame is located.\r
551 \r
552              3         The Get Unallocated Page Count function returns the\r
553                        number of unallocated pages (pages available to your\r
554                        program) and the total number of pages in expanded\r
555                        memory.\r
556 \r
557              4         The Allocate Pages function allocates the number of\r
558                        pages requested and assigns a unique EMM handle to\r
559                        these pages.\r
560 \r
561              5         The Map/Unmap Handle Page function maps a logical\r
562                        page to a specific physical page anywhere in the\r
563                        mappable regions of system memory.\r
564 \r
565              6         The Deallocate Pages deallocates the logical pages\r
566                        currently allocated to an EMM handle.\r
567 \r
568              7         The Get Version function returns the version number\r
569                        of the memory manager software.\r
570 \r
571           ----------------------------------------------------------------\r
572 \r
573 \r
574 \r
575           Advanced Programming\r
576 \r
577                In addition to the basic functions, the Lotus/Intel/Micro-\r
578                soft Expanded Memory Specification provides several advanced\r
579                functions which enhance the capabilities of software that\r
580                uses expanded memory.\r
581 \r
582                The following sections describe the advanced programming\r
583                capabilities and list the advanced EMM functions.\r
584 \r
585 \r
586           Note............................................................\r
587                Before using the advanced functions, programs should first\r
588                call Function 7 (Get Version) to determine whether the\r
589                installed version of EMM supports these functions.\r
590 \r
591           Writing Programs That Use Expanded Memory                       5\r
592 \f\r
593 \r
594 \r
595 \r
596 \r
597           Saving The State of Mapping Hardware\r
598 \r
599                Some software (such as interrupt service routines, device\r
600                drivers, and resident software) must save the current state\r
601                of the mapping hardware, switch mapping contexts, manipulate\r
602                sections of expanded memory, and restore the original\r
603                context of the memory mapping hardware.  Use Functions 8 and\r
604                9 or 15 and 16 to save the state of the hardware.\r
605 \r
606 \r
607           Retrieving Handle and Page Counts\r
608 \r
609                Some utility programs need to keep track of how expanded\r
610                memory is being used; use Functions 12 through 14 to do\r
611                this.\r
612 \r
613 \r
614           Mapping and Unmapping Multiple Pages\r
615 \r
616                Mapping multiple pages reduces the overhead an application\r
617                must perform during mapping.  Function 17 lets a program map\r
618                (or unmap) multiple pages at one time.\r
619 \r
620                In addition, you can map pages using segment addresses\r
621                instead of physical pages.  For example, if the page frame\r
622                base address is set to D000, you can map to either physical\r
623                page 0 or segment D000.  Function 25 (Get Mappable Physical\r
624                Address Array) returns a cross reference between all\r
625                expanded memory physical pages and their corresponding\r
626                segment values.\r
627 \r
628 \r
629           Reallocating Pages\r
630 \r
631                Reallocating pages (Function 18) lets applications dynami-\r
632                cally allocate expanded memory pages without acquiring\r
633                another handle or obtain a handle without allocating pages. \r
634                Reallocating pages is an efficient means for applications to\r
635                obtain and release expanded memory pages.\r
636 \r
637 \r
638           Using Handles and Assigning Names to Handles\r
639 \r
640                This specification lets you associate a name with a handle,\r
641                so a family of applications can share information in\r
642                expanded memory.  For example, a software package consisting\r
643                of a word processor, spreadsheet, and print spooler can\r
644                share the same data among the different applications.  The\r
645                print spooler could use a handle name to reference data that\r
646                either the spreadsheet or word processor put in expanded\r
647                memory and could check for data in a particular handle\r
648                name's expanded memory pages.\r
649 \r
650           Writing Programs That Use Expanded Memory                       6\r
651 \f\r
652 \r
653 \r
654 \r
655 \r
656                Use Function 20 (Set Handle Name subfunction) to assign a\r
657                handle name to an EMM handle or Function 21 (Search for\r
658                Named Handle subfunction) to obtain the EMM handle as-\r
659                sociated with the handle name.  In addition, you can use\r
660                Function 14 (Get Handle Pages) to determine the number of\r
661                expanded memory pages allocated to an EMM handle.\r
662 \r
663 \r
664           Using Handle Attributes\r
665 \r
666                In addition to naming a handle, you can use Function 19 to\r
667                associate an attribute (volatile or non-volatile) with a\r
668                handle name.  A non-volatile attribute enables expanded\r
669                memory pages to preserve their data through a warmboot. \r
670                With a volatile attribute, the data is not preserved.  The\r
671                default attribute for handles is volatile.\r
672 \r
673                Because using this function depends on the capabilities of\r
674                the expanded memory hardware installed in the system, you\r
675                should use the Get Attribute Capability subfunction before\r
676                attempting to assign an attribute to a handle's pages.\r
677 \r
678 \r
679           Altering Page Maps and Jumping/Calling\r
680 \r
681                You can use Functions 22 (Alter Page Map & Jump) and 23\r
682                (Alter Page Map & Call) to map a new set of values into the\r
683                map registers and transfer program control to a specified\r
684                address within expanded memory.  These functions can be used\r
685                to load and execute code in expanded memory.  An application\r
686                using this feature can significantly reduce the amount of\r
687                conventional memory it requires.  Programs can load needed\r
688                modules into expanded memory at run time and use Functions\r
689                22 and 23 to transfer control to these modules.\r
690 \r
691                Using expanded memory to store code can improve program\r
692                execution in many ways.  For example, sometimes programs\r
693                need to be divided into small overlays because of conven-\r
694                tional memory size limitations.  Overlays targeted for\r
695                expanded memory can be very large because LIM EMS 4.0\r
696                supports up to 32M bytes of expanded memory.  This method of\r
697                loading overlays improves overall system performance by\r
698                conserving conventional memory and eliminating conventional\r
699                memory allocation errors.\r
700 \r
701 \r
702           Moving or Exchanging Memory Regions\r
703 \r
704                Using Function 24 (Move/Exchange Memory Region), you can\r
705                easily move and exchange data between conventional and\r
706                expanded memory.  Function 24 can manipulate up to one\r
707                megabyte of data with one function call.  Although applica-\r
708 \r
709           Writing Programs That Use Expanded Memory                       7\r
710 \f\r
711 \r
712 \r
713 \r
714 \r
715                tions can perform this operation without this function,\r
716                having the expanded memory manager do it reduces the amount\r
717                of overhead for the application.\r
718 \r
719                In addition, this function checks for overlapping regions\r
720                and performs all the necessary mapping, preserving the\r
721                mapping context from before the exchange/move call.\r
722 \r
723 \r
724           Getting the Amount of Mappable Memory\r
725 \r
726                Function 25 enables applications to determine the total\r
727                amount of mappable memory the hardware/system currently\r
728                supports.  Not all expanded memory boards supply the same\r
729                number of physical pages (map registers).\r
730 \r
731                The Get Mappable Physical Address Array Entries subfunction\r
732                returns the total number of physical pages the expanded\r
733                memory hardware/system is capable of supporting.  The Get\r
734                Mappable Physical Array subfunction returns a cross refer-\r
735                ence between physical page numbers and the actual segment\r
736                address for each of the physical pages.\r
737 \r
738 \r
739           Operating System Functions\r
740 \r
741                In addition to the functions for application programs, this\r
742                specification defines functions for operating systems/en-\r
743                vironments.  These functions can be disabled at any time by\r
744                the operating system/environment, so programs should not\r
745                depend on their presence.  Applications that avoid this\r
746                warning and use these functions run a great risk of being\r
747                incompatible with other programs, including the operating\r
748                system.\r
749 \r
750 \r
751 \r
752 \r
753 \r
754 \r
755 \r
756 \r
757 \r
758 \r
759 \r
760 \r
761 \r
762 \r
763 \r
764 \r
765 \r
766 \r
767 \r
768           Writing Programs That Use Expanded Memory                       8\r
769 \f\r
770 \r
771 \r
772 \r
773 \r
774           Table 2-2.  The Advanced Functions\r
775           ----------------------------------------------------------------\r
776 \r
777           Function                        Description\r
778 \r
779           ----------------------------------------------------------------\r
780 \r
781              8         The Save Page Map saves the contents of the page\r
782                        mapping registers from all expanded memory boards in\r
783                        an internal save area.\r
784 \r
785              9         The Restore Page Map function restores (from an\r
786                        internal save area) the page mapping register\r
787                        contents on the expanded memory boards for a\r
788                        particular EMM handle.\r
789 \r
790              10        Reserved.\r
791 \r
792              11        Reserved.\r
793 \r
794              12        The Get Handle Count function returns the number of\r
795                        open EMM handles in the system.\r
796 \r
797              13        The Get Handle Pages function returns the number of\r
798                        pages allocated to a specific EMM handle.\r
799 \r
800              14        The Get All Handle Pages function returns an array\r
801                        of the active EMM handles and the number of pages\r
802                        allocated to each one.\r
803 \r
804              15        The Get/Set Page Map subfunction saves or restores\r
805                        the mapping context for all mappable memory regions\r
806                        (conventional and expanded) in a destination array\r
807                        which the application supplies.\r
808 \r
809              16        The Get/Set Partial Page Map subfunction provides a\r
810                        mechanism for saving a partial mapping context for\r
811                        specific mappable memory regions in a system.\r
812 \r
813              17        The Map/Unmap Multiple Handle Pages function can, in\r
814                        a single invocation, map (or unmap) logical pages\r
815                        into as many physical pages as the system supports.\r
816 \r
817              18        The Reallocate Pages function can increase or\r
818                        decrease the amount of expanded memory allocated to\r
819                        a handle.\r
820 \r
821              19        The Get/Set Handle Attribute function allows an\r
822                        application program to determine and set the\r
823                        attribute associated with a handle.\r
824 \r
825 \r
826 \r
827           Writing Programs That Use Expanded Memory                       9\r
828 \f\r
829 \r
830 \r
831 \r
832 \r
833           Table 2-2.  The Advanced Functions (continued)\r
834           ----------------------------------------------------------------\r
835 \r
836           Function                        Description\r
837 \r
838           ----------------------------------------------------------------\r
839 \r
840              20        The Get/Set Handle Name function gets the eight\r
841                        character name currently assigned to a handle and\r
842                        can assign an eight character name to a handle.\r
843 \r
844              21        The Get Handle Directory function returns informa-\r
845                        tion about active handles and the names assigned to\r
846                        each.\r
847 \r
848              22        The Alter Page Map & Jump function alters the memory\r
849                        mapping context and transfers control to the\r
850                        specified address.\r
851 \r
852              23        The Alter Page Map & Call function alters the speci-\r
853                        fied mapping context and transfers control to the\r
854                        specified address.  A return can then restore the\r
855                        context and return control to the caller.\r
856 \r
857              24        The Move/Exchange Memory Region function copies or\r
858                        exchanges a region of memory from conventional to\r
859                        conventional memory, conventional to expanded\r
860                        memory, expanded to conventional memory, or expanded\r
861                        to expanded memory.\r
862 \r
863              25        The Get Mappable Physical Address Array function\r
864                        returns an array containing the segment address and\r
865                        physical page number for each mappable physical page\r
866                        in a system.\r
867 \r
868              26        The Get Expanded Memory Hardware Information\r
869                        function returns an array containing the hardware\r
870                        capabilities of the expanded memory system.\r
871 \r
872              27        The Allocate Standard/Raw Pages function allocates\r
873                        the number of standard or non-standard size pages\r
874                        that the operating system requests and assigns a\r
875                        unique EMM handle to these pages.\r
876 \r
877              28        The Alternate Map Register Set function enables an\r
878                        application to simulate alternate sets of hardware\r
879                        mapping registers.\r
880 \r
881              29        The Prepare Expanded Memory Hardware for Warm Boot\r
882                        function prepares the expanded memory hardware for\r
883                        an "impending" warm boot.\r
884 \r
885 \r
886           Writing Programs That Use Expanded Memory                      10\r
887 \f\r
888 \r
889 \r
890 \r
891 \r
892           Table 2-2.  The Advanced Functions (continued)\r
893           ----------------------------------------------------------------\r
894 \r
895           Function                        Description\r
896 \r
897           ----------------------------------------------------------------\r
898 \r
899              30        The Enable/Disable OS/E function enables operating\r
900                        systems developers to enable and disable functions\r
901                        designed for operating system use.\r
902 \r
903           ----------------------------------------------------------------\r
904 \r
905 \r
906 \r
907 \r
908 \r
909 \r
910 \r
911 \r
912 \r
913 \r
914 \r
915 \r
916 \r
917 \r
918 \r
919 \r
920 \r
921 \r
922 \r
923 \r
924 \r
925 \r
926 \r
927 \r
928 \r
929 \r
930 \r
931 \r
932 \r
933 \r
934 \r
935 \r
936 \r
937 \r
938 \r
939 \r
940 \r
941 \r
942 \r
943 \r
944 \r
945           Writing Programs That Use Expanded Memory                      11\r
946 \f\r
947 \r
948 \r
949 \r
950 \r
951           Programming Guidelines\r
952 \r
953                The following section contains guidelines for programmers\r
954                writing applications that use EMM.\r
955 \r
956                o   Do not put a program's stack in expanded memory.\r
957 \r
958                o   Do not replace interrupt 67h.  This is the interrupt\r
959                    vector the EMM uses.  Replacing interrupt 67h could\r
960                    result in disabling the Expanded Memory Manager.\r
961 \r
962                o   Do not map into conventional memory address space your\r
963                    application doesn't own.  Applications that use the EMM\r
964                    to swap into conventional memory space, must first\r
965                    allocate this space from the operating system.  If the\r
966                    operating system is not aware that a region of memory it\r
967                    manages is in use, it will think it is available.  This\r
968                    could have disastrous results.  EMM should not be used\r
969                    to "allocate" conventional memory.  DOS is the proper\r
970                    manager of conventional memory space.  EMM should only\r
971                    be used to swap data in conventional memory space\r
972                    previously allocated from DOS.\r
973 \r
974                o   Applications that plan on using data aliasing in\r
975                    expanded memory must check for the presence of expanded\r
976                    memory hardware.  Data aliasing occurs when mapping one\r
977                    logical page into two or more mappable segments.  This\r
978                    makes one 16K-byte expanded memory page appear to be in\r
979                    more than one 16K-byte memory address space.  Data\r
980                    aliasing is legal and sometimes useful for applications.\r
981 \r
982                    Software-only expanded memory emulators cannot perform\r
983                    data aliasing.  A simple way to distinguish software\r
984                    emulators from actual expanded memory hardware is to\r
985                    attempt data aliasing and check the results.  For\r
986                    example, map one logical page into four physical pages. \r
987                    Write to physical page 0.  Read physical pages 1-3 to\r
988                    see if the data is there as well.  If the data appears\r
989                    in all four physical pages, then expanded memory\r
990                    hardware is installed in the system, and data aliasing\r
991                    is supported.\r
992 \r
993                o   Applications should always return expanded memory pages\r
994                    to the expanded memory manager upon termination.  These\r
995                    pages will be made available for other applications.  If\r
996                    unneeded pages are not returned to the expanded memory\r
997                    manager, the system could "run out" of expanded memory\r
998                    pages or expanded memory handles.\r
999 \r
1000                o   Terminate and stay resident programs (TSR's) should\r
1001                    ALWAYS save the state of the map registers before\r
1002                    changing them.  Since TSR's may interrupt other programs\r
1003 \r
1004           Writing Programs That Use Expanded Memory                      12\r
1005 \f\r
1006 \r
1007 \r
1008 \r
1009 \r
1010                    which may be using expanded memory, they must not change\r
1011                    the state of the page mapping registers without first\r
1012                    saving them.  Before exiting, TSR's must restore the\r
1013                    state of the map registers.\r
1014 \r
1015                    The following sections describe the three ways to save\r
1016                    and restore the state of the map registers.\r
1017 \r
1018                    1.  Save Page Map and Restore Page Map (Functions 8 and\r
1019                        9).  This is the simplest of the three methods.  The\r
1020                        EMM saves the map register contents in its own data\r
1021                        structures -- the application does not need to\r
1022                        provide extra storage locations for the mapping\r
1023                        context.  The last mapping context to be saved,\r
1024                        under a particular handle, will be restored when a\r
1025                        call to Restore Page Map is issued with the same\r
1026                        handle.  This method is limited to one mapping\r
1027                        context for each handle and saves the context for\r
1028                        only LIM standard 64K-byte page frames.\r
1029 \r
1030                    2.  Get/Set Page Map (Function 15).  This method\r
1031                        requires the application to allocate space for the\r
1032                        storage array.  The EMM saves the mapping context in\r
1033                        an array whose address is passed to the EMM.  When\r
1034                        restoring the mapping context with this method, an\r
1035                        application passes the address of an array which\r
1036                        contains a previously stored mapping context.\r
1037 \r
1038                        This method is preferable if an application needs to\r
1039                        do more than one save before a restore.  It provides\r
1040                        a mechanism for switching between more than one\r
1041                        mapping context.\r
1042 \r
1043                    3.  Get/Set Partial Page Map (Function 16).  This method\r
1044                        provides a way for saving a partial mapping context. \r
1045                        It should be used when the application does not need\r
1046                        to save the context of all mappable memory.  This\r
1047                        function also requires that the storage array be\r
1048                        part of the application's data.\r
1049 \r
1050                o   All functions using pointers to data structures must\r
1051                    have those data structures in memory which will not be\r
1052                    mapped out.  Functions 22 and 23 (Alter Map & Call and\r
1053                    Alter Map & Jump) are the only exceptions.\r
1054 \r
1055 \r
1056 \r
1057 \r
1058 \r
1059 \r
1060 \r
1061 \r
1062 \r
1063           Writing Programs That Use Expanded Memory                      13\r
1064 \f\r
1065 \r
1066 \r
1067 \r
1068 \r
1069           Examples\r
1070 \r
1071                This section lists four example programs that demonstrate\r
1072                the use of expanded memory.\r
1073 \r
1074 \r
1075           Example 1\r
1076 \r
1077                This program was written using the Microsoft C compiler\r
1078                Version 3.0.  EMM function calls are made with the int86\r
1079                function found in the dos.h library.  To create an ex-\r
1080                ecutable program use the following compile command line:\r
1081 \r
1082                          msc /Gs /Oat /Ml program,,program;\r
1083 \r
1084           #include <dos.h>\r
1085           #include <stdio.h>\r
1086 \r
1087           #define EMM_INT                 0x67  /* EMM interrupt number */\r
1088           #define GET_PAGE_FRAME          0x41  /* EMM get page frame */\r
1089                                                 /* function number */\r
1090           #define GET_UNALLOC_PAGE_COUNT  0x42  /* EMM get unallocated */\r
1091                                                 /* page count */\r
1092                                                 /* function number */\r
1093           #define ALLOCATE_PAGES          0x43  /* EMM allocate pages */\r
1094                                                 /* function number */\r
1095           #define MAP_PAGES               0x44  /* EMM map pages */\r
1096                                                 /* function number */\r
1097           #define DEALLOCATE_PAGES        0x45  /* EMM deallocate pages */\r
1098                                                 /* function number */\r
1099           #define DEVICE_NAME_LENGTH      8     /* length of a device */\r
1100                                                 /* name string */\r
1101           #define TRUE                    1\r
1102           #define FALSE                   0\r
1103 \r
1104           union REGS input_regs, output_regs;\r
1105           struct SREGS segment_regs;\r
1106           int pf_addr;\r
1107 \r
1108           /*------------------------------------------------------------*/\r
1109           /* Routine to convert a segment:offset pair to a far ptr.     */\r
1110           /*------------------------------------------------------------*/\r
1111           char *build_ptr (segment, offset)\r
1112 \r
1113               unsigned int segment;\r
1114               unsigned int offset;\r
1115           {\r
1116               char *ptr;\r
1117 \r
1118               ptr = (char *)(((unsigned long)segment << 16) + offset);\r
1119               return (ptr);\r
1120           }\r
1121 \r
1122           Writing Programs That Use Expanded Memory                      14\r
1123 \f\r
1124 \r
1125 \r
1126 \r
1127 \r
1128           /*------------------------------------------------------------*/\r
1129           /* Function which determines whether EMM device driver        */\r
1130           /* is installed.                                              */\r
1131           /*------------------------------------------------------------*/\r
1132           char emm_installed()\r
1133 \r
1134           {\r
1135               char *EMM_device_name = "EMMXXXX0";\r
1136               char *int_67_device_name_ptr;\r
1137 \r
1138               /*--------------------------------------------------------*/\r
1139               /* AH = DOS get interrupt vector function.                */\r
1140               /*--------------------------------------------------------*/\r
1141               input_regs.h.ah = 0x35;\r
1142 \r
1143               /*--------------------------------------------------------*/\r
1144               /* AL = EMM interrupt vector number.                      */\r
1145               /*--------------------------------------------------------*/\r
1146               input_regs.h.al = EMM_INT;\r
1147               intdosx (&input_regs, &output_regs, &segment_regs);\r
1148 \r
1149               /*--------------------------------------------------------*/\r
1150               /* Upon return ES:0Ah points to location where            */\r
1151               /* device name should be.                                 */\r
1152               /*--------------------------------------------------------*/\r
1153               int_67_device_name_ptr = build_ptr (segment_regs.es, 0x0A);\r
1154 \r
1155               /*--------------------------------------------------------*/\r
1156               /* Compare memory with EMM device name.                   */\r
1157               /*--------------------------------------------------------*/\r
1158               if (memcmp (EMM_device_name, int_67_device_name_ptr,\r
1159                                              DEVICE_NAME_LENGTH) == 0)\r
1160                   return (TRUE);\r
1161               else\r
1162                   return (FALSE);\r
1163           }\r
1164 \r
1165           /*------------------------------------------------------------*/\r
1166           /* Function which determines if there are enough unallocated  */\r
1167           /* expanded memory pages for the application.                 */\r
1168           /*------------------------------------------------------------*/\r
1169           char enough_unallocated_pages (pages_needed)\r
1170 \r
1171               int pages_needed;\r
1172           {\r
1173               input_regs.h.ah = GET_UNALLOCATED_PAGE_COUNT;\r
1174               int86 (EMM_INT, &input_regs, &output_regs);\r
1175               if (output_regs.h.ah != 0 || pages_needed > output_regs.x.bx)\r
1176                   return (FALSE);\r
1177               else\r
1178                   return (TRUE);\r
1179           }\r
1180 \r
1181           Writing Programs That Use Expanded Memory                      15\r
1182 \f\r
1183 \r
1184 \r
1185 \r
1186 \r
1187           /*------------------------------------------------------------*/\r
1188           /* Function which allocates expanded memory pages and passes  */\r
1189           /* back to the main EMM handle.                               */\r
1190           /*------------------------------------------------------------*/\r
1191           char allocate_expanded_memory_pages (pages_needed,emm_handle_ptr)\r
1192 \r
1193               int pages_needed;\r
1194               unsigned int *emm_handle_ptr;\r
1195           {\r
1196               input_regs.h.ah = ALLOCATE_PAGES;\r
1197               input_regs.x.bx = pages_needed;\r
1198               int86 (EMM_INT, &input_regs, &output_regs);\r
1199               if (output_regs.h.ah == 0) {\r
1200                   *emm_handle_ptr = output_regs.x.dx;\r
1201                   return (TRUE);\r
1202               }\r
1203               else\r
1204                   return (FALSE);\r
1205           }\r
1206 \r
1207           /*------------------------------------------------------------*/\r
1208           /* Routine to map a logical page to a physical page.          */\r
1209           /*------------------------------------------------------------*/\r
1210           char map_expanded_memory_pages (emm_handle, physical_page,       \r
1211                                                              logical_page)\r
1212               unsigned int emm_handle;\r
1213               int physical_page;\r
1214               int logical_page;\r
1215           {\r
1216               input_regs.h.ah = MAP_PAGES;\r
1217               input_regs.h.al = physical_page;\r
1218               input_regs.x.bx = logical_page;\r
1219               input_regs.x.dx = emm_handle;\r
1220               int86 (EMM_INT, &input_regs, &output_regs);\r
1221               if (output_regs.h.ah == 0)\r
1222                   return (TRUE);\r
1223               else\r
1224                   return (FALSE);\r
1225           }\r
1226 \r
1227 \r
1228 \r
1229 \r
1230 \r
1231 \r
1232 \r
1233 \r
1234 \r
1235 \r
1236 \r
1237 \r
1238 \r
1239 \r
1240           Writing Programs That Use Expanded Memory                      16\r
1241 \f\r
1242 \r
1243 \r
1244 \r
1245 \r
1246           /*------------------------------------------------------------*/\r
1247           /* Routine which gets the page frame base address from EMM.   */\r
1248           /*------------------------------------------------------------*/\r
1249           char get_page_frame_address (pf_ptr)\r
1250 \r
1251               char **pf_ptr;\r
1252           {\r
1253               input_regs.h.ah = GET_PAGE_FRAME;\r
1254               int86 (EMM_INT, &input_regs, &output_regs);\r
1255               if (output_regs.h.ah != 0)       /* check EMM status */\r
1256                   return (FALSE);\r
1257               else\r
1258                  *pf_ptr = build_ptr (output_regs.x.bx, 0);\r
1259               return (TRUE);\r
1260           }\r
1261 \r
1262           /*------------------------------------------------------------*/\r
1263           /* Routine to release all expanded memory pages allocated     */\r
1264           /* by an EMM handle.                                          */\r
1265           /*------------------------------------------------------------*/\r
1266 \r
1267           char deallocate_expanded_memory_pages (emm_handle)\r
1268 \r
1269               unsigned int emm_handle;\r
1270           {\r
1271               input_regs.h.ah = DEALLOCATE_PAGES;\r
1272               input_regs.x.dx = emm_handle;\r
1273               int86 (EMM_INT, &input_regs, &output_regs);\r
1274               if (output_regs.h.ah == 0)\r
1275                   return (TRUE);\r
1276               else\r
1277                   return (FALSE);\r
1278           }\r
1279 \r
1280           main()\r
1281 \r
1282           {\r
1283               unsigned int emm_handle;\r
1284               char *pf_addr;\r
1285               int pages_needed;\r
1286               int physical_page;\r
1287               int logical_page;\r
1288               int index;\r
1289 \r
1290               /*--------------------------------------------------------*/\r
1291               /* Determine if EMM is installed.                         */\r
1292               /*--------------------------------------------------------*/\r
1293               if (!emm_installed())\r
1294                   exit(1);\r
1295 \r
1296 \r
1297 \r
1298 \r
1299           Writing Programs That Use Expanded Memory                      17\r
1300 \f\r
1301 \r
1302 \r
1303 \r
1304 \r
1305               /*--------------------------------------------------------*/\r
1306               /* Determine if enough expanded memory pages exist for    */\r
1307               /* application.                                           */\r
1308               /*--------------------------------------------------------*/\r
1309               pages_needed = 1;\r
1310               if (!enough_unallocated_pages (pages_needed))\r
1311                   exit(1);\r
1312 \r
1313               /*--------------------------------------------------------*/\r
1314               /* Allocate expanded memory pages.                        */\r
1315               /*--------------------------------------------------------*/\r
1316               if (!allocate_expanded_memory_pages (pages_needed,\r
1317                                                              &emm_handle))\r
1318                   exit(1);\r
1319 \r
1320               /*--------------------------------------------------------*/\r
1321               /* Map in the required pages.                             */\r
1322               /*--------------------------------------------------------*/\r
1323               physical_page = 0;\r
1324               logical_page = 0;\r
1325               if (!map_expanded_memory_pages (emm_handle, physical_page,\r
1326                                                             logical_page))\r
1327                   exit(1);\r
1328 \r
1329               /*--------------------------------------------------------*/\r
1330               /* Get expanded memory page frame address.                */\r
1331               /*--------------------------------------------------------*/\r
1332               if (!get_page_frame_address (&pf_addr))\r
1333                   exit(1);\r
1334 \r
1335               /*--------------------------------------------------------*/\r
1336               /* Write to expanded memory.                              */\r
1337               /*--------------------------------------------------------*/\r
1338               for (index = 0; index < 0x3fff; index++)\r
1339                   pf_addr[index] = index;\r
1340 \r
1341               /*--------------------------------------------------------*/\r
1342               /* Return expanded memory pages before exiting.           */\r
1343               /*--------------------------------------------------------*/\r
1344               if (!deallocate_expanded_memory_pages (emm_handle))\r
1345                   exit(1);\r
1346           }\r
1347 \r
1348 \r
1349 \r
1350 \r
1351 \r
1352 \r
1353 \r
1354 \r
1355 \r
1356 \r
1357 \r
1358           Writing Programs That Use Expanded Memory                      18\r
1359 \f\r
1360 \r
1361 \r
1362 \r
1363 \r
1364           Example 2\r
1365 \r
1366           This program shows you how to use the basic functions of the LIM\r
1367           Expanded Memory Specification with Turbo Pascal.  The program\r
1368           does the following:\r
1369 \r
1370                1.  Makes sure the LIM Expanded Memory Manager (EMM) has\r
1371                    been installed.\r
1372 \r
1373                2.  Displays the version number of the EMM.\r
1374 \r
1375                3.  Determines if there are enough pages of memory for the\r
1376                    program.  It then displays the total number of EMM pages\r
1377                    present in the system and the number available for use.\r
1378 \r
1379                4.  Requests the desired number of pages from the EMM.\r
1380 \r
1381                5.  Maps a logical page into one of the physical pages.\r
1382 \r
1383                6.  Displays the base address of our EMM memory page frame. \r
1384                    Performs a simple read/write test on the EMM memory.\r
1385 \r
1386                7.  Returns the EMM memory given to us back to the EMM.\r
1387 \r
1388                8.  Exits.\r
1389 \r
1390           All the calls are structured to return the result or error code\r
1391           of the Expanded Memory function performed as an integer.  If the\r
1392           error code is not zero, an error has occurred, a simple error\r
1393           procedure is called, and the program terminates.\r
1394 \r
1395           Type\r
1396             ST3  = string[3];\r
1397             ST80 = string[80];\r
1398             ST5  = string[5];\r
1399 \r
1400             Registers = record\r
1401               case integer of\r
1402                 1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,FLAGS: Integer);\r
1403                 2: (AL,AH,BL,BH,CL,CH,DL,DH         : Byte);\r
1404               end;\r
1405 \r
1406           Const\r
1407             EMM_INT                    = $67;\r
1408             DOS_Int                    = $21;\r
1409             GET_PAGE_FRAME             = $41;\r
1410             GET_UNALLOCATED_PAGE_COUNT = $42;\r
1411             ALLOCATE_PAGES             = $43;\r
1412             MAP_PAGES                  = $44;\r
1413             DEALLOCATE_PAGES           = $45;\r
1414             GET_VERSION                = $46;\r
1415             STATUS_OK                  = 0;\r
1416 \r
1417           Writing Programs That Use Expanded Memory                      19\r
1418 \f\r
1419 \r
1420 \r
1421 \r
1422 \r
1423             {------------------------------------------------------------}\r
1424             { Assume the application needs one EMM page.                 }\r
1425             {------------------------------------------------------------}\r
1426             APPLICATION_PAGE_COUNT = 1;\r
1427 \r
1428           Var\r
1429             Regs: Registers;\r
1430 \r
1431             Emm_handle,\r
1432             Page_Frame_Base_Address,\r
1433             Pages_Needed,\r
1434             Physical_Page,\r
1435             Logical_Page,\r
1436             Offset,\r
1437             Error_Code,\r
1438             Pages_EMM_Available,\r
1439             Total_EMM_Pages,\r
1440             Available_EMM_Pages: Integer;\r
1441 \r
1442             Version_Number,\r
1443             Pages_Number_String: ST3;\r
1444 \r
1445             Verify: Boolean;\r
1446 \r
1447             {------------------------------------------------------------}\r
1448             { The function Hex_String converts an integer into a four    }\r
1449             { character hexadecimal number (string) with leading zeros.  }\r
1450             {------------------------------------------------------------}\r
1451             Function Hex_String (Number: Integer): ST5;\r
1452               Function Hex_Char (Number: Integer): Char;\r
1453                 Begin\r
1454                   If Number < 10 then\r
1455                     Hex_Char := Char (Number + 48)\r
1456                   else\r
1457                     Hex_Char := Char (Number + 55);\r
1458                 end; { Function Hex_char }\r
1459 \r
1460             Var\r
1461               S: ST5;\r
1462 \r
1463             Begin\r
1464               S := '';\r
1465               S := Hex_Char ((Number shr 1) div 2048);\r
1466               Number := (((Number shr 1) mod 2048) shl 1) + (Number and 1);\r
1467               S := S + Hex_Char (Number div 256);\r
1468               Number := Number mod 256;\r
1469               S := S + Hex_Char (Number div 16);\r
1470               Number := Number mod 16;\r
1471               S := S + Hex_Char (Number);\r
1472               Hex_String := S + 'h';\r
1473             end; { Function Hex_String }\r
1474 \r
1475 \r
1476           Writing Programs That Use Expanded Memory                      20\r
1477 \f\r
1478 \r
1479 \r
1480 \r
1481 \r
1482             {------------------------------------------------------------}\r
1483             { The function Emm_Installed checks to see if the            }\r
1484             { EMM is loaded in memory.  It does this by looking          }\r
1485             { for the string 'EMMXXXX0', which should be located         }\r
1486             { at 10 bytes from the beginning of the code segment the     }\r
1487             { EMM interrupt, 67h, points to.                             }\r
1488             {------------------------------------------------------------}\r
1489             Function Emm_Installed: Boolean;\r
1490               Var\r
1491                 Emm_Device_Name   : string[8];\r
1492                 Int_67_Device_Name: string[8];\r
1493                 Position          : integer;\r
1494                 Regs              : registers;\r
1495 \r
1496               Begin\r
1497                 Int_67_Device_Name := '';\r
1498                 Emm_Device_Name    := 'EMMXXXX0';\r
1499                 with Regs do\r
1500                   Begin\r
1501                     {----------------------------------------------------}\r
1502                     { Get the code segment interrupt 67h points to       }\r
1503                     { the EMM interrupt by using DOS function 35h.       }\r
1504                     { (get interrupt vector)                             }\r
1505                     {----------------------------------------------------}\r
1506                     AH := $35;\r
1507                     AL := EMM_INT;\r
1508                     Intr (DOS_Int, Regs);\r
1509                     {----------------------------------------------------}\r
1510                     { The ES pseudo-register contains the segment        }\r
1511                     { address pointed to by interrupt 67h.  Create an    }\r
1512                     { eight character string from the eight successive   }\r
1513                     { bytes at address ES:$000A (10 bytes from ES)       }\r
1514                     {----------------------------------------------------}\r
1515                     For Position := 0 to 7 do\r
1516                       Int_67_Device_Name :=\r
1517                         Int_67_Device_Name + Chr (mem[ES:Position + $0A]);\r
1518                     Emm_Installed := True;\r
1519                     {----------------------------------------------------}\r
1520                     { If the string is the EMM manager signature,        }\r
1521                     { 'EMMXXXX0', then EMM is installed and ready for    }\r
1522                     { use.  If not, then EMM is not present.             }\r
1523                     {----------------------------------------------------}\r
1524                     If Int_67_Device_Name <> Emm_Device_Name\r
1525                       then Emm_Installed := False;\r
1526                   end; { with Regs do }\r
1527               end; { Function Emm_Installed }\r
1528 \r
1529 \r
1530 \r
1531 \r
1532 \r
1533 \r
1534 \r
1535           Writing Programs That Use Expanded Memory                      21\r
1536 \f\r
1537 \r
1538 \r
1539 \r
1540 \r
1541             {------------------------------------------------------------}\r
1542             { This function returns the total number of EMM pages        }\r
1543             { present in the system, and the number of EMM pages that    }\r
1544             { are available.                                             }\r
1545             {------------------------------------------------------------}\r
1546             Function EMM_Pages_Available\r
1547               (Var Total_EMM_Pages, Pages_Available: Integer): Integer;\r
1548               Var\r
1549                 Regs: Registers;\r
1550 \r
1551               Begin\r
1552                 with Regs do\r
1553                   Begin\r
1554                     {----------------------------------------------------}\r
1555                     { Get the number of currently unallocated pages and  }\r
1556                     { the total number of pages in the system from EMM.  }\r
1557                     { Load pseudo-registers prior to invoking EMM.       }\r
1558                     {    AH = get unallocated page count function        }\r
1559                     {----------------------------------------------------}\r
1560                     AH := GET_UNALLOCATED_PAGE_COUNT;\r
1561                     Intr (EMM_INT, Regs);\r
1562                     {----------------------------------------------------}\r
1563                     { Unload the pseudo-registers after invoking EMM.    }\r
1564                     {    BX = currently unallocated pages                }\r
1565                     {    DX = total pages in the system                  }\r
1566                     {    AH = status                                     }\r
1567                     {----------------------------------------------------}\r
1568                     Pages_Available := BX;\r
1569                     Total_EMM_Pages := DX;\r
1570                     EMM_Pages_Available := AH;\r
1571                   end;\r
1572               end; { Function EMM_Pages_Available }\r
1573 \r
1574 \r
1575             {------------------------------------------------------------}\r
1576             { This function requests the specified number of pages       }\r
1577             { from the EMM.                                              }\r
1578             {------------------------------------------------------------}\r
1579             Function Allocate_Expanded_Memory_Pages\r
1580               (Pages_Needed: Integer; Var Handle: Integer): Integer;\r
1581               Var\r
1582                 Regs: Registers;\r
1583 \r
1584 \r
1585 \r
1586 \r
1587 \r
1588 \r
1589 \r
1590 \r
1591 \r
1592 \r
1593 \r
1594           Writing Programs That Use Expanded Memory                      22\r
1595 \f\r
1596 \r
1597 \r
1598 \r
1599 \r
1600               Begin\r
1601                 with Regs do\r
1602                   Begin\r
1603                     {----------------------------------------------------}\r
1604                     { Allocate the specified number of pages from EMM.   }\r
1605                     { Load pseudo-registers prior to invoking EMM.       }\r
1606                     {    AH = allocate pages function.                   }\r
1607                     {    BX = number of pages to allocate.               }\r
1608                     {----------------------------------------------------}\r
1609                     AH := ALLOCATE_PAGES;\r
1610                     BX := Pages_Needed;\r
1611                     Intr (EMM_INT, Regs);\r
1612                     {----------------------------------------------------}\r
1613                     { Unload the pseudo-registers after invoking EMM.    }\r
1614                     {    DX = EMM handle                                 }\r
1615                     {    AH = status                                     }\r
1616                     {----------------------------------------------------}\r
1617                     Handle := DX;\r
1618                     Allocate_Expanded_Memory_Pages := AH;\r
1619                   end;\r
1620               end; { Function Allocate_Expanded_Memory_Pages }\r
1621 \r
1622 \r
1623             {------------------------------------------------------------}\r
1624             { This function maps a logical page allocated by the         }\r
1625             { Allocate_Expanded_Memory_Pages function into one of the    }\r
1626             { four physical pages.                                       }\r
1627             {------------------------------------------------------------}\r
1628             Function Map_Expanded_Memory_Pages\r
1629               (Handle, Logical_Page, Physical_Page: Integer): Integer;\r
1630               Var\r
1631                 Regs: Registers;\r
1632 \r
1633               Begin\r
1634                 with Regs do\r
1635                   Begin\r
1636                     {----------------------------------------------------}\r
1637                     { Map a logical page at a physical page.             }\r
1638                     { Load pseudo-registers prior to invoking EMM.       }\r
1639                     {    AH = map page function                          }\r
1640                     {    DX = handle                                     }\r
1641                     {    BX = logical page number                        }\r
1642                     {    AL = physical page number                       }\r
1643                     {----------------------------------------------------}\r
1644                     AH := MAP_PAGES;\r
1645                     DX := Handle;\r
1646                     BX := Logical_Page;\r
1647                     AL := Physical_Page;\r
1648                     Intr (EMM_INT, Regs);\r
1649 \r
1650 \r
1651 \r
1652 \r
1653           Writing Programs That Use Expanded Memory                      23\r
1654 \f\r
1655 \r
1656 \r
1657 \r
1658 \r
1659                     {----------------------------------------------------}\r
1660                     { Unload the pseudo-registers after invoking EMM.    }\r
1661                     {    AH = status                                     }\r
1662                     {----------------------------------------------------}\r
1663                     Map_Expanded_Memory_Pages := AH;\r
1664                   end; { with Regs do }\r
1665               end; { Function Map_Expanded_Memory_Pages }\r
1666 \r
1667 \r
1668             {------------------------------------------------------------}\r
1669             { This function gets the physical address of the EMM page    }\r
1670             { frame we are using.  The address returned is the segment   }\r
1671             { of the page frame.                                         }\r
1672             {------------------------------------------------------------}\r
1673             Function Get_Page_Frame_Base_Address\r
1674               (Var Page_Frame_Address: Integer): Integer;\r
1675               Var\r
1676                 Regs: Registers;\r
1677 \r
1678               Begin\r
1679                 with Regs do\r
1680                   Begin\r
1681                     {----------------------------------------------------}\r
1682                     { Get the page frame segment address from EMM.       }\r
1683                     { Load pseudo-registers prior to invoking EMM.       }\r
1684                     {    AH = get page frame segment function            }\r
1685                     {----------------------------------------------------}\r
1686                     AH := GET_PAGE_FRAME;\r
1687                     Intr (EMM_INT, Regs);\r
1688                     {----------------------------------------------------}\r
1689                     { Unload the pseudo-registers after invoking EMM.    }\r
1690                     {    BX = page frame segment address                 }\r
1691                     {    AH = status                                     }\r
1692                     {----------------------------------------------------}\r
1693                     Page_Frame_Address := BX;\r
1694                     Get_Page_Frame_Base_Address := AH;\r
1695                   end; { with Regs do }\r
1696               end; { Function Get_Page_Frame_Base_Address }\r
1697 \r
1698 \r
1699             {------------------------------------------------------------}\r
1700             { This function releases the EMM memory pages allocated to   }\r
1701             { us, back to the EMM memory pool.                           }\r
1702             {------------------------------------------------------------}\r
1703             Function Deallocate_Expanded_Memory_Pages\r
1704               (Handle: Integer): Integer;\r
1705               Var\r
1706                 Regs: Registers;\r
1707 \r
1708 \r
1709 \r
1710 \r
1711 \r
1712           Writing Programs That Use Expanded Memory                      24\r
1713 \f\r
1714 \r
1715 \r
1716 \r
1717 \r
1718               Begin\r
1719                 with Regs do\r
1720                   Begin\r
1721                     {----------------------------------------------------}\r
1722                     { Deallocate the pages allocated to an EMM handle.   }\r
1723                     { Load pseudo-registers prior to invoking EMM.       }\r
1724                     {    AH = deallocate pages function                  }\r
1725                     {    DX = EMM handle                                 }\r
1726                     {----------------------------------------------------}\r
1727                     AH := DEALLOCATE_PAGES;\r
1728                     DX := Handle;\r
1729                     Intr (EMM_INT, Regs);\r
1730                     {----------------------------------------------------}\r
1731                     { Unload the pseudo-registers after invoking EMM.    }\r
1732                     {    AH = status                                     }\r
1733                     {----------------------------------------------------}\r
1734                     Deallocate_Expanded_Memory_Pages := AH;\r
1735                   end; { with Regs do }\r
1736               end; { Function Deallocate_Expanded_Memory_Pages }\r
1737 \r
1738 \r
1739             {------------------------------------------------------------}\r
1740             { This function returns the version number of the EMM as     }\r
1741             { a three-character string.                                  }\r
1742             {------------------------------------------------------------}\r
1743             Function Get_Version_Number (Var Version_String: ST3): Integer;\r
1744               Var\r
1745                 Regs: Registers;\r
1746                 Integer_Part, Fractional_Part: Char;\r
1747 \r
1748               Begin\r
1749                 with Regs do\r
1750                   Begin\r
1751                     {----------------------------------------------------}\r
1752                     { Get the version of EMM.                            }\r
1753                     { Load pseudo-registers prior to invoking EMM.       }\r
1754                     {    AH = get EMM version function                   }\r
1755                     {----------------------------------------------------}\r
1756                     AH := GET_VERSION;\r
1757                     Intr (EMM_INT, Regs);\r
1758 \r
1759 \r
1760 \r
1761 \r
1762 \r
1763 \r
1764 \r
1765 \r
1766 \r
1767 \r
1768 \r
1769 \r
1770 \r
1771           Writing Programs That Use Expanded Memory                      25\r
1772 \f\r
1773 \r
1774 \r
1775 \r
1776 \r
1777                     {----------------------------------------------------}\r
1778                     { If the version number returned was OK, then        }\r
1779                     { convert it to a three-character string.            }\r
1780                     {----------------------------------------------------}\r
1781                     If AH=STATUS_OK then\r
1782                       Begin\r
1783                         {------------------------------------------------}\r
1784                         { The upper four bits of AH are the integer      }\r
1785                         { portion of the version number, the lower four  }\r
1786                         { bits are the fractional portion.  Convert the  }\r
1787                         { integer value to ASCII by adding 48.           }\r
1788                         {------------------------------------------------}\r
1789                         Integer_Part    := Char (AL shr 4  + 48);\r
1790                         Fractional_Part := Char (AL and $F + 48);\r
1791                         Version_String  := Integer_Part + '.' +\r
1792                                                           Fractional_Part;\r
1793                       end; { If AH=STATUS_OK }\r
1794                     {----------------------------------------------------}\r
1795                     { Unload the pseudo-registers after invoking EMM.    }\r
1796                     {    AH = status                                     }\r
1797                     {----------------------------------------------------}\r
1798                     Get_Version_Number := AH;\r
1799                   end; { with Regs do }\r
1800               end; { Function Get_Version_Number }\r
1801 \r
1802 \r
1803             {------------------------------------------------------------}\r
1804             { This procedure prints an error message passed by the       }\r
1805             { caller, prints the error code passed by the caller in hex, }\r
1806             { and then terminates the program with an error level of 1.  }\r
1807             {------------------------------------------------------------}\r
1808             Procedure Error (Error_Message: ST80; Error_Number: Integer);\r
1809               Begin\r
1810                 Writeln (Error_Message);\r
1811                 Writeln ('  Error_Number = ', Hex_String (Error_Number));\r
1812                 Writeln ('EMM test program aborting.');\r
1813                 Halt (1);\r
1814               end; { Procedure Error }\r
1815 \r
1816 \r
1817           {--------------------------------------------------------------}\r
1818           { This program is an example of the basic EMM functions that   }\r
1819           { you need in order to use EMM memory with Turbo Pascal.       }\r
1820           {--------------------------------------------------------------}\r
1821           Begin\r
1822             ClrScr;\r
1823             Window (5,2,77,22);\r
1824 \r
1825 \r
1826 \r
1827 \r
1828 \r
1829 \r
1830           Writing Programs That Use Expanded Memory                      26\r
1831 \f\r
1832 \r
1833 \r
1834 \r
1835 \r
1836             {------------------------------------------------------------}\r
1837             { Determine if the Expanded Memory Manager is installed.  If }\r
1838             { not, then terminate 'main' with an ErrorLevel code of 1.   }\r
1839             {------------------------------------------------------------}\r
1840             If not (Emm_Installed) then\r
1841               Begin\r
1842                 Writeln ('The LIM EMM is not installed.');\r
1843                 Halt (1);\r
1844               end\r
1845             else\r
1846               Begin\r
1847                 { Get the version number and display it }\r
1848                 Error_Code := Get_Version_Number (Version_Number);\r
1849                 If Error_Code <> STATUS_OK then\r
1850                   Error ('Error getting EMM version number.', Error_Code)\r
1851                 else\r
1852                   Writeln ('LIM Expanded Memory Manager, version ',\r
1853                            Version_Number, ' is ready for use.');\r
1854               end;\r
1855             Writeln;\r
1856 \r
1857             {------------------------------------------------------------}\r
1858             { Determine if there are enough expanded memory pages for    }\r
1859             { this application.                                          }\r
1860             {------------------------------------------------------------}\r
1861             Pages_Needed := APPLICATION_PAGE_COUNT;\r
1862             Error_Code   := EMM_Pages_Available (Total_EMM_Pages,\r
1863                                                  Available_EMM_Pages);\r
1864             If Error_Code <> STATUS_OK then\r
1865               Error ('Error determining number of EMM pages available.',\r
1866                      Error_Code);\r
1867             Writeln ('There are a total of ', Total_EMM_Pages,\r
1868                      ' expanded memory pages present in this system.');\r
1869             Writeln ('  ', Available_EMM_Pages,\r
1870                      ' of those pages are available for use.');\r
1871             Writeln;\r
1872 \r
1873             {------------------------------------------------------------}\r
1874             { If there is an insufficient number of pages for the        }\r
1875             { application, then report the error and terminate the EMM   }\r
1876             { example program.                                           }\r
1877             {------------------------------------------------------------}\r
1878             If Pages_Needed > Available_EMM_Pages then\r
1879               Begin\r
1880                 Str (Pages_Needed, Pages_Number_String);\r
1881                 Error ('We need ' + Pages_Number_String +\r
1882                        ' EMM pages.  There are not that many available.',\r
1883                        Error_Code);\r
1884               end; { Pages_Needed > Available_EMM_Pages }\r
1885 \r
1886 \r
1887 \r
1888 \r
1889           Writing Programs That Use Expanded Memory                      27\r
1890 \f\r
1891 \r
1892 \r
1893 \r
1894 \r
1895             {------------------------------------------------------------}\r
1896             { Allocate expanded memory pages for our use.                }\r
1897             {------------------------------------------------------------}\r
1898             Error_Code :=\r
1899               Allocate_Expanded_Memory_Pages (Pages_Needed, Emm_Handle);\r
1900             Str (Pages_Needed, Pages_Number_String);\r
1901             If Error_Code <> STATUS_OK then\r
1902               Error ('EMM test program failed trying to allocate '\r
1903                      + Pages_Number_String\r
1904                      + ' pages for usage.', Error_Code);\r
1905             Writeln (APPLICATION_PAGE_COUNT,\r
1906                      ' EMM page(s) allocated for the EMM test program.');\r
1907             Writeln;\r
1908 \r
1909             {------------------------------------------------------------}\r
1910             { Map in the required logical pages to the physical pages    }\r
1911             { given to us, in this case just one page.                   }\r
1912             {------------------------------------------------------------}\r
1913             Logical_Page  := 0;\r
1914             Physical_Page := 0;\r
1915             Error_Code := Map_Expanded_Memory_Pages (Emm_Handle,\r
1916                                                      Logical_Page,\r
1917                                                      Physical_Page);\r
1918             If Error_Code <> STATUS_OK then\r
1919               Error ('EMM test program failed trying to map '\r
1920                      + 'logical pages into physical pages.',\r
1921                      Error_Code);\r
1922 \r
1923             Writeln ('Logical Page ',\r
1924                      Logical_Page,\r
1925                      ' successfully mapped into Physical Page ',\r
1926                      Physical_Page);\r
1927             Writeln;\r
1928 \r
1929             {------------------------------------------------------------}\r
1930             { Get the expanded memory page frame address.                }\r
1931             {------------------------------------------------------------}\r
1932             Error_Code := Get_Page_Frame_Base_Address\r
1933                             (Page_Frame_Base_Address);\r
1934             If Error_Code <> STATUS_OK then\r
1935               Error ('EMM test program unable to get the base Page'\r
1936                      + ' Frame Address.',\r
1937                      Error_Code);\r
1938             Writeln ('The base address of the EMM page frame is = '\r
1939                      + Hex_String (Page_Frame_Base_Address));\r
1940             Writeln;\r
1941 \r
1942 \r
1943 \r
1944 \r
1945 \r
1946 \r
1947 \r
1948           Writing Programs That Use Expanded Memory                      28\r
1949 \f\r
1950 \r
1951 \r
1952 \r
1953 \r
1954             {------------------------------------------------------------}\r
1955             { Write a test pattern to expanded memory.                   }\r
1956             {------------------------------------------------------------}\r
1957             For Offset := 0 to 16382 do\r
1958               Begin\r
1959                 Mem[Page_Frame_Base_Address:Offset] := Offset mod 256;\r
1960               end;\r
1961 \r
1962             {------------------------------------------------------------}\r
1963             { Make sure that what is in EMM memory is what was just      }\r
1964             { written.                                                   }\r
1965             {------------------------------------------------------------}\r
1966             Writeln ('Testing EMM memory.');\r
1967 \r
1968             Offset := 1;\r
1969             Verify := True;\r
1970             while (Offset <= 16382) and (Verify = True) do\r
1971               Begin\r
1972                 If Mem[Page_Frame_Base_Address:Offset] <> Offset mod 256\r
1973                   then Verify := False;\r
1974                 Offset := Succ (Offset);\r
1975               end; { while (Offset <= 16382) and (Verify = True) }\r
1976 \r
1977             {------------------------------------------------------------}\r
1978             { If what is read does not match what was written,           }\r
1979             { an error occurred.                                         }\r
1980             {------------------------------------------------------------}\r
1981             If not Verify then\r
1982               Error ('What was written to EMM memory was not found during'\r
1983                      + ' memory verification test.',\r
1984                      0);\r
1985             Writeln ('EMM memory test successful.');\r
1986             Writeln;\r
1987 \r
1988             {------------------------------------------------------------}\r
1989             { Return the expanded memory pages given to us back to the   }\r
1990             { EMM memory pool before terminating our test program.       }\r
1991             {------------------------------------------------------------}\r
1992             Error_Code := Deallocate_Expanded_Memory_Pages (Emm_Handle);\r
1993             If Error_Code <> STATUS_OK then\r
1994               Error ('EMM test program was unable to deallocate '\r
1995                      + 'the EMM pages in use.',\r
1996                      Error_Code);\r
1997             Writeln (APPLICATION_PAGE_COUNT,\r
1998                      ' pages(s) deallocated.');\r
1999             Writeln;\r
2000             Writeln ('EMM test program completed.');\r
2001 \r
2002           end.\r
2003 \r
2004 \r
2005 \r
2006 \r
2007           Writing Programs That Use Expanded Memory                      29\r
2008 \f\r
2009 \r
2010 \r
2011 \r
2012 \r
2013           Example 3\r
2014 \r
2015                This program is written in Microsoft's macro assembler.\r
2016 \r
2017 \r
2018           CODE SEGMENT\r
2019                ASSUME CS:CODE, DS:CODE\r
2020 \r
2021           MOV   AX,CS\r
2022           MOV   DX,AX\r
2023                .\r
2024                .\r
2025                .\r
2026           check_emm_installed:\r
2027 \r
2028           MOV   AH,35h                  ; AH = DOS get interrupt vector\r
2029                                         ; function\r
2030           MOV   AL,67h                  ; AL = EMM interrupt vector number\r
2031           INT   21h\r
2032           MOV   DI,0Ah                  ; ES:DI points to where device     \r
2033                                         ; name should be\r
2034           LEA   SI,EMM_device_name      ; DS:SI points to ASCII string     \r
2035                                         ; containing EMM device name\r
2036 \r
2037           MOV   CX,device_name_length   ; set up loop counter for string op\r
2038           CLD                           ; set up direction flag for forward\r
2039           REPE  CMPSB                   ; Compare the strings\r
2040           JNE   exit                    ; IF strings not equal THEN exit\r
2041                                         ; ELSE\r
2042           check_enough_unallocated_pages:\r
2043 \r
2044           MOV   AH,41h                  ;    AH = EMM get unallocated page\r
2045                                         ;    count function code\r
2046           INT   67h\r
2047           OR    AH,AH                   ; Check EMM status\r
2048           JNZ   emm_error_handler       ; IF error THEN goto error handler\r
2049                                         ; ELSE\r
2050           allocate_expanded_memory_pages:\r
2051 \r
2052           MOV   AH,43h                  ;    AH = EMM allocate pages\r
2053                                         ;    function code\r
2054           MOV   BX,2                    ;    BX = number of pages needed\r
2055           INT   67h\r
2056           OR    AH,AH                   ; Check EMM status\r
2057           JNZ   emm_error_handler       ; IF error THEN goto error handler\r
2058                                         ; ELSE\r
2059           MOV   emm_handle,DX           ;    save EMM handle\r
2060 \r
2061           map_expanded_memory_pages:\r
2062 \r
2063           MOV   AH,44h                  ; AH = EMM map pages function\r
2064           MOV   DX,emm_handle           ; DX = application's handle\r
2065 \r
2066           Writing Programs That Use Expanded Memory                      30\r
2067 \f\r
2068 \r
2069 \r
2070 \r
2071 \r
2072           map_0_to_0:\r
2073 \r
2074           MOV   BX,0                    ; BX = logical page 0\r
2075           MOV   AL,0                    ; AL = physical page 0\r
2076           INT   67h\r
2077           OR    AH,AH                   ; Check EMM status\r
2078           JNZ   emm_error_handler       ; If error THEN goto error handler\r
2079                                         ; ELSE\r
2080           get_page_frame_address:\r
2081 \r
2082           MOV   AH,41h                  ; AH = EMM get page frame base\r
2083                                         ; address function\r
2084           INT   67h\r
2085           OR    AH,AH                   ; Check EMM status\r
2086           JNZ   emm_error_handler       ; IF error THEN goto error handler\r
2087           MOV   pf_addr,BX              ; ELSE save pf_addr\r
2088 \r
2089           write_to_expanded_memory:     ; Write zeros to memory mapped at\r
2090                                         ; physical page 0\r
2091           MOV   AX,pf_addr\r
2092           MOV   ES,AX                   ; ES points to physical page 0\r
2093           MOV   DI,0                    ; DI indexes into physical page 0\r
2094           MOV   AL,0                    ; Initialize AL for string STOSB\r
2095           MOV   CX,4000h                ; Initialize loop counter to length \r
2096                                         ; of expanded memory page size\r
2097           CLD                           ; set up direction flag for forward\r
2098           REP   STOSB\r
2099 \r
2100           deallocate_pages:\r
2101 \r
2102           MOV   AH,45h                  ; AH = EMM deallocate pages        \r
2103                                         ; function\r
2104           MOV   DX,emm_handle\r
2105           INT   67h                     ; return handle's pages to EMM\r
2106           OR    AH,AH                   ; Check EMM status\r
2107           JNZ   emm_error_handler       ; IF error THEN goto error handler\r
2108 \r
2109           exit:\r
2110 \r
2111           MOV   AH,4Ch                  ; AH = DOS exit function\r
2112           INT   21h                     ; return to DOS\r
2113 \r
2114 \r
2115           EMM_device_name DB 'EMMXXXX0' ; ASCII EMM device name string\r
2116 \r
2117           device_name_length EQU 8\r
2118 \r
2119           CODE ENDS\r
2120                END\r
2121 \r
2122 \r
2123 \r
2124 \r
2125           Writing Programs That Use Expanded Memory                      31\r
2126 \f\r
2127 \r
2128 \r
2129 \r
2130 \r
2131           Example 4\r
2132 \r
2133                This program is an example of how to exchange a 256K-byte\r
2134                block of data from conventional memory to expanded memory.\r
2135 \r
2136 \r
2137           CODE SEGMENT\r
2138                ASSUME CS:CODE, DS:CODE\r
2139                .\r
2140                .\r
2141                .\r
2142           xchg_packet_set_up:\r
2143 \r
2144           ;DS:SI = xchg_packet\r
2145 \r
2146           MOV   AX,SEG xchg_packet\r
2147           MOV   DS,AX\r
2148           MOV   SI,OFFSET xchg_packet\r
2149 \r
2150           ;Moving 256K of data from conventional memory to expanded memory\r
2151 \r
2152           MOV   WORD PTR [SI].region_length[0],0\r
2153           MOV   WORD PTR [SI].region_length[2],4\r
2154           MOV   [SI].src_mem_type,0\r
2155           MOV   [SI].dest_mem_type,1\r
2156 \r
2157           ;starting at segment: 4000h, offset: 0\r
2158 \r
2159           MOV   [SI].src_init_seg_page,4000h\r
2160           MOV   [SI].src_init_offset,0\r
2161 \r
2162           ;Move data into expanded memory logical page 0, offset 0.\r
2163 \r
2164           MOV   [SI].dest_init_seg_page,0\r
2165           MOV   [SI].dest_init_offset,0\r
2166 \r
2167           ;Initialize for future compatibility\r
2168 \r
2169           MOV   [SI].src_handle,0\r
2170 \r
2171           ;Need handle for expanded memory destination.\r
2172 \r
2173           MOV   DX,emm_handle\r
2174           MOV   [SI].dest_handle,DX\r
2175 \r
2176           ;AX = EMM Exchange Memory function\r
2177 \r
2178           MOV   AX,5701h\r
2179           INT   67h\r
2180           OR    AH,AH\r
2181           JNZ   emm_error_handler\r
2182 \r
2183 \r
2184           Writing Programs That Use Expanded Memory                      32\r
2185 \f\r
2186 \r
2187 \r
2188 \r
2189 \r
2190           xchg_struct                    STRUC\r
2191              region_length               DD ?\r
2192              src_mem_type                DB ?\r
2193              src_handle                  DW ?\r
2194              src_init_offset             DW ?\r
2195              src_init_seg_page           DW ?\r
2196              dest_mem_type               DB ?\r
2197              dest_handle                 DW ?\r
2198              dest_init_offset            DW ?\r
2199              dest_init_seg_page          DW ?\r
2200           xchg_struct                    ENDS\r
2201 \r
2202           xchg_packet                    xchg_struct\r
2203 \r
2204           CODE  ENDS\r
2205                 END\r
2206 \r
2207 \r
2208 \r
2209 \r
2210 \r
2211 \r
2212 \r
2213 \r
2214 \r
2215 \r
2216 \r
2217 \r
2218 \r
2219 \r
2220 \r
2221 \r
2222 \r
2223 \r
2224 \r
2225 \r
2226 \r
2227 \r
2228 \r
2229 \r
2230 \r
2231 \r
2232 \r
2233 \r
2234 \r
2235 \r
2236 \r
2237 \r
2238 \r
2239 \r
2240 \r
2241 \r
2242 \r
2243           Writing Programs That Use Expanded Memory                      33\r
2244 \f\r
2245 \r
2246 \r
2247 \r
2248 \r
2249           Chapter 3\r
2250           EMM FUNCTIONS\r
2251 \r
2252 \r
2253                This chapter provides you with a standardized set of\r
2254                expanded memory functions.  Because they are standardized,\r
2255                you avoid potential compatibility problems with other\r
2256                expanded memory programs that also adhere to the memory\r
2257                manager specification.  Programs that deal directly with the\r
2258                hardware or that don't adhere to this specification will be\r
2259                incompatible.\r
2260 \r
2261                Table 3-1 presents a sequential list of the EMM functions. \r
2262                The remainder of this chapter provides detailed descriptions\r
2263                of each function.\r
2264 \r
2265 \r
2266           Table 3-1.  List of EMM Functions\r
2267           ----------------------------------------------------------------\r
2268 \r
2269           Number             Function Name                Hex Value   Page\r
2270 \r
2271           ----------------------------------------------------------------\r
2272 \r
2273              1    Get Status                                40h         37\r
2274 \r
2275              2    Get Page Frame Address                    41h         38\r
2276 \r
2277              3    Get Unallocated Page Count                42h         40\r
2278 \r
2279              4    Allocate Pages                            43h         42\r
2280 \r
2281              5    Map/Unmap Handle Page                     44h         46\r
2282 \r
2283              6    Deallocate Pages                          45h         49\r
2284 \r
2285              7    Get Version                               46h         51\r
2286 \r
2287              8    Save Page Map                             47h         53\r
2288 \r
2289              9    Restore Page Map                          48h         55\r
2290 \r
2291             10    Reserved                                  49h         57\r
2292 \r
2293             11    Reserved                                  4Ah         58\r
2294 \r
2295             12    Get Handle Count                          4Bh         59\r
2296 \r
2297             13    Get Handle Pages                          4Ch         61\r
2298 \r
2299             14    Get All Handle Pages                      4Dh         63\r
2300 \r
2301 \r
2302           EMM Functions                                                  34\r
2303 \f\r
2304 \r
2305 \r
2306 \r
2307 \r
2308           Table 3-1.  List of EMM Functions (continued)\r
2309           ----------------------------------------------------------------\r
2310 \r
2311           Number             Function Name                Hex Value   Page\r
2312 \r
2313           ----------------------------------------------------------------\r
2314 \r
2315             15    Get Page Map                              4E00h       65\r
2316                   Set Page Map                              4E01h       67\r
2317                   Get & Set Page Map                        4E02h       69\r
2318                   Get Size of Page Map Save Array           4E03h       71\r
2319 \r
2320             16    Get Partial Page Map                      4F00h       73\r
2321                   Set Partial Page Map                      4F01h       76\r
2322                   Get Size of Partial Page Map\r
2323                      Save Array                             4F02h       78\r
2324 \r
2325             17    Map/Unmap Multiple Handle Pages\r
2326                   (Physical page number mode)               5000h       82\r
2327                   Map/Unmap Multiple Handle Pages\r
2328                   (Segment address mode)                    5001h       85\r
2329 \r
2330             18    Reallocate Pages                          51h         88\r
2331 \r
2332             19    Get Handle Attribute                      5200h       92\r
2333                   Set Handle Attribute                      5201h       94\r
2334                   Get Handle Attribute Capability           5202h       96\r
2335 \r
2336             20    Get Handle Name                           5300h       98\r
2337                   Set Handle Name                           5301h      100\r
2338 \r
2339             21    Get Handle Directory                      5400h      102\r
2340                   Search for Named Handle                   5401h      105\r
2341                   Get Total Handles                         5402h      107\r
2342 \r
2343             22    Alter Page Map & Jump\r
2344                   (Physical page number mode)               5500h      109\r
2345                   Alter Page Map & Jump\r
2346                   (Segment address mode)                    5501h      109\r
2347 \r
2348             23    Alter Page Map & Call\r
2349                   (Physical page number mode)               5600h      113\r
2350                   Alter Page Map & Call\r
2351                   (Segment address mode)                    5601h      113\r
2352                   Get Page Map Stack Space Size             5602h      118\r
2353 \r
2354             24    Move Memory Region                        5700h      120\r
2355                   Exchange Memory Region                    5701h      126\r
2356 \r
2357             25    Get Mappable Physical Address Array       5800h      132\r
2358                   Get Mappable Physical Address Array\r
2359                      Entries                                5801h      136\r
2360 \r
2361           EMM Functions                                                  35\r
2362 \f\r
2363 \r
2364 \r
2365 \r
2366 \r
2367           Table 3-1.  List of EMM Functions (continued)\r
2368           ----------------------------------------------------------------\r
2369 \r
2370           Number             Function Name                Hex Value   Page\r
2371 \r
2372           ----------------------------------------------------------------\r
2373 \r
2374             26    Get Hardware Configuration Array          5900h      138\r
2375                   Get Unallocated Raw Page Count            5901h      142\r
2376 \r
2377             27    Allocate Standard Pages                   5A00h      144\r
2378                   Allocate Raw Pages                        5A01h      147\r
2379 \r
2380             28    Get Alternate Map Register Set            5B00h      153\r
2381                   Set Alternate Map Register Set            5B01h      157\r
2382                   Get Alternate Map Save Array Size         5B02h      161\r
2383                   Allocate Alternate Map Register Set       5B03h      163\r
2384                   Deallocate Alternate Map Register Set     5B04h      166\r
2385                   Allocate DMA Register Set                 5B05h      168\r
2386                   Enable DMA on Alternate Map\r
2387                      Register Set                           5B06h      170\r
2388                   Disable DMA on Alternate Map\r
2389                      Register Set                           5B07h      173\r
2390                   Deallocate DMA Register Set               5B08h      175\r
2391 \r
2392             29    Prepare Expanded Memory Hardware\r
2393                      for Warmboot                           5Ch        177\r
2394 \r
2395             30    Enable OS/E Function Set                  5D00h      179\r
2396                   Disable OS/E Function Set                 5D01h      182\r
2397                   Return OS/E Access Key                    5D02h      185\r
2398 \r
2399           ----------------------------------------------------------------\r
2400 \r
2401 \r
2402 \r
2403 \r
2404 \r
2405 \r
2406 \r
2407 \r
2408 \r
2409 \r
2410 \r
2411 \r
2412 \r
2413 \r
2414 \r
2415 \r
2416 \r
2417 \r
2418 \r
2419 \r
2420           EMM Functions                                                  36\r
2421 \f\r
2422 \r
2423 \r
2424 \r
2425 \r
2426           Function 1. Get Status\r
2427 \r
2428 \r
2429 \r
2430           PURPOSE\r
2431 \r
2432                The Get Status function returns a status code indicating\r
2433                whether the memory manager is present and the hardware is\r
2434                working correctly.\r
2435 \r
2436 \r
2437           CALLING PARAMETERS\r
2438 \r
2439                AH = 40h\r
2440                    Contains the Get Status Function.\r
2441 \r
2442 \r
2443           REGISTERS MODIFIED\r
2444 \r
2445                AX\r
2446 \r
2447 \r
2448           STATUS\r
2449 \r
2450                AH = 0   SUCCESSFUL.\r
2451                    The manager is present in the system, and the hardware\r
2452                    is working correctly.\r
2453 \r
2454                AH = 80h   NON-RECOVERABLE.\r
2455                    The manager detected a malfunction in the memory manager\r
2456                    software.\r
2457 \r
2458                AH = 81h   NON-RECOVERABLE.\r
2459                    The manager detected a malfunction in the expanded\r
2460                    memory hardware.\r
2461 \r
2462                AH = 84h   NON-RECOVERABLE.\r
2463                    The function code passed to the memory manager is not\r
2464                    defined.\r
2465 \r
2466 \r
2467           EXAMPLE\r
2468 \r
2469           MOV   AH,40h                   ; load function code\r
2470           INT   67h                      ; call the memory manager\r
2471           OR    AH,AH                    ; check EMM status\r
2472           JNZ   emm_err_handler          ; jump to error handler on error\r
2473 \r
2474 \r
2475 \r
2476 \r
2477 \r
2478 \r
2479           EMM Functions                                                  37\r
2480 \f\r
2481 \r
2482 \r
2483 \r
2484 \r
2485           Function 2. Get Page Frame Address\r
2486 \r
2487 \r
2488 \r
2489           PURPOSE\r
2490 \r
2491                The Get Page Frame Address function returns the segment\r
2492                address where the page frame is located.\r
2493 \r
2494 \r
2495           CALLING PARAMETERS\r
2496 \r
2497                AH = 41h\r
2498                    Contains the Get Page Frame Address function.\r
2499 \r
2500 \r
2501           RESULTS\r
2502 \r
2503                These results are valid only if the status returned is zero.\r
2504 \r
2505                BX = page frame segment address\r
2506                    Contains the segment address of the page frame.\r
2507 \r
2508 \r
2509           REGISTERS MODIFIED\r
2510 \r
2511                AX, BX\r
2512 \r
2513 \r
2514           STATUS\r
2515 \r
2516                AH = 0   SUCCESSFUL.\r
2517                    The manager has returned the page frame address in the\r
2518                    BX register.\r
2519 \r
2520                AH = 80h   NON-RECOVERABLE.\r
2521                    The manager detected a malfunction in the memory manager\r
2522                    software.\r
2523 \r
2524                AH = 81h   NON-RECOVERABLE.\r
2525                    The manager detected a malfunction in the expanded\r
2526                    memory hardware.\r
2527 \r
2528                AH = 84h   NON-RECOVERABLE.\r
2529                    The function code passed to the memory manager is not\r
2530                    defined.\r
2531 \r
2532 \r
2533 \r
2534 \r
2535 \r
2536 \r
2537 \r
2538           EMM Functions                                                  38\r
2539 \f\r
2540 \r
2541 \r
2542 \r
2543 \r
2544           Function 2. Get Page Frame Address\r
2545 \r
2546 \r
2547 \r
2548           EXAMPLE\r
2549 \r
2550           page_frame_segment             DW ?\r
2551 \r
2552           MOV   AH,41h                   ; load function code\r
2553           INT   67h                      ; call the memory manager\r
2554           OR    AH,AH                    ; check EMM status\r
2555           JNZ   emm_err_handler          ; jump to error handler on error\r
2556           MOV   page_frame_segment,BX    ; save page frame address\r
2557 \r
2558 \r
2559 \r
2560 \r
2561 \r
2562 \r
2563 \r
2564 \r
2565 \r
2566 \r
2567 \r
2568 \r
2569 \r
2570 \r
2571 \r
2572 \r
2573 \r
2574 \r
2575 \r
2576 \r
2577 \r
2578 \r
2579 \r
2580 \r
2581 \r
2582 \r
2583 \r
2584 \r
2585 \r
2586 \r
2587 \r
2588 \r
2589 \r
2590 \r
2591 \r
2592 \r
2593 \r
2594 \r
2595 \r
2596 \r
2597           EMM Functions                                                  39\r
2598 \f\r
2599 \r
2600 \r
2601 \r
2602 \r
2603           Function 3. Get Unallocated Page Count\r
2604 \r
2605 \r
2606 \r
2607           PURPOSE\r
2608 \r
2609                The Get Unallocated Page Count function returns the number\r
2610                of unallocated pages and the total number of expanded memory\r
2611                pages.\r
2612 \r
2613 \r
2614           CALLING PARAMETERS\r
2615 \r
2616                AH = 42h\r
2617                    Contains the Get Unallocated Page Count function.\r
2618 \r
2619 \r
2620           RESULTS\r
2621 \r
2622                These results are valid only if the status returned is zero.\r
2623 \r
2624                BX = unallocated pages\r
2625                    The number of expanded memory pages that are currently\r
2626                    available for use (unallocated).\r
2627 \r
2628                DX = total pages\r
2629                    The total number of expanded memory pages.\r
2630 \r
2631 \r
2632           REGISTERS MODIFIED\r
2633 \r
2634                AX, BX, DX\r
2635 \r
2636 \r
2637           STATUS\r
2638 \r
2639                AH = 0   SUCCESSFUL.\r
2640                    The manager has returned the number of unallocated pages\r
2641                    and the number of total pages in expanded memory.\r
2642 \r
2643                AH = 80h   NON-RECOVERABLE.\r
2644                    The manager detected a malfunction in the memory manager\r
2645                    software.\r
2646 \r
2647                AH = 81h   NON-RECOVERABLE.\r
2648                    The manager detected a malfunction in the expanded\r
2649                    memory hardware.\r
2650 \r
2651                AH = 84h   NON-RECOVERABLE.\r
2652                    The function code passed to the memory manager is not\r
2653                    defined.\r
2654 \r
2655 \r
2656           EMM Functions                                                  40\r
2657 \f\r
2658 \r
2659 \r
2660 \r
2661 \r
2662           Function 3. Get Unallocated Page Count\r
2663 \r
2664 \r
2665 \r
2666           EXAMPLE\r
2667 \r
2668           un_alloc_pages                 DW ?\r
2669           total_pages                    DW ?\r
2670 \r
2671           MOV   AH,42h                   ; load function code\r
2672           INT   67h                      ; call the memory manager\r
2673           OR    AH,AH                    ; check EMM status\r
2674           JNZ   emm_err_handler          ; jump to error handler on error\r
2675           MOV   un_alloc_pages,BX        ; save unallocated page count\r
2676           MOV   total_pages,DX           ; save total page count\r
2677 \r
2678 \r
2679 \r
2680 \r
2681 \r
2682 \r
2683 \r
2684 \r
2685 \r
2686 \r
2687 \r
2688 \r
2689 \r
2690 \r
2691 \r
2692 \r
2693 \r
2694 \r
2695 \r
2696 \r
2697 \r
2698 \r
2699 \r
2700 \r
2701 \r
2702 \r
2703 \r
2704 \r
2705 \r
2706 \r
2707 \r
2708 \r
2709 \r
2710 \r
2711 \r
2712 \r
2713 \r
2714 \r
2715           EMM Functions                                                  41\r
2716 \f\r
2717 \r
2718 \r
2719 \r
2720 \r
2721           Function 4. Allocate Pages\r
2722 \r
2723 \r
2724 \r
2725                The Allocate Pages function allocates the number of pages\r
2726                requested and assigns a unique EMM handle to these pages. \r
2727                The EMM handle owns these pages until the application\r
2728                deallocates them.\r
2729 \r
2730                Handles which are assigned using this function will have\r
2731                16K-byte pages, the size of a standard expanded memory page. \r
2732                If the expanded memory board hardware isn't able to supply\r
2733                16K-byte pages, it will emulate them by combining multiple\r
2734                non-standard size pages to form a single 16K-byte page.  All\r
2735                application programs and functions that use the handles this\r
2736                function returns will deal with 16K-byte pages.\r
2737 \r
2738                The numeric value of the handles the EMM returns are in the\r
2739                range of 1 to 254 decimal (0001h to 00FEh).  The OS handle\r
2740                (handle value 0) is never returned by the Allocate Pages\r
2741                function.  Also, the uppermost byte of the handle will be\r
2742                zero and cannot be used by the application.  A memory\r
2743                manager should be able to supply up to 255 handles, includ-\r
2744                ing the OS handle.  An application can use Function 21 to\r
2745                find out how many handles an EMM supports.\r
2746 \r
2747                Allocating zero pages to a handle is not valid.  If an\r
2748                application needs to allocate 0 pages to a handle it should\r
2749                use Function 27 (Allocate Standard Pages subfunction)\r
2750                provided for this purpose.\r
2751 \r
2752           Note............................................................\r
2753                This note affects expanded memory manager implementors and\r
2754                operating system developers only.  Applications should not\r
2755                use the following characteristics of the memory manager.  An\r
2756                application violating this rule will be incompatible with\r
2757                future versions of Microsoft's operating systems and\r
2758                environments.\r
2759 \r
2760                To be compatible with this specification, an expanded memory\r
2761                manager will provide a special handle which is available to\r
2762                the operating system only.  This handle will have a value of\r
2763                0000h and will have a set of pages allocated to it when the\r
2764                expanded memory manager driver installs.  The pages that the\r
2765                memory manager will automatically allocate to handle 0000h\r
2766                are those that backfill conventional memory.  Typically,\r
2767                this backfill occurs between addresses 40000h (256K) and\r
2768                9FFFFh (640K).  However, the range can extend below and\r
2769                above this limit if the hardware and memory manager have the\r
2770                capability.\r
2771 \r
2772 \r
2773 \r
2774           EMM Functions                                                  42\r
2775 \f\r
2776 \r
2777 \r
2778 \r
2779 \r
2780           Function 4. Allocate Pages\r
2781 \r
2782 \r
2783 \r
2784                An operating system won't have to invoke Function 4 to\r
2785                obtain this handle because it can assume the handle already\r
2786                exists and is available for use immediately after the\r
2787                expanded memory device driver installs.  When an operating\r
2788                system wants to use this handle, it uses the special handle\r
2789                value of 0000h.  The operating system will be able to invoke\r
2790                any EMM function using this special handle value.  To\r
2791                allocate pages to this handle, the operating system need\r
2792                only invoke Function 18 (Reallocate Pages).\r
2793 \r
2794                There are two special cases for this handle:\r
2795 \r
2796                1.  Function 4 (Allocate Pages).  This function must never\r
2797                    return zero as a handle value.  Applications must always\r
2798                    invoke Function 4 to allocate pages and obtain a handle\r
2799                    which identifies the pages which belong to it.  Since\r
2800                    Function 4 never returns a handle value of zero, an\r
2801                    application will never gain access to this special\r
2802                    handle.\r
2803 \r
2804                2.  Function 6 (Deallocate Pages).  If the operating system\r
2805                    uses it to deallocate the pages which are allocated to\r
2806                    this special handle, the pages the handle owns will be\r
2807                    returned to the manager for use.  But the handle will\r
2808                    not be available for reassignment.  The manager should\r
2809                    treat a deallocate pages function request for this\r
2810                    handle the same as a reallocate pages function request,\r
2811                    where the number of pages to reallocate to this handle\r
2812                    is zero.\r
2813 \r
2814 \r
2815           CALLING PARAMETERS\r
2816 \r
2817                AH = 43h\r
2818                    Contains the Allocate Pages function.\r
2819 \r
2820                BX = num_of_pages_to_alloc\r
2821                    Contains the number of pages you want your program to\r
2822                    allocate.\r
2823 \r
2824 \r
2825 \r
2826 \r
2827 \r
2828 \r
2829 \r
2830 \r
2831 \r
2832 \r
2833           EMM Functions                                                  43\r
2834 \f\r
2835 \r
2836 \r
2837 \r
2838 \r
2839           Function 4. Allocate Pages\r
2840 \r
2841 \r
2842 \r
2843           RESULTS\r
2844 \r
2845                These results are valid only if the status returned is zero.\r
2846 \r
2847                DX = handle\r
2848                    Contains a unique EMM handle.  Your program must use\r
2849                    this EMM handle (as a parameter) in any function that\r
2850                    requires it.  You can use up to 255 handles.  The\r
2851                    uppermost byte of the handle will be zero and cannot be\r
2852                    used by the application.\r
2853 \r
2854 \r
2855           REGISTERS MODIFIED\r
2856 \r
2857                AX, DX\r
2858 \r
2859 \r
2860           STATUS\r
2861 \r
2862                AH = 0   SUCCESSFUL.\r
2863                    The manager has allocated the requested pages to the\r
2864                    assigned EMM handle.\r
2865 \r
2866                AH = 80h   NON-RECOVERABLE.\r
2867                    The manager detected a malfunction in the memory manager\r
2868                    software.\r
2869 \r
2870                AH = 81h   NON-RECOVERABLE.\r
2871                    The manager detected a malfunction in the expanded\r
2872                    memory hardware.\r
2873 \r
2874                AH = 84h   NON-RECOVERABLE.\r
2875                    The function code passed to the memory manager is not\r
2876                    defined.\r
2877 \r
2878                AH = 85h   RECOVERABLE.\r
2879                    All EMM handles are being used.\r
2880 \r
2881                AH = 87h   RECOVERABLE.\r
2882                    There aren't enough expanded memory pages present in the\r
2883                    system to satisfy your program's request.\r
2884 \r
2885                AH = 88h   RECOVERABLE.\r
2886                    There aren't enough unallocated pages to satisfy your\r
2887                    program's request.\r
2888 \r
2889                AH = 89h   RECOVERABLE.\r
2890                    Your program attempted to allocate zero pages.\r
2891 \r
2892           EMM Functions                                                  44\r
2893 \f\r
2894 \r
2895 \r
2896 \r
2897 \r
2898           Function 4. Allocate Pages\r
2899 \r
2900 \r
2901 \r
2902           EXAMPLE\r
2903 \r
2904           num_of_pages_to_alloc          DW ?\r
2905           emm_handle                     DW ?\r
2906 \r
2907           MOV   BX,num_of_pages_to_alloc ; load number of pages\r
2908           MOV   AH,43h                   ; load function code\r
2909           INT   67h                      ; call the memory manager\r
2910           OR    AH,AH                    ; check EMM status\r
2911           JNZ   emm_err_handler          ; jump to error handler on error\r
2912           MOV   emm_handle,DX            ; save EMM handle\r
2913 \r
2914 \r
2915 \r
2916 \r
2917 \r
2918 \r
2919 \r
2920 \r
2921 \r
2922 \r
2923 \r
2924 \r
2925 \r
2926 \r
2927 \r
2928 \r
2929 \r
2930 \r
2931 \r
2932 \r
2933 \r
2934 \r
2935 \r
2936 \r
2937 \r
2938 \r
2939 \r
2940 \r
2941 \r
2942 \r
2943 \r
2944 \r
2945 \r
2946 \r
2947 \r
2948 \r
2949 \r
2950 \r
2951           EMM Functions                                                  45\r
2952 \f\r
2953 \r
2954 \r
2955 \r
2956 \r
2957           Function 5. Map/Unmap Handle Pages\r
2958 \r
2959 \r
2960 \r
2961           PURPOSE\r
2962 \r
2963                The Map/Unmap Handle Page function maps a logical page at a\r
2964                specific physical page anywhere in the mappable regions of\r
2965                system memory.  The lowest valued physical page numbers are\r
2966                associated with regions of memory outside the conventional\r
2967                memory range.  Use Function 25 (Get Mappable Physical\r
2968                Address Array) to determine which physical pages within a\r
2969                system are mappable and determine the segment addresses\r
2970                which correspond to a specific physical page number. \r
2971                Function 25 provides a cross reference between physical page\r
2972                numbers and segment addresses.\r
2973 \r
2974                This function can also unmap physical pages, making them\r
2975                inaccessible for reading or writing.  You unmap a physical\r
2976                page by setting its associated logical page to FFFFh.\r
2977 \r
2978                You might unmap an entire set of mapped pages, for example,\r
2979                before loading and executing a program.  Doing so ensures\r
2980                the loaded program, if it accesses expanded memory, won't\r
2981                access the pages your program has mapped.  However, you must\r
2982                save the mapped context before you unmap the physical pages. \r
2983                This enables you to restore it later so you can access the\r
2984                memory you mapped there.  To save the mapping context, use\r
2985                Function 8, 15, or 16.  To restore the mapping context, use\r
2986                Function 9, 15, or 16.\r
2987 \r
2988                The handle determines what type of pages are being mapped. \r
2989                Logical pages allocated by Function 4 and Function 27\r
2990                (Allocate Standard Pages subfunction) are referred to as\r
2991                pages and are 16K bytes long.  Logical pages allocated by\r
2992                Function 27 (Allocate Raw Pages subfunction) are referred to\r
2993                as raw pages and might not be the same size as logical\r
2994                pages.\r
2995 \r
2996 \r
2997           CALLING PARAMETERS\r
2998 \r
2999                AH = 44h\r
3000                    Contains the Map Handle Page function.\r
3001 \r
3002                AL = physical_page_number\r
3003                    Contains the number of the physical page into which the\r
3004                    logical page number is to be mapped.  Physical pages are\r
3005                    numbered zero-relative.\r
3006 \r
3007 \r
3008 \r
3009 \r
3010           EMM Functions                                                  46\r
3011 \f\r
3012 \r
3013 \r
3014 \r
3015 \r
3016           Function 5. Map/Unmap Handle Pages\r
3017 \r
3018 \r
3019 \r
3020                BX = logical_page_number\r
3021                    Contains the number of the logical page to be mapped at\r
3022                    the physical page within the page frame.  Logical pages\r
3023                    are numbered zero-relative.  The logical page must be in\r
3024                    the range zero through (number of pages allocated to the\r
3025                    EMM handle - 1).  However, if BX contains logical page\r
3026                    number FFFFh, the physical page specified in AL will be\r
3027                    unmapped (be made inaccessible for reading or writing).\r
3028 \r
3029                DX = emm_handle\r
3030                    Contains the EMM handle your program received from\r
3031                    Function 4 (Allocate Pages).\r
3032 \r
3033 \r
3034           REGISTERS MODIFIED\r
3035 \r
3036                AX\r
3037 \r
3038 \r
3039           STATUS\r
3040 \r
3041                AH = 0   SUCCESSFUL.\r
3042                    The manager has mapped the page.  The page is ready to\r
3043                    be accessed.\r
3044 \r
3045                AH = 80h   NON-RECOVERABLE.\r
3046                    The manager detected a malfunction in the memory manager\r
3047                    software.\r
3048 \r
3049                AH = 81h   NON-RECOVERABLE.\r
3050                    The manager detected a malfunction in the expanded\r
3051                    memory hardware.\r
3052 \r
3053                AH = 83h   NON-RECOVERABLE.\r
3054                    The memory manager couldn't find the EMM handle your\r
3055                    program specified.\r
3056 \r
3057                AH = 84h   NON-RECOVERABLE.\r
3058                    The function code passed to the memory manager isn't\r
3059                    defined.\r
3060 \r
3061                AH = 8Ah   RECOVERABLE.\r
3062                    The logical page is out of the range of logical pages\r
3063                    which are allocated to the EMM handle.  This status is\r
3064                    also returned if a program attempts to map a logical\r
3065                    page when no logical pages are allocated to the handle.\r
3066 \r
3067 \r
3068 \r
3069           EMM Functions                                                  47\r
3070 \f\r
3071 \r
3072 \r
3073 \r
3074 \r
3075           Function 5. Map/Unmap Handle Pages\r
3076 \r
3077 \r
3078 \r
3079                AH = 8Bh   RECOVERABLE.\r
3080                    The physical page number is out of the range of allow-\r
3081                    able physical pages.  The program can recover by\r
3082                    attempting to map into memory at a physical page which\r
3083                    is within the range of allowable physical pages.\r
3084 \r
3085 \r
3086           EXAMPLE\r
3087 \r
3088           emm_handle                     DW ?\r
3089           logical_page_number            DW ?\r
3090           physical_page_number           DB ?\r
3091 \r
3092           MOV   DX,emm_handle            ; load EMM handle\r
3093           MOV   BX,logical_page_number   ; load logical page number\r
3094           MOV   AL,physical_page_number  ; load physical page number\r
3095           MOV   AH,44h                   ; load function code\r
3096           INT   67h                      ; call the memory manager\r
3097           OR    AH,AH                    ; check EMM status\r
3098           JNZ   emm_err_handler          ; jump to error handler on error\r
3099 \r
3100 \r
3101 \r
3102 \r
3103 \r
3104 \r
3105 \r
3106 \r
3107 \r
3108 \r
3109 \r
3110 \r
3111 \r
3112 \r
3113 \r
3114 \r
3115 \r
3116 \r
3117 \r
3118 \r
3119 \r
3120 \r
3121 \r
3122 \r
3123 \r
3124 \r
3125 \r
3126 \r
3127 \r
3128           EMM Functions                                                  48\r
3129 \f\r
3130 \r
3131 \r
3132 \r
3133 \r
3134           Function 6. Deallocate Pages\r
3135 \r
3136 \r
3137 \r
3138           PURPOSE\r
3139 \r
3140                Deallocate Pages deallocates the logical pages currently\r
3141                allocated to an EMM handle.  Only after the application\r
3142                deallocates these pages can other applications use them. \r
3143                When a handle is deallocated, its name is set to all ASCII\r
3144                nulls (binary zeros).\r
3145 \r
3146           Note............................................................\r
3147                A program must perform this function before it exits to DOS. \r
3148                If it doesn't, no other programs can use these pages or the\r
3149                EMM handle.  This means that a program using expanded memory\r
3150                should trap critical errors and control-break if there is a\r
3151                chance that the program will have allocated pages when\r
3152                either of these events occur.\r
3153 \r
3154 \r
3155           CALLING PARAMETERS\r
3156 \r
3157                AH = 45h\r
3158                    Contains the Deallocate Pages function.\r
3159 \r
3160                DX = handle\r
3161                    Contains the EMM handle returned by Function 4 (Allocate\r
3162                    Pages).\r
3163 \r
3164 \r
3165           REGISTERS MODIFIED\r
3166 \r
3167                AX\r
3168 \r
3169 \r
3170           STATUS\r
3171 \r
3172                AH = 0   SUCCESSFUL.\r
3173                    The manager has deallocated the pages previously allo-\r
3174                    cated to the EMM handle.\r
3175 \r
3176                AH = 80h   NON-RECOVERABLE.\r
3177                    The manager detected a malfunction in the memory manager\r
3178                    software.\r
3179 \r
3180                AH = 81h   NON-RECOVERABLE.\r
3181                    The manager detected a malfunction in the expanded\r
3182                    memory hardware.\r
3183 \r
3184                AH = 83h   NON-RECOVERABLE.\r
3185                    The manager couldn't find the specified EMM handle.\r
3186 \r
3187           EMM Functions                                                  49\r
3188 \f\r
3189 \r
3190 \r
3191 \r
3192 \r
3193           Function 6. Deallocate Pages\r
3194 \r
3195 \r
3196 \r
3197                AH = 84h   NON-RECOVERABLE.\r
3198                    The function code passed to the memory manager is not\r
3199                    defined.\r
3200 \r
3201                AH = 86h   RECOVERABLE.\r
3202                    The memory manager detected a save or restore page\r
3203                    mapping context error (Function 8 or 9).  There is a\r
3204                    page mapping register state in the save area for the\r
3205                    specified EMM handle.  Save Page Map (Function 8) placed\r
3206                    it there and a subsequent Restore Page Map (Function 9)\r
3207                    has not removed it.\r
3208 \r
3209                    If you have saved the mapping context, you must restore\r
3210                    it before you deallocate the EMM handle's pages.\r
3211 \r
3212 \r
3213           EXAMPLE\r
3214 \r
3215           emm_handle                     DW ?\r
3216 \r
3217           MOV   DX,emm_handle            ; load EMM handle\r
3218           MOV   AH,45h                   ; load function code\r
3219           INT   67h                      ; call the memory manager\r
3220           OR    AH,AH                    ; check EMM status\r
3221           JNZ   emm_err_handler          ; jump to error handler on error\r
3222 \r
3223 \r
3224 \r
3225 \r
3226 \r
3227 \r
3228 \r
3229 \r
3230 \r
3231 \r
3232 \r
3233 \r
3234 \r
3235 \r
3236 \r
3237 \r
3238 \r
3239 \r
3240 \r
3241 \r
3242 \r
3243 \r
3244 \r
3245 \r
3246           EMM Functions                                                  50\r
3247 \f\r
3248 \r
3249 \r
3250 \r
3251 \r
3252           Function 7. Get Version\r
3253 \r
3254 \r
3255 \r
3256           PURPOSE\r
3257 \r
3258                The Get Version function returns the version number of the\r
3259                memory manager software.\r
3260 \r
3261 \r
3262           CALLING PARAMETERS\r
3263 \r
3264                AH = 46h\r
3265                    Contains the Get Version function.\r
3266 \r
3267 \r
3268           RESULTS\r
3269 \r
3270                These results are valid only if the status returned is zero.\r
3271 \r
3272                AL = version number\r
3273                    Contains the memory manager's version number in binary\r
3274                    coded decimal (BCD) format.  The upper four bits contain\r
3275                    the integer digit of the version number.  The lower four\r
3276                    bits contain the fractional digit of version number. \r
3277                    For example, version 4.0 is represented like this:\r
3278 \r
3279                                       0100 0000\r
3280                                         /   \\r
3281                                        4  .  0\r
3282 \r
3283                    When checking for a version number, an application\r
3284                    should check for a version number or greater.  Vendors\r
3285                    may use the fractional digit to indicate enhancements or\r
3286                    corrections to their memory managers.  Therefore, to\r
3287                    allow for future versions of memory managers, an\r
3288                    application shouldn't depend on an exact version number.\r
3289 \r
3290 \r
3291           REGISTERS MODIFIED\r
3292 \r
3293                AX\r
3294 \r
3295 \r
3296           STATUS\r
3297 \r
3298                AH = 0   SUCCESSFUL.\r
3299                    The manager is present in the system and the hardware is\r
3300                    working correctly.\r
3301 \r
3302 \r
3303 \r
3304 \r
3305           EMM Functions                                                  51\r
3306 \f\r
3307 \r
3308 \r
3309 \r
3310 \r
3311           Function 7. Get Version\r
3312 \r
3313 \r
3314 \r
3315                AH = 80h   NON-RECOVERABLE.\r
3316                    The manager detected a malfunction in the memory manager\r
3317                    software.\r
3318 \r
3319                AH = 81h   NON-RECOVERABLE.\r
3320                    The manager detected a malfunction in the expanded\r
3321                    memory hardware.\r
3322 \r
3323                AH = 84h   NON-RECOVERABLE.\r
3324                    The function code passed to the memory manager is not\r
3325                    defined.\r
3326 \r
3327 \r
3328           EXAMPLE\r
3329 \r
3330           emm_version                    DB ?\r
3331 \r
3332           MOV   AH,46h                   ; load function code\r
3333           INT   67h                      ; call the memory manager\r
3334           OR    AH,AH                    ; check EMM status\r
3335           JNZ   emm_err_handler          ; jump to error handler on error\r
3336           MOV   emm_version,AL           ; save version number\r
3337 \r
3338 \r
3339 \r
3340 \r
3341 \r
3342 \r
3343 \r
3344 \r
3345 \r
3346 \r
3347 \r
3348 \r
3349 \r
3350 \r
3351 \r
3352 \r
3353 \r
3354 \r
3355 \r
3356 \r
3357 \r
3358 \r
3359 \r
3360 \r
3361 \r
3362 \r
3363 \r
3364           EMM Functions                                                  52\r
3365 \f\r
3366 \r
3367 \r
3368 \r
3369 \r
3370           Function 8. Save Page Map\r
3371 \r
3372 \r
3373 \r
3374           PURPOSE\r
3375 \r
3376                Save Page Map saves the contents of the page mapping\r
3377                registers on all expanded memory boards in an internal save\r
3378                area.  The function is typically used to save the memory\r
3379                mapping context of the EMM handle that was active when a\r
3380                software or hardware interrupt occurred.  (See Function 9,\r
3381                Restore Page Map, for the restore operation.)\r
3382 \r
3383                If you're writing a resident program, an interrupt service\r
3384                routine, or a device driver that uses expanded memory, you\r
3385                must save the state of the mapping hardware.  You must save\r
3386                this state because application software using expanded\r
3387                memory may be running when your program is invoked by a\r
3388                hardware interrupt, a software interrupt, or DOS.\r
3389 \r
3390                The Save Page Map function requires the EMM handle that was\r
3391                assigned to your resident program, interrupt service\r
3392                routine, or device driver at the time it was initialized. \r
3393                This is not the EMM handle that the application software was\r
3394                using when your software interrupted it.\r
3395 \r
3396                The Save Page Map function saves the state of the map\r
3397                registers for only the 64K-byte page frame defined in\r
3398                versions 3.x of this specification.  Since all applications\r
3399                written to LIM versions 3.x require saving the map register\r
3400                state of only this 64K-byte page frame, saving the entire\r
3401                mapping state for a large number of mappable pages would be\r
3402                inefficient use of memory.  Applications that use a mappable\r
3403                memory region outside the LIM 3.x page frame should use\r
3404                Function 15 or 16 to save and restore the state of the map\r
3405                registers.\r
3406 \r
3407 \r
3408           CALLING PARAMETERS\r
3409 \r
3410                AH = 47h\r
3411                    Contains the Save Page Map function.\r
3412 \r
3413                DX = handle\r
3414                    Contains the EMM handle assigned to the interrupt\r
3415                    service routine that's servicing the software or\r
3416                    hardware interrupt.  The interrupt service routine needs\r
3417                    to save the state of the page mapping hardware before\r
3418                    mapping any pages.\r
3419 \r
3420 \r
3421 \r
3422 \r
3423           EMM Functions                                                  53\r
3424 \f\r
3425 \r
3426 \r
3427 \r
3428 \r
3429           Function 8. Save Page Map\r
3430 \r
3431 \r
3432 \r
3433           REGISTERS MODIFIED\r
3434 \r
3435                AX\r
3436 \r
3437 \r
3438           STATUS\r
3439 \r
3440                AH = 0   SUCCESSFUL.\r
3441                    The manager has saved the state of the page mapping\r
3442                    hardware.\r
3443 \r
3444                AH = 80h   NON-RECOVERABLE.\r
3445                    The manager detected a malfunction in the memory manager\r
3446                    software.\r
3447 \r
3448                AH = 81h   NON-RECOVERABLE.\r
3449                    The manager detected a malfunction in the expanded\r
3450                    memory hardware.\r
3451 \r
3452                AH = 83h   NON-RECOVERABLE.\r
3453                    The memory manager couldn't find the EMM handle your\r
3454                    program specified.\r
3455 \r
3456                AH = 84h   NON-RECOVERABLE.\r
3457                    The function code passed to the memory manager is not\r
3458                    defined.\r
3459 \r
3460                AH = 8Ch   NON-RECOVERABLE.\r
3461                    There is no room in the save area to store the state of\r
3462                    the page mapping registers.  The state of the map\r
3463                    registers has not been saved.\r
3464 \r
3465                AH = 8Dh   CONDITIONALLY-RECOVERABLE.\r
3466                    The save area already contains the page mapping register\r
3467                    state for the EMM handle your program specified.\r
3468 \r
3469 \r
3470           EXAMPLE\r
3471 \r
3472           emm_handle                     DW ?\r
3473 \r
3474           MOV   DX,emm_handle            ; load EMM handle\r
3475           MOV   AH,47h                   ; load function code\r
3476           INT   67h                      ; call the memory manager\r
3477           OR    AH,AH                    ; check EMM status\r
3478           JNZ   emm_err_handler          ; jump to error handler on error\r
3479 \r
3480 \r
3481 \r
3482           EMM Functions                                                  54\r
3483 \f\r
3484 \r
3485 \r
3486 \r
3487 \r
3488           Function 9. Restore Page Map\r
3489 \r
3490 \r
3491 \r
3492           PURPOSE\r
3493 \r
3494                The Restore Page Map function restores the page mapping\r
3495                register contents on the expanded memory boards for a\r
3496                particular EMM handle.  This function lets your program\r
3497                restore the contents of the mapping registers its EMM handle\r
3498                saved.  (See Function 8, Save Page Map for the save opera-\r
3499                tion.)\r
3500 \r
3501                If you're writing a resident program, an interrupt service\r
3502                routine, or a device driver that uses expanded memory, you\r
3503                must restore the mapping hardware to the state it was in\r
3504                before your program took over.  You must save this state\r
3505                because application software using expanded memory might\r
3506                have been running when your program was invoked.\r
3507 \r
3508                The Restore Page Map function requires the EMM handle that\r
3509                was assigned to your resident program, interrupt service\r
3510                routine, or device driver at the time it was initialized. \r
3511                This is not the EMM handle that the application software was\r
3512                using when your software interrupted it.\r
3513 \r
3514                The Restore Page Map function restores the state of the map\r
3515                registers for only the 64K-byte page frame defined in\r
3516                versions 3.x of this specification.  Since all applications\r
3517                written to LIM versions 3.x require restoring the map\r
3518                register state of only this 64K-byte page frame, restoring\r
3519                the entire mapping state for a large number of mappable\r
3520                pages would be inefficient use of memory.  Applications that\r
3521                use a mappable memory region outside the LIM 3.x page frame\r
3522                should use Function 15 or 16 to save and restore the state\r
3523                of the map registers.\r
3524 \r
3525 \r
3526           CALLING PARAMETERS\r
3527 \r
3528                AH = 48h\r
3529                    Contains the Restore Page Map function.\r
3530 \r
3531                DX = emm_handle\r
3532                    Contains the EMM handle assigned to the interrupt\r
3533                    service routine that's servicing the software or\r
3534                    hardware interrupt.  The interrupt service routine needs\r
3535                    to restore the state of the page mapping hardware.\r
3536 \r
3537 \r
3538 \r
3539 \r
3540 \r
3541           EMM Functions                                                  55\r
3542 \f\r
3543 \r
3544 \r
3545 \r
3546 \r
3547           Function 9. Restore Page Map\r
3548 \r
3549 \r
3550 \r
3551           REGISTERS MODIFIED\r
3552 \r
3553                AX\r
3554 \r
3555 \r
3556           STATUS\r
3557 \r
3558                AH = 0   SUCCESSFUL.\r
3559                    The manager has restored the state of the page mapping\r
3560                    registers.\r
3561 \r
3562                AH = 80h   NON-RECOVERABLE.\r
3563                    The manager detected a malfunction in the memory manager\r
3564                    software.\r
3565 \r
3566                AH = 81h   NON-RECOVERABLE.\r
3567                    The manager detected a malfunction in the expanded\r
3568                    memory hardware.\r
3569 \r
3570                AH = 83h   NON-RECOVERABLE.\r
3571                    The memory manager couldn't find the EMM handle your\r
3572                    program specified.\r
3573 \r
3574                AH = 84h   NON-RECOVERABLE.\r
3575                    The function code passed to the memory manager is not\r
3576                    defined.\r
3577 \r
3578                AH = 8Eh   CONDITIONALLY-RECOVERABLE.\r
3579                    There is no page mapping register state in the save area\r
3580                    for the specified EMM handle.  Your program didn't save\r
3581                    the contents of the page mapping hardware, so Restore\r
3582                    Page can't restore it.\r
3583 \r
3584 \r
3585           EXAMPLE\r
3586 \r
3587           emm_handle                     DW ?\r
3588 \r
3589           MOV   DX,emm_handle            ; load EMM handle\r
3590           MOV   AH,48h                   ; load function code\r
3591           INT   67h                      ; call the memory manager\r
3592           OR    AH,AH                    ; check EMM status\r
3593           JNZ   emm_err_handler          ; jump to error handler on error\r
3594 \r
3595 \r
3596 \r
3597 \r
3598 \r
3599 \r
3600           EMM Functions                                                  56\r
3601 \f\r
3602 \r
3603 \r
3604 \r
3605 \r
3606           Function 10. Reserved\r
3607 \r
3608 \r
3609 \r
3610                In earlier versions of the Lotus/Intel/Microsoft Expanded\r
3611                Memory Specification, Function 10 returned the page mapping\r
3612                register I/O array.  This function is now reserved and new\r
3613                programs should not use it.\r
3614 \r
3615                Existing programs that use this function may still work\r
3616                correctly if the hardware is capable of supporting them. \r
3617                However, programs that use Functions 16 through 30 in\r
3618                Version 4.0 of this specification must not use Functions 10\r
3619                and 11.  These functions won't work correctly if your\r
3620                program attempts to mix the use of the new functions\r
3621                (Functions 16 through 30) and Functions 10 and 11.  Func-\r
3622                tions 10 and 11 are specific to the hardware on Intel\r
3623                expanded memory boards and will not work correctly on all\r
3624                vendors' expanded memory boards.\r
3625 \r
3626 \r
3627 \r
3628 \r
3629 \r
3630 \r
3631 \r
3632 \r
3633 \r
3634 \r
3635 \r
3636 \r
3637 \r
3638 \r
3639 \r
3640 \r
3641 \r
3642 \r
3643 \r
3644 \r
3645 \r
3646 \r
3647 \r
3648 \r
3649 \r
3650 \r
3651 \r
3652 \r
3653 \r
3654 \r
3655 \r
3656 \r
3657 \r
3658 \r
3659           EMM Functions                                                  57\r
3660 \f\r
3661 \r
3662 \r
3663 \r
3664 \r
3665           Function 11. Reserved\r
3666 \r
3667 \r
3668 \r
3669                In earlier versions of the Lotus/Intel/Microsoft Expanded\r
3670                Memory Specification, Function 11 returned a page transla-\r
3671                tion array.  This function is now reserved and new programs\r
3672                should not use it.\r
3673 \r
3674                Existing programs that use this function may still work\r
3675                correctly if the hardware is capable of supporting them. \r
3676                However, programs that use Functions 16 through 30 in\r
3677                Version 4.0 of this specification must not use Functions 10\r
3678                and 11.  These functions won't work correctly if your\r
3679                program attempts to mix the use of the new functions\r
3680                (Functions 16 through 30) and Functions 10 and 11.  Func-\r
3681                tions 10 and 11 are specific to the hardware on Intel\r
3682                expanded memory boards and will not work correctly on all\r
3683                vendors' expanded memory boards.\r
3684 \r
3685 \r
3686 \r
3687 \r
3688 \r
3689 \r
3690 \r
3691 \r
3692 \r
3693 \r
3694 \r
3695 \r
3696 \r
3697 \r
3698 \r
3699 \r
3700 \r
3701 \r
3702 \r
3703 \r
3704 \r
3705 \r
3706 \r
3707 \r
3708 \r
3709 \r
3710 \r
3711 \r
3712 \r
3713 \r
3714 \r
3715 \r
3716 \r
3717 \r
3718           EMM Functions                                                  58\r
3719 \f\r
3720 \r
3721 \r
3722 \r
3723 \r
3724           Function 12. Get Handle Count\r
3725 \r
3726 \r
3727 \r
3728           PURPOSE\r
3729 \r
3730                The Get Handle Count function returns the number of open EMM\r
3731                handles (including the operating system handle 0) in the\r
3732                system.\r
3733 \r
3734 \r
3735           CALLING PARAMETERS\r
3736 \r
3737                AH = 4Bh\r
3738                    Contains the Get Handle Count function.\r
3739 \r
3740 \r
3741           RESULTS\r
3742 \r
3743                These results are valid only if the status returned is zero.\r
3744 \r
3745                BX = total_open_emm_handles\r
3746                    Contains the number of open EMM handles [including the\r
3747                    operating system handle (0)].  This number will not\r
3748                    exceed 255.\r
3749 \r
3750 \r
3751           REGISTERS MODIFIED\r
3752 \r
3753                AX, BX\r
3754 \r
3755 \r
3756           STATUS\r
3757 \r
3758                AH = 0   SUCCESSFUL.\r
3759                    The manager has returned the number of active EMM\r
3760                    handles.\r
3761 \r
3762                AH = 80h   NON-RECOVERABLE.\r
3763                    The manager detected a malfunction in the memory manager\r
3764                    software.\r
3765 \r
3766                AH = 81h   NON-RECOVERABLE.\r
3767                    The manager detected a malfunction in the expanded\r
3768                    memory hardware.\r
3769 \r
3770                AH = 84h   NON-RECOVERABLE.\r
3771                    The function code passed to the memory manager is not\r
3772                    defined.\r
3773 \r
3774 \r
3775 \r
3776 \r
3777           EMM Functions                                                  59\r
3778 \f\r
3779 \r
3780 \r
3781 \r
3782 \r
3783           Function 12. Get Handle Count\r
3784 \r
3785 \r
3786 \r
3787           EXAMPLE\r
3788 \r
3789           total_open_emm_handles              DW ?\r
3790 \r
3791           MOV   AH,4Bh                        ; load function code\r
3792           INT   67h                           ; call the memory manger\r
3793           OR    AH,AH                         ; check EMM status\r
3794           JNZ   emm_err_handler               ; jump to error handler on   \r
3795                                               ; error\r
3796           MOV   total_open_emm_handles,BX     ; save total active handle   \r
3797                                               ; count\r
3798 \r
3799 \r
3800 \r
3801 \r
3802 \r
3803 \r
3804 \r
3805 \r
3806 \r
3807 \r
3808 \r
3809 \r
3810 \r
3811 \r
3812 \r
3813 \r
3814 \r
3815 \r
3816 \r
3817 \r
3818 \r
3819 \r
3820 \r
3821 \r
3822 \r
3823 \r
3824 \r
3825 \r
3826 \r
3827 \r
3828 \r
3829 \r
3830 \r
3831 \r
3832 \r
3833 \r
3834 \r
3835 \r
3836           EMM Functions                                                  60\r
3837 \f\r
3838 \r
3839 \r
3840 \r
3841 \r
3842           Function 13. Get Handle Pages\r
3843 \r
3844 \r
3845 \r
3846           PURPOSE\r
3847 \r
3848                The Get Handle Pages function returns the number of pages\r
3849                allocated to a specific EMM handle.\r
3850 \r
3851 \r
3852           CALLING PARAMETERS\r
3853 \r
3854                AH = 4Ch\r
3855                    Contains the Get Handle Pages function.\r
3856 \r
3857                DX = emm_handle\r
3858                    Contains the EMM handle.\r
3859 \r
3860 \r
3861           RESULTS\r
3862 \r
3863                These results are valid only if the status returned is zero.\r
3864 \r
3865                BX = num_pages_alloc_to_emm_handle\r
3866                    Contains the number of logical pages allocated to the\r
3867                    specified EMM handle.  This number never exceeds 2048\r
3868                    because the memory manager allows a maximum of 2048\r
3869                    pages (32M bytes) of expanded memory.\r
3870 \r
3871 \r
3872           REGISTERS MODIFIED\r
3873 \r
3874                AX, BX\r
3875 \r
3876 \r
3877           STATUS\r
3878 \r
3879                AH = 0   SUCCESSFUL.\r
3880                    The manager has returned the number of pages allocated\r
3881                    to the EMM handle.\r
3882 \r
3883                AH = 80h   NON-RECOVERABLE.\r
3884                    The manager detected a malfunction in the memory manager\r
3885                    software.\r
3886 \r
3887                AH = 81h   NON-RECOVERABLE.\r
3888                    The manager detected a malfunction in the expanded\r
3889                    memory hardware.\r
3890 \r
3891                AH = 83h   NON-RECOVERABLE.\r
3892                    The memory manager couldn't find the EMM handle your\r
3893                    program specified.\r
3894 \r
3895           EMM Functions                                                  61\r
3896 \f\r
3897 \r
3898 \r
3899 \r
3900 \r
3901           Function 13. Get Handle Pages\r
3902 \r
3903 \r
3904 \r
3905                AH = 84h   NON-RECOVERABLE.\r
3906                    The function code passed to the memory manager is not\r
3907                    defined.\r
3908 \r
3909 \r
3910           EXAMPLE\r
3911 \r
3912           emm_handle                          DW ?\r
3913           pages_alloc_to_handle               DW ?\r
3914 \r
3915           MOV   DX,emm_handle                 ; load EMM handle\r
3916           MOV   AH,4Ch                        ; load function code\r
3917           INT   67h                           ; call the memory manager\r
3918           OR    AH,AH                         ; check EMM status\r
3919           JNZ   emm_err_handler               ; jump to error handler on   \r
3920                                               ; error\r
3921           MOV   pages_alloc_to_handle,BX      ; save number of pages       \r
3922                                               ; allocated to specified     \r
3923                                               ; handle\r
3924 \r
3925 \r
3926 \r
3927 \r
3928 \r
3929 \r
3930 \r
3931 \r
3932 \r
3933 \r
3934 \r
3935 \r
3936 \r
3937 \r
3938 \r
3939 \r
3940 \r
3941 \r
3942 \r
3943 \r
3944 \r
3945 \r
3946 \r
3947 \r
3948 \r
3949 \r
3950 \r
3951 \r
3952 \r
3953 \r
3954           EMM Functions                                                  62\r
3955 \f\r
3956 \r
3957 \r
3958 \r
3959 \r
3960           Function 14. Get All Handle Pages\r
3961 \r
3962 \r
3963 \r
3964           PURPOSE\r
3965 \r
3966                The Get All Handle Pages function returns an array of the\r
3967                open EMM handles and the number of pages allocated to each\r
3968                one.\r
3969 \r
3970 \r
3971           CALLING PARAMETERS\r
3972 \r
3973                AH = 4Dh\r
3974                    Contains the Get All Handle Pages function.\r
3975 \r
3976                    handle_page_struct              STRUC\r
3977                        emm_handle                  DW ?\r
3978                        pages_alloc_to_handle       DW ?\r
3979                    handle_page_struct              ENDS\r
3980 \r
3981                ES:DI = pointer to handle_page\r
3982                    Contains a pointer to an array of structures where a\r
3983                    copy of all open EMM handles and the number of pages\r
3984                    allocated to each will be stored.  Each structure has\r
3985                    these two members:\r
3986 \r
3987                    .emm_handle\r
3988                        The first member is a word which contains the value\r
3989                        of the open EMM handle.  The values of the handles\r
3990                        this function returns will be in the range of 0 to\r
3991                        255 decimal (0000h to 00FFh).  The uppermost byte of\r
3992                        the handle is always zero.\r
3993 \r
3994                    .pages_alloc_to_handle\r
3995                        The second member is a word which contains the\r
3996                        number of pages allocated to the open EMM handle.\r
3997 \r
3998 \r
3999           RESULTS\r
4000 \r
4001                These results are valid only if the status returned is zero.\r
4002 \r
4003                BX = total_open_emm_handles\r
4004                    Contains the number of open EMM handles (including the\r
4005                    operating system handle [0]).  The number cannot be zero\r
4006                    because the operating system handle is always active and\r
4007                    cannot be deallocated.  This number will not exceed 255.\r
4008 \r
4009 \r
4010 \r
4011 \r
4012 \r
4013           EMM Functions                                                  63\r
4014 \f\r
4015 \r
4016 \r
4017 \r
4018 \r
4019           Function 14. Get All Handle Pages\r
4020 \r
4021 \r
4022 \r
4023           REGISTERS MODIFIED\r
4024 \r
4025                AX, BX\r
4026 \r
4027 \r
4028           STATUS\r
4029 \r
4030                AH = 0   SUCCESSFUL.\r
4031                    The manager has returned the array.\r
4032 \r
4033                AH = 80h   NON-RECOVERABLE.\r
4034                    The manager detected a malfunction in the memory manager\r
4035                    software.\r
4036 \r
4037                AH = 81h   NON-RECOVERABLE.\r
4038                    The manager detected a malfunction in the expanded\r
4039                    memory hardware.\r
4040 \r
4041                AH = 84h   NON-RECOVERABLE.\r
4042                    The function code passed to the memory manager is not\r
4043                    defined.\r
4044 \r
4045 \r
4046           EXAMPLE\r
4047 \r
4048           handle_page                    handle_page_struct 255 DUP (?)\r
4049           total_open_handles             DW ?\r
4050 \r
4051           MOV   AX,SEG handle_page\r
4052           MOV   ES,AX\r
4053           LEA   DI,handle_page           ; ES:DI points to handle_page\r
4054           MOV   AH,4Dh                   ; load function code\r
4055           INT   67h                      ; call the memory manager\r
4056           OR    AH,AH                    ; check the EMM status\r
4057           JNZ   emm_err_handler          ; jump to error handler on error\r
4058           MOV   total_open_handles,BX    ; save total open handle count\r
4059 \r
4060 \r
4061 \r
4062 \r
4063 \r
4064 \r
4065 \r
4066 \r
4067 \r
4068 \r
4069 \r
4070 \r
4071 \r
4072           EMM Functions                                                  64\r
4073 \f\r
4074 \r
4075 \r
4076 \r
4077 \r
4078           Function 15. Get/Set Page Map\r
4079           Get Page Map subfunction\r
4080 \r
4081 \r
4082 \r
4083           PURPOSE\r
4084 \r
4085                The Get Page Map subfunction saves the mapping context for\r
4086                all mappable memory regions (conventional and expanded) by\r
4087                copying the contents of the mapping registers from each\r
4088                expanded memory board to a destination array.  The applica-\r
4089                tion must pass a pointer to the destination array.  This\r
4090                subfunction doesn't require an EMM handle.\r
4091 \r
4092                Use this function instead of Functions 8 and 9 if you need\r
4093                to save or restore the mapping context but don't want (or\r
4094                have) to use a handle.\r
4095 \r
4096 \r
4097           CALLING PARAMETERS\r
4098 \r
4099                AX = 4E00h\r
4100                    Contains the Get Page Map subfunction.\r
4101 \r
4102                ES:DI = dest_page_map\r
4103                    Contains a pointer to the destination array address in\r
4104                    segment:offset format.  Use the Get Size of Page Map\r
4105                    Save Array subfunction to determine the size of the\r
4106                    desired array.\r
4107 \r
4108 \r
4109           RESULTS\r
4110 \r
4111                These results are valid only if the status returned is zero.\r
4112 \r
4113                dest_page_map\r
4114                    The array contains the state of all the mapping regis-\r
4115                    ters on all boards in the system.  It also contains any\r
4116                    additional information necessary to restore the boards\r
4117                    to their original state when the program invokes a Set\r
4118                    subfunction.\r
4119 \r
4120 \r
4121           REGISTERS MODIFIED\r
4122 \r
4123                AX\r
4124 \r
4125 \r
4126           STATUS\r
4127 \r
4128                AH = 0   SUCCESSFUL.\r
4129                    The manager has returned the array.\r
4130 \r
4131           EMM Functions                                                  65\r
4132 \f\r
4133 \r
4134 \r
4135 \r
4136 \r
4137           Function 15. Get/Set Page Map\r
4138           Get Page Map subfunction\r
4139 \r
4140 \r
4141 \r
4142                AH = 80h   NON-RECOVERABLE.\r
4143                    The manager detected a malfunction in the memory manager\r
4144                    software.\r
4145 \r
4146                AH = 81h   NON-RECOVERABLE.\r
4147                    The manager detected a malfunction in the expanded\r
4148                    memory hardware.\r
4149 \r
4150                AH = 84h   NON-RECOVERABLE.\r
4151                    The function code passed to the memory manager is not\r
4152                    defined.\r
4153 \r
4154                AH = 8Fh   NON-RECOVERABLE.\r
4155                    The subfunction parameter is invalid.\r
4156 \r
4157 \r
4158           EXAMPLE\r
4159 \r
4160           dest_page_map                  DB ? DUP (?)\r
4161 \r
4162           MOV   AX,SEG dest_page_map\r
4163           MOV   ES,AX\r
4164           LEA   DI,dest_page_map         ; ES:DI points to dest_page_map\r
4165           MOV   AX,4E00h                 ; load function code\r
4166           INT   67h                      ; call the memory manager\r
4167           OR    AH,AH                    ; check EMM status\r
4168           JNZ   emm_err_handler          ; jump to error handler on error\r
4169 \r
4170 \r
4171 \r
4172 \r
4173 \r
4174 \r
4175 \r
4176 \r
4177 \r
4178 \r
4179 \r
4180 \r
4181 \r
4182 \r
4183 \r
4184 \r
4185 \r
4186 \r
4187 \r
4188 \r
4189 \r
4190           EMM Functions                                                  66\r
4191 \f\r
4192 \r
4193 \r
4194 \r
4195 \r
4196           Function 15. Get/Set Page Map\r
4197           Set Page Map subfunction\r
4198 \r
4199 \r
4200 \r
4201           PURPOSE\r
4202 \r
4203                The Set Page Map subfunction restores the mapping context\r
4204                for all mappable memory regions (conventional and expanded)\r
4205                by copying the contents of a source array into the mapping\r
4206                registers on each expanded memory board in the system.  The\r
4207                application must pass a pointer to the source array.  This\r
4208                subfunction doesn't require an EMM handle.\r
4209 \r
4210                Use this function instead of Functions 8 and 9 if you need\r
4211                to save or restore the mapping context but don't want (or\r
4212                have) to use a handle.\r
4213 \r
4214 \r
4215           CALLING PARAMETERS\r
4216 \r
4217                AX = 4E01h\r
4218                    Contains the Set Page Map subfunction.\r
4219 \r
4220                DS:SI = source_page_map\r
4221                    Contains a pointer to the source array address in\r
4222                    segment:offset format.  The application must point to an\r
4223                    array which contains the mapping register state.  Use\r
4224                    the Get Size of Page Map Save Array subfunction to\r
4225                    determine the size of the desired array.\r
4226 \r
4227 \r
4228           REGISTERS MODIFIED\r
4229 \r
4230                AX\r
4231 \r
4232 \r
4233           STATUS\r
4234 \r
4235                AH = 0   SUCCESSFUL.\r
4236                    The manager has passed the array.\r
4237 \r
4238                AH = 80h   NON-RECOVERABLE.\r
4239                    The manager detected a malfunction in the memory manager\r
4240                    software.\r
4241 \r
4242                AH = 81h   NON-RECOVERABLE.\r
4243                    The manager detected a malfunction in the expanded\r
4244                    memory hardware.\r
4245 \r
4246 \r
4247 \r
4248 \r
4249           EMM Functions                                                  67\r
4250 \f\r
4251 \r
4252 \r
4253 \r
4254 \r
4255           Function 15. Get/Set Page Map\r
4256           Set Page Map subfunction\r
4257 \r
4258 \r
4259 \r
4260                AH = 84h   NON-RECOVERABLE.\r
4261                    The function code passed to the memory manager is not\r
4262                    defined.\r
4263 \r
4264                AH = 8Fh   NON-RECOVERABLE.\r
4265                    The subfunction parameter is invalid.\r
4266 \r
4267                AH = A3h   NON-RECOVERABLE.\r
4268                    The contents of the source array have been corrupted, or\r
4269                    the pointer passed to the subfunction is invalid.\r
4270 \r
4271 \r
4272           EXAMPLE\r
4273 \r
4274           source_page_map                DB ? DUP (?)\r
4275 \r
4276           MOV   AX,SEG source_page_map\r
4277           MOV   DS,AX\r
4278           LEA   SI,source_page_map       ; DS:SI points to source_page_map\r
4279           MOV   AX,4E01h                 ; load function code\r
4280           INT   67h                      ; call the memory manager\r
4281           OR    AH,AH                    ; check EMM status\r
4282           JNZ   emm_err_handler          ; jump to error handler on error\r
4283 \r
4284 \r
4285 \r
4286 \r
4287 \r
4288 \r
4289 \r
4290 \r
4291 \r
4292 \r
4293 \r
4294 \r
4295 \r
4296 \r
4297 \r
4298 \r
4299 \r
4300 \r
4301 \r
4302 \r
4303 \r
4304 \r
4305 \r
4306 \r
4307 \r
4308           EMM Functions                                                  68\r
4309 \f\r
4310 \r
4311 \r
4312 \r
4313 \r
4314           Function 15. Get/Set Page Map\r
4315           Get & Set Page Map subfunction\r
4316 \r
4317 \r
4318 \r
4319           PURPOSE\r
4320 \r
4321                The Get & Set Page Map subfunction simultaneously saves a\r
4322                current mapping context and restores a previous mapping\r
4323                context for all mappable memory regions (both conventional\r
4324                and expanded).  It first copies the contents of the mapping\r
4325                registers from each expanded memory board in the system into\r
4326                a destination array.  (The application must pass a pointer\r
4327                to the destination array.)  Then, the subfunction copies the\r
4328                contents of a source array into the mapping registers on\r
4329                each of the expanded memory boards.  (The application must\r
4330                pass a pointer to the source array.)\r
4331 \r
4332                Use this function instead of Functions 8 and 9 if you need\r
4333                to save or restore the mapping context but don't want (or\r
4334                have) to use a handle.\r
4335 \r
4336 \r
4337           CALLING PARAMETERS\r
4338 \r
4339                AX = 4E02h\r
4340                    Contains the Get & Set Page Map subfunction.\r
4341 \r
4342                ES:DI = dest_page_map\r
4343                    Contains a pointer to the destination array address in\r
4344                    segment:offset format.  The current contents of the map\r
4345                    registers will be saved in this array.\r
4346 \r
4347                DS:SI = source_page_map\r
4348                    Contains a pointer to the source array address in\r
4349                    segment:offset format.  The contents of this array will\r
4350                    be copied into the map registers.  The application must\r
4351                    point to an array which contains the mapping register\r
4352                    state.  This address is required only for the Set or Get\r
4353                    and Set subfunctions.\r
4354 \r
4355 \r
4356           RESULTS\r
4357 \r
4358                These results are valid only if the status returned is zero.\r
4359 \r
4360                dest_page_map\r
4361                    The array contains the mapping state.  It also contains\r
4362                    any additional information necessary to restore the\r
4363                    original state when the program invokes a Set subfunc-\r
4364                    tion.\r
4365 \r
4366 \r
4367           EMM Functions                                                  69\r
4368 \f\r
4369 \r
4370 \r
4371 \r
4372 \r
4373           Function 15. Get/Set Page Map\r
4374           Get & Set Page Map subfunction\r
4375 \r
4376 \r
4377 \r
4378           REGISTERS MODIFIED\r
4379 \r
4380                AX\r
4381 \r
4382 \r
4383           STATUS\r
4384 \r
4385                AH = 0   SUCCESSFUL.\r
4386                    The manager has returned and passed both arrays.\r
4387 \r
4388                AH = 80h   NON-RECOVERABLE.\r
4389                    The manager detected a malfunction in the memory manager\r
4390                    software.\r
4391 \r
4392                AH = 81h   NON-RECOVERABLE.\r
4393                    The manager detected a malfunction in the expanded\r
4394                    memory hardware.\r
4395 \r
4396                AH = 84h   NON-RECOVERABLE.\r
4397                    The function code passed to the memory manager is not\r
4398                    defined.\r
4399 \r
4400                AH = 8Fh   NON-RECOVERABLE.\r
4401                    The subfunction parameter is invalid.\r
4402 \r
4403                AH = A3h   NON-RECOVERABLE.\r
4404                    The contents of the source array have been corrupted, or\r
4405                    the pointer passed to the subfunction is invalid.\r
4406 \r
4407 \r
4408           EXAMPLE\r
4409 \r
4410           dest_page_map                  DB ? DUP (?)\r
4411 \r
4412           source_page_map                DB ? DUP (?)\r
4413 \r
4414           MOV   AX,SEG dest_page_map\r
4415           MOV   ES,AX\r
4416           MOV   AX,SEG source_page_map\r
4417           MOV   DS,AX\r
4418           LEA   DI,dest_page_map         ; ES:DI points to dest_page_map\r
4419           LEA   SI,source_page_map       ; DS:SI points to source_page_map\r
4420           MOV   AX,4E02h                 ; load function code\r
4421           INT   67h                      ; call the memory manager\r
4422           OR    AH,AH                    ; check EMM status\r
4423           JNZ   emm_err_handler          ; jump to error handler on error\r
4424 \r
4425 \r
4426           EMM Functions                                                  70\r
4427 \f\r
4428 \r
4429 \r
4430 \r
4431 \r
4432           Function 15. Get/Set Page Map\r
4433           Get Size of Page Map Save Array subfunction\r
4434 \r
4435 \r
4436 \r
4437           PURPOSE\r
4438 \r
4439                The Get Size of Page Map Save Array subfunction returns the\r
4440                storage requirements for the array passed by the other three\r
4441                subfunctions.  This subfunction doesn't require an EMM\r
4442                handle.\r
4443 \r
4444 \r
4445           CALLING PARAMETERS\r
4446 \r
4447                AX = 4E03h\r
4448                    Contains the Get Size of Page Map Save Array subfunc-\r
4449                    tion.  The size of this array depends on how the\r
4450                    expanded memory system is configured and how the\r
4451                    expanded memory manager is implemented.  Therefore, the\r
4452                    size must be determined after the memory manager is\r
4453                    loaded.\r
4454 \r
4455 \r
4456           RESULTS\r
4457 \r
4458                These results are valid only if the status returned is zero.\r
4459 \r
4460                AL = size_of_array\r
4461                    Contains the number of bytes that will be transferred to\r
4462                    the memory area an application supplies whenever a\r
4463                    program requests the Get, Set, or Get and Set subfunc-\r
4464                    tions.\r
4465 \r
4466 \r
4467           REGISTERS MODIFIED\r
4468 \r
4469                AX\r
4470 \r
4471 \r
4472           STATUS\r
4473 \r
4474                AH = 0   SUCCESSFUL.\r
4475                    The manager has returned the array size.\r
4476 \r
4477                AH = 80h   NON-RECOVERABLE.\r
4478                    The manager detected a malfunction in the memory manager\r
4479                    software.\r
4480 \r
4481                AH = 81h   NON-RECOVERABLE.\r
4482                    The manager detected a malfunction in the expanded\r
4483                    memory hardware.\r
4484 \r
4485           EMM Functions                                                  71\r
4486 \f\r
4487 \r
4488 \r
4489 \r
4490 \r
4491           Function 15. Get/Set Page Map\r
4492           Get Size of Page Map Save Array subfunction\r
4493 \r
4494 \r
4495 \r
4496                AH = 84h   NON-RECOVERABLE.\r
4497                    The function code passed to the memory manager is not\r
4498                    defined.\r
4499 \r
4500                AH = 8Fh   NON-RECOVERABLE.\r
4501                    The subfunction parameter is invalid.\r
4502 \r
4503 \r
4504           EXAMPLE\r
4505 \r
4506           size_of_array                  DB ?\r
4507 \r
4508           MOV   AX,4E03h                 ; load function code\r
4509           INT   67h                      ; call the memory manager\r
4510           OR    AH,AH                    ; check EMM status\r
4511           JNZ   emm_err_handler          ; jump to error handler on error\r
4512           MOV   size_of_array,AL         ; save array size\r
4513 \r
4514 \r
4515 \r
4516 \r
4517 \r
4518 \r
4519 \r
4520 \r
4521 \r
4522 \r
4523 \r
4524 \r
4525 \r
4526 \r
4527 \r
4528 \r
4529 \r
4530 \r
4531 \r
4532 \r
4533 \r
4534 \r
4535 \r
4536 \r
4537 \r
4538 \r
4539 \r
4540 \r
4541 \r
4542 \r
4543 \r
4544           EMM Functions                                                  72\r
4545 \f\r
4546 \r
4547 \r
4548 \r
4549 \r
4550           Function 16. Get/Set Partial Page Map\r
4551           Get Partial Page Map subfunction\r
4552 \r
4553 \r
4554 \r
4555           PURPOSE\r
4556 \r
4557                The Get Partial Page Map subfunction saves a partial mapping\r
4558                context for specific mappable memory regions in a system. \r
4559                Because this function saves only a subset of the entire\r
4560                mapping context, it uses much less memory for the save area\r
4561                and may be potentially faster than Function 15.  The\r
4562                subfunction does this by copying the contents of selected\r
4563                mapping registers from each expanded memory board to a\r
4564                destination array.\r
4565 \r
4566                The application must pass a pair of pointers.  The first\r
4567                points to a structure which specifies which mappable\r
4568                segments to save; the second points to the destination\r
4569                array.\r
4570 \r
4571                Use this function instead of Functions 8 and 9 if you need\r
4572                to save or restore the mapping context but don't want (or\r
4573                have) to use a handle.\r
4574 \r
4575 \r
4576           CALLING PARAMETERS\r
4577 \r
4578                AX = 4F00h\r
4579                    Contains the Get Partial Page Map subfunction.\r
4580 \r
4581                    partial_page_map_struct         STRUC\r
4582                        mappable_segment_count      DW ?\r
4583                        mappable_segment            DW (?) DUP (?)\r
4584                    partial_page_map_struct         ENDS\r
4585 \r
4586                DS:SI = partial_page_map\r
4587                    Contains a pointer to a structure which specifies only\r
4588                    those mappable memory regions which are to have their\r
4589                    mapping context saved.  The structure members are\r
4590                    described below.\r
4591 \r
4592                    .mappable_segment_count\r
4593                        The first member is a word which specifies the\r
4594                        number of members in the word array which immediate-\r
4595                        ly follows it.  This number should not exceed the\r
4596                        number of mappable segments in the system.\r
4597 \r
4598 \r
4599 \r
4600 \r
4601 \r
4602 \r
4603           EMM Functions                                                  73\r
4604 \f\r
4605 \r
4606 \r
4607 \r
4608 \r
4609           Function 16. Get/Set Partial Page Map\r
4610           Get Partial Page Map subfunction\r
4611 \r
4612 \r
4613 \r
4614                    .mappable_segment\r
4615                        The second member is a word array which contains the\r
4616                        segment addresses of the mappable memory regions\r
4617                        whose mapping contexts are to be saved.  The segment\r
4618                        address must be a mappable segment.  Use Function 25\r
4619                        to determine which segments are mappable.\r
4620 \r
4621                ES:DI = dest_array\r
4622                    Contains a pointer to the destination array address in\r
4623                    segment:offset format.  To determine the size of the\r
4624                    required array, see the Get Size of Partial Page Map\r
4625                    Save Array subfunction.\r
4626 \r
4627 \r
4628           RESULTS\r
4629 \r
4630                These results are valid only if the status returned is zero.\r
4631 \r
4632                dest_array\r
4633                    The array contains the partial mapping context and any\r
4634                    additional information necessary to restore this context\r
4635                    to its original state when the program invokes a Set\r
4636                    subfunction.\r
4637 \r
4638 \r
4639           REGISTERS MODIFIED\r
4640 \r
4641                AX\r
4642 \r
4643 \r
4644           STATUS\r
4645 \r
4646                AH = 0   SUCCESSFUL.\r
4647                    The manager has saved the partial map context.\r
4648 \r
4649                AH = 80h   NON-RECOVERABLE.\r
4650                    The manager detected a malfunction in the memory manager\r
4651                    software.\r
4652 \r
4653                AH = 81h   NON-RECOVERABLE.\r
4654                    The manager detected a malfunction in the expanded\r
4655                    memory hardware.\r
4656 \r
4657                AH = 84h   NON-RECOVERABLE.\r
4658                    The function code passed to the memory manager is not\r
4659                    defined.\r
4660 \r
4661 \r
4662           EMM Functions                                                  74\r
4663 \f\r
4664 \r
4665 \r
4666 \r
4667 \r
4668           Function 16. Get/Set Partial Page Map\r
4669           Get Partial Page Map subfunction\r
4670 \r
4671 \r
4672 \r
4673                AH = 8Bh   NON-RECOVERABLE.\r
4674                    One of the specified segments is not a mappable segment.\r
4675 \r
4676                AH = 8Fh   NON-RECOVERABLE.\r
4677                    The subfunction parameter is invalid.\r
4678 \r
4679                AH = A3h   NON-RECOVERABLE.\r
4680                    The contents of the partial page map structure have been\r
4681                    corrupted, the pointer passed to the subfunction is\r
4682                    invalid, or the mappable_segment_count exceeds the\r
4683                    number of mappable segments in the system.\r
4684 \r
4685 \r
4686           EXAMPLE\r
4687 \r
4688           partial_page_map               partial_page_map_struct <>\r
4689 \r
4690           dest_array                     DB ? DUP (?)\r
4691 \r
4692           MOV   AX,SEG partial_page_map\r
4693           MOV   DS,AX\r
4694           LEA   SI,partial_page_map      ; DS:SI points to partial_page_map\r
4695           MOV   AX,SEG dest_array\r
4696           MOV   ES,AX\r
4697           LEA   DI,dest_array            ; ES:DI points to dest_array\r
4698           MOV   AX,4F00h                 ; load function code\r
4699           INT   67h                      ; call the memory manager\r
4700           OR    AH,AH                    ; check EMM status\r
4701           JNZ   emm_err_handler          ; jump to error handler on error\r
4702 \r
4703 \r
4704 \r
4705 \r
4706 \r
4707 \r
4708 \r
4709 \r
4710 \r
4711 \r
4712 \r
4713 \r
4714 \r
4715 \r
4716 \r
4717 \r
4718 \r
4719 \r
4720 \r
4721           EMM Functions                                                  75\r
4722 \f\r
4723 \r
4724 \r
4725 \r
4726 \r
4727           Function 16. Get/Set Partial Page Map\r
4728           Set Partial Page Map subfunction\r
4729 \r
4730 \r
4731 \r
4732           PURPOSE\r
4733 \r
4734                The Set Partial Page Map subfunction provides a mechanism\r
4735                for restoring the mapping context for a partial mapping\r
4736                context for specific mappable memory regions in a system. \r
4737                Because this function restores only a subset of the entire\r
4738                mapping context and not the entire systems mapping context,\r
4739                it uses much less memory for the save area and is potential-\r
4740                ly faster than Function 15.  The subfunction does this by\r
4741                copying the contents of the source array to selected mapping\r
4742                registers on each expanded memory board.  The application\r
4743                passes a pointer to the source array.\r
4744 \r
4745                Use this function instead of Functions 8 and 9 if you need\r
4746                to save or restore the mapping context but don't want (or\r
4747                have) to use a handle.\r
4748 \r
4749 \r
4750           CALLING PARAMETERS\r
4751 \r
4752                AX = 4F01h\r
4753                    Contains the Set Partial Page Map subfunction\r
4754 \r
4755                            source_array     DB ? DUP (?)\r
4756 \r
4757                DS:SI = source_array\r
4758                    Contains a pointer to the source array in segment:offset\r
4759                    format.  The application must point to an array which\r
4760                    contains the partial mapping register state.  To deter-\r
4761                    mine the size of the required array, see the Get Size of\r
4762                    Partial Page Map Save Array subfunction.\r
4763 \r
4764 \r
4765           REGISTERS MODIFIED\r
4766 \r
4767                AX\r
4768 \r
4769 \r
4770           STATUS\r
4771 \r
4772                AH = 0   SUCCESSFUL.\r
4773                    The manager has restored the partial mapping context.\r
4774 \r
4775                AH = 80h   NON-RECOVERABLE.\r
4776                    The manager detected a malfunction in the memory manager\r
4777                    software.\r
4778 \r
4779 \r
4780           EMM Functions                                                  76\r
4781 \f\r
4782 \r
4783 \r
4784 \r
4785 \r
4786           Function 16. Get/Set Partial Page Map\r
4787           Set Partial Page Map subfunction\r
4788 \r
4789 \r
4790 \r
4791                AH = 81h   NON-RECOVERABLE.\r
4792                    The manager detected a malfunction in the expanded\r
4793                    memory hardware.\r
4794 \r
4795                AH = 84h   NON-RECOVERABLE.\r
4796                    The function code passed to the memory manager is not\r
4797                    defined.\r
4798 \r
4799                AH = 8Fh   NON-RECOVERABLE.\r
4800                    The subfunction parameter is invalid.\r
4801 \r
4802                AH = A3h   NON-RECOVERABLE.\r
4803                    The contents of the source array have been corrupted, or\r
4804                    the pointer passed to the subfunction is invalid.\r
4805 \r
4806 \r
4807           EXAMPLE\r
4808 \r
4809           MOV   AX,SEG source_array\r
4810           MOV   DS,AX\r
4811           LEA   SI,source_array          ; DS:SI points to source_array\r
4812           MOV   AX,4F01h                 ; load function code\r
4813           INT   67h                      ; call the memory manager\r
4814           OR    AH,AH                    ; check EMM status\r
4815           JNZ   emm_err_handler          ; jump to error handler on error\r
4816 \r
4817 \r
4818 \r
4819 \r
4820 \r
4821 \r
4822 \r
4823 \r
4824 \r
4825 \r
4826 \r
4827 \r
4828 \r
4829 \r
4830 \r
4831 \r
4832 \r
4833 \r
4834 \r
4835 \r
4836 \r
4837 \r
4838 \r
4839           EMM Functions                                                  77\r
4840 \f\r
4841 \r
4842 \r
4843 \r
4844 \r
4845           Function 16. Get/Set Partial Page Map\r
4846           Get Size of Partial Page Map Save Array subfunction\r
4847 \r
4848 \r
4849 \r
4850           PURPOSE\r
4851 \r
4852                The Get Size of Partial Page Map Save Array subfunction\r
4853                returns the storage requirements for the array passed by the\r
4854                other two subfunctions.  This subfunction doesn't require an\r
4855                EMM handle.\r
4856 \r
4857 \r
4858           CALLING PARAMETERS\r
4859 \r
4860                AX = 4F02h\r
4861                    Contains the Get Size of Partial Page Map Save Array\r
4862                    subfunction.  The size of this array depends on the\r
4863                    expanded memory system configuration and the implementa-\r
4864                    tion of the expanded memory manager.  Therefore, it will\r
4865                    vary between hardware configurations and implementations\r
4866                    and must be determined after a specific memory manager\r
4867                    is loaded.\r
4868 \r
4869                BX = number of pages in the partial array\r
4870                    Contains the number of pages in the partial map to be\r
4871                    saved by the Get/Set Partial Page Map subfunctions. \r
4872                    This number should be the same as the mappable_seg-\r
4873                    ment_count in the Get Partial Page Map subfunction.\r
4874 \r
4875 \r
4876           RESULTS\r
4877 \r
4878                These results are valid only if the status returned is zero.\r
4879 \r
4880                AL = size_of_partial_save_array\r
4881                    Contains the number of bytes that will be transferred to\r
4882                    the memory areas supplied by an application whenever a\r
4883                    program requests the Get or Set subfunction.\r
4884 \r
4885 \r
4886           REGISTERS MODIFIED\r
4887 \r
4888                AX\r
4889 \r
4890 \r
4891           STATUS\r
4892 \r
4893                AH = 0   SUCCESSFUL.\r
4894                    The manager has returned the array size.\r
4895 \r
4896 \r
4897 \r
4898           EMM Functions                                                  78\r
4899 \f\r
4900 \r
4901 \r
4902 \r
4903 \r
4904           Function 16. Get/Set Partial Page Map\r
4905           Get Size of Partial Page Map Save Array subfunction\r
4906 \r
4907 \r
4908 \r
4909                AH = 80h   NON-RECOVERABLE.\r
4910                    The manager detected a malfunction in the memory manager\r
4911                    software.\r
4912 \r
4913                AH = 81h   NON-RECOVERABLE.\r
4914                    The manager detected a malfunction in the expanded\r
4915                    memory hardware.\r
4916 \r
4917                AH = 84h   NON-RECOVERABLE.\r
4918                    The function code passed to the memory manager is not\r
4919                    defined.\r
4920 \r
4921                AH = 8Bh   NON-RECOVERABLE.\r
4922                    The number of pages in the partial array is outside the\r
4923                    range of physical pages in the system.\r
4924 \r
4925                AH = 8Fh   NON-RECOVERABLE.\r
4926                    The subfunction parameter is invalid.\r
4927 \r
4928 \r
4929           EXAMPLE\r
4930 \r
4931           number_of_pages_to_map              DW ?\r
4932           size_of_partial_save_array          DB ?\r
4933 \r
4934           MOV   BX,number_of_pages_to_map\r
4935           MOV   AX,4F02h                      ; load function code\r
4936           INT   67h                           ; call the memory manager\r
4937           OR    AH,AH                         ; check EMM status\r
4938           JNZ   emm_err_handler               ; jump to error handler on   \r
4939                                               ; error\r
4940           MOV   size_of_partial_save_array,AL ; save array size\r
4941 \r
4942 \r
4943 \r
4944 \r
4945 \r
4946 \r
4947 \r
4948 \r
4949 \r
4950 \r
4951 \r
4952 \r
4953 \r
4954 \r
4955 \r
4956 \r
4957           EMM Functions                                                  79\r
4958 \f\r
4959 \r
4960 \r
4961 \r
4962 \r
4963           Function 17. Map/Unmap Multiple Handle Pages\r
4964 \r
4965 \r
4966 \r
4967           PURPOSE\r
4968 \r
4969                This function can, in a single invocation, map (or unmap)\r
4970                logical pages into as many physical pages as the system\r
4971                supports.  Consequently, it has less execution overhead than\r
4972                mapping pages one at a time.  For applications which do a\r
4973                lot of page mapping, this is the preferred mapping method.\r
4974 \r
4975 \r
4976           Mapping Multiple Pages\r
4977 \r
4978                The handle passed to this function determines what type of\r
4979                logical pages are being mapped.  Logical pages that Function\r
4980                4 and Function 27 (Allocate Standard Pages subfunction)\r
4981                allocate are referred to as pages and are 16K bytes. \r
4982                Logical pages that Function 27 (Allocate Raw Pages subfunc-\r
4983                tion) allocates are referred to as raw pages and might not\r
4984                be the same size as the pages Function 4 and Function 27\r
4985                (Allocate Standard Pages subfunction) allocate.\r
4986 \r
4987 \r
4988           Unmapping Multiple Pages\r
4989 \r
4990                This function can make specific physical pages unavailable\r
4991                for reading or writing.  A logical page which is unmapped\r
4992                from a specific physical page cannot be read or written from\r
4993                that physical page.  The logical page which is unavailable\r
4994                (unmapped) can be made available again by mapping it, or a\r
4995                new logical page, at the physical page that was unmapped. \r
4996                Unmapping a physical page is accomplished by setting the\r
4997                logical page it is associated with to FFFFh.\r
4998 \r
4999                You might unmap an entire set of mapped pages, for example,\r
5000                before loading and executing a program.  This ensures that\r
5001                the loaded program won't be able to access the pages your\r
5002                program has mapped.  However, you must save the mapping\r
5003                context before you unmap the physical pages.  This enables\r
5004                you to restore it later so that you may access the memory\r
5005                you had mapped there.  You can save the mapping context with\r
5006                Functions 8, 15, or 16.  You can restore the mapping context\r
5007                with Functions 9, 15, or 16.\r
5008 \r
5009 \r
5010           Mapping and Unmapping Multiple Pages Simultaneously\r
5011 \r
5012                Both mapping and unmapping pages can be done in the same\r
5013                invocation.\r
5014 \r
5015 \r
5016           EMM Functions                                                  80\r
5017 \f\r
5018 \r
5019 \r
5020 \r
5021 \r
5022           Function 17. Map/Unmap Multiple Handle Pages\r
5023 \r
5024 \r
5025 \r
5026                Mapping or unmapping no pages is not considered an error. \r
5027                If a request to map or unmap zero pages is made, nothing is\r
5028                done and no error is returned.\r
5029 \r
5030 \r
5031           Alternate Mapping and Unmapping Methods\r
5032 \r
5033                You can map or unmap pages using two methods.  Both methods\r
5034                produce identical results.\r
5035 \r
5036                1.  The first method specifies both a logical page and a\r
5037                    physical page at which the logical page is to be mapped. \r
5038                    This method is an extension of Function 5 (Map Handle\r
5039                    Page).\r
5040 \r
5041                2.  The second method specifies both a logical page and a\r
5042                    corresponding segment address at which the logical page\r
5043                    is to be mapped.  While this is functionally the same as\r
5044                    the first method, it may be easier to use the actual\r
5045                    segment address of a physical page than to use a number\r
5046                    which only represents its location.  The memory manager\r
5047                    verifies whether the specified segment address falls on\r
5048                    the boundary of a mappable physical page.  The manager\r
5049                    then translates the segment address passed to it into\r
5050                    the necessary internal representation to map the pages.\r
5051 \r
5052 \r
5053 \r
5054 \r
5055 \r
5056 \r
5057 \r
5058 \r
5059 \r
5060 \r
5061 \r
5062 \r
5063 \r
5064 \r
5065 \r
5066 \r
5067 \r
5068 \r
5069 \r
5070 \r
5071 \r
5072 \r
5073 \r
5074 \r
5075           EMM Functions                                                  81\r
5076 \f\r
5077 \r
5078 \r
5079 \r
5080 \r
5081           Function 17. Map/Unmap Multiple Handle Pages\r
5082           Logical Page/Physical Page Method\r
5083 \r
5084 \r
5085           CALLING PARAMETERS\r
5086 \r
5087                AX = 5000h\r
5088                    Contains the Map/Unmap Multiple Handle Pages subfunction\r
5089                    using the logical page/physical page method.\r
5090 \r
5091                    log_to_phys_map_struct          STRUC\r
5092                        log_page_number             DW ?\r
5093                        phys_page_number            DW ?\r
5094                    log_to_phys_map_struct          ENDS\r
5095 \r
5096                DX = handle\r
5097                    Contains the EMM handle.\r
5098 \r
5099                CX = log_to_phys_map_len\r
5100                    Contains the number of entries in the array.  For\r
5101                    example, if the array contained four pages to map or\r
5102                    unmap, then CX would contain 4.  The number in CX should\r
5103                    not exceed the number of mappable pages in the system.\r
5104 \r
5105                DS:SI = pointer to log_to_phys_map array\r
5106                    Contains a pointer to an array of structures that\r
5107                    contains the information necessary to map the desired\r
5108                    pages.  The array is made up of the following two\r
5109                    elements:\r
5110 \r
5111                    .log_page_number\r
5112                        The first member is a word which contains the number\r
5113                        of the logical page which is to be mapped.  Logical\r
5114                        pages are numbered zero-relative, so the number for\r
5115                        a logical page can only range from zero to (maximum\r
5116                        number of logical pages allocated to the handle -\r
5117                        1).\r
5118 \r
5119                        If the logical page number is set to FFFFh, the\r
5120                        physical page associated with it is unmapped rather\r
5121                        than mapped.  Unmapping a physical page makes it\r
5122                        inaccessible for reading or writing.\r
5123 \r
5124                    .phys_page_number\r
5125                        The second member is a word which contains the\r
5126                        number of the physical page at which the logical\r
5127                        page is to be mapped.  Physical pages are numbered\r
5128                        zero-relative, so the number for a physical page can\r
5129                        only range from zero to (maximum number of physical\r
5130                        pages supported in the system - 1).\r
5131 \r
5132 \r
5133 \r
5134           EMM Functions                                                  82\r
5135 \f\r
5136 \r
5137 \r
5138 \r
5139 \r
5140           Function 17. Map/Unmap Multiple Handle Pages\r
5141           Logical Page/Physical Page Method\r
5142 \r
5143 \r
5144 \r
5145           REGISTERS MODIFIED\r
5146 \r
5147                AX\r
5148 \r
5149 \r
5150           STATUS\r
5151 \r
5152                AH = 0   SUCCESSFUL.\r
5153                    The logical pages have been mapped, or unmapped, at the\r
5154                    specified physical pages.\r
5155 \r
5156                AH = 80h   NON-RECOVERABLE.\r
5157                    The manager has detected a malfunction in the memory\r
5158                    manager software.\r
5159 \r
5160                AH = 81h   NON-RECOVERABLE.\r
5161                    The manager has detected a malfunction in the expanded\r
5162                    memory hardware.\r
5163 \r
5164                AH = 83h   NON-RECOVERABLE.\r
5165                    The manager couldn't find the specified EMM handle.  The\r
5166                    manager doesn't currently have any information pertain-\r
5167                    ing to the specified EMM handle.  The program has\r
5168                    probably corrupted its EMM handle.\r
5169 \r
5170                AH = 84h   NON-RECOVERABLE.\r
5171                    The function code passed to the manager is not defined.\r
5172 \r
5173                AH = 8Ah   RECOVERABLE.\r
5174                    One or more of the mapped logical pages is out of the\r
5175                    range of logical pages allocated to the EMM handle.  The\r
5176                    program can recover by attempting to map a logical page\r
5177                    which is within the bounds for the specified EMM handle. \r
5178                    When this error occurs, the only pages mapped were the\r
5179                    ones valid up to the point that the error occurred.\r
5180 \r
5181                AH = 8Bh   RECOVERABLE.\r
5182                    One or more of the physical pages is out of the range of\r
5183                    mappable physical pages, or the log_to_phys_map_len\r
5184                    exceeds the number of mappable pages in the system.  The\r
5185                    program can recover from this condition by attempting to\r
5186                    map into memory at the physical page which is in the\r
5187                    range of the physical page numbers supported by the\r
5188                    system.  When this error occurs, the only pages mapped\r
5189                    were the ones valid up to the point that the error\r
5190                    occurred.\r
5191 \r
5192 \r
5193           EMM Functions                                                  83\r
5194 \f\r
5195 \r
5196 \r
5197 \r
5198 \r
5199           Function 17. Map/Unmap Multiple Handle Pages\r
5200           Logical Page/Physical Page Method\r
5201 \r
5202 \r
5203 \r
5204                AH = 8Fh   NON-RECOVERABLE.\r
5205                    The subfunction parameter is invalid.\r
5206 \r
5207 \r
5208           EXAMPLE\r
5209 \r
5210           log_to_phys_map            log_to_phys_map_struct ? DUP (?)\r
5211 \r
5212           emm_handle                 DW ?\r
5213 \r
5214           MOV   AX,SEG log_to_phys_map\r
5215           MOV   DS,AX\r
5216           LEA   SI,log_to_phys_map            ; DS:SI points to\r
5217                                               ; log_to_phys_map\r
5218           MOV   CX,LENGTH log_to_phys_map     ; set length field\r
5219           MOV   DX,emm_handle\r
5220           MOV   AX,5000h                      ; load function code\r
5221           INT   67h                           ; call the memory manager\r
5222           OR    AH,AH                         ; check EMM status\r
5223           JNZ   emm_err_handler               ; jump to error handler on   \r
5224                                               ; error\r
5225 \r
5226 \r
5227 \r
5228 \r
5229 \r
5230 \r
5231 \r
5232 \r
5233 \r
5234 \r
5235 \r
5236 \r
5237 \r
5238 \r
5239 \r
5240 \r
5241 \r
5242 \r
5243 \r
5244 \r
5245 \r
5246 \r
5247 \r
5248 \r
5249 \r
5250 \r
5251 \r
5252           EMM Functions                                                  84\r
5253 \f\r
5254 \r
5255 \r
5256 \r
5257 \r
5258           Function 17. Map/Unmap Multiple Handle Pages\r
5259           Logical Page/Segment Address Method\r
5260 \r
5261 \r
5262           CALLING PARAMETERS\r
5263 \r
5264                AX = 5001h\r
5265                    Contains the Map/Unmap Multiple Handle Pages subfunction\r
5266                    using the logical page/segment address method.\r
5267 \r
5268                    log_to_seg_map_struct           STRUC\r
5269                        log_page_number             DW ?\r
5270                        mappable_segment_address    DW ?\r
5271                    log_to_seg_map_struct           ENDS\r
5272 \r
5273                DX = handle\r
5274                    Contains the EMM handle.\r
5275 \r
5276                CX = log_to_segment_map_len\r
5277                    Contains the number of entries in the array.  For\r
5278                    example, if the array contained four pages to map or\r
5279                    unmap, then CX would contain four.\r
5280 \r
5281                DS:SI = pointer to log_to_segment_map array\r
5282                    Contains a pointer to an array of structures that\r
5283                    contains the information necessary to map the desired\r
5284                    pages.  The array is made up of the following elements:\r
5285 \r
5286                    .log_page_number\r
5287                        The first member is a word which contains the number\r
5288                        of the logical pages to be mapped.  Logical pages\r
5289                        are numbered zero-relative, so the number for a\r
5290                        logical page can range from zero to (maximum number\r
5291                        of logical pages allocated to the handle - 1).\r
5292 \r
5293                        If the logical page number is set to FFFFh, the\r
5294                        physical page associated with it is unmapped rather\r
5295                        than mapped.  Unmapping a physical page makes it\r
5296                        inaccessible for reading or writing.\r
5297 \r
5298                    .mappable_segment_address\r
5299                        The second member is a word which contains the\r
5300                        segment address at which the logical page is to be\r
5301                        mapped.  This segment address must correspond\r
5302                        exactly to a mappable segment address.  The mappable\r
5303                        segment addresses are available with Function 25\r
5304                        (Get Mappable Physical Address Array).\r
5305 \r
5306 \r
5307           REGISTERS MODIFIED\r
5308 \r
5309                AX\r
5310 \r
5311           EMM Functions                                                  85\r
5312 \f\r
5313 \r
5314 \r
5315 \r
5316 \r
5317           Function 17. Map/Unmap Multiple Handle Pages\r
5318           Logical Page/Segment Address Method\r
5319 \r
5320 \r
5321 \r
5322           STATUS\r
5323 \r
5324                AH = 0   SUCCESSFUL.\r
5325                    The logical pages have been mapped (or unmapped) at the\r
5326                    specified physical pages.\r
5327 \r
5328                AH = 80h   NON-RECOVERABLE.\r
5329                    The manager has detected a malfunction in the memory\r
5330                    manager software.\r
5331 \r
5332                AH = 81h   NON-RECOVERABLE.\r
5333                    The manager has detected a malfunction in the expanded\r
5334                    memory hardware.\r
5335 \r
5336                AH = 83h   NON-RECOVERABLE.\r
5337                    The manager could not find the specified EMM handle. \r
5338                    The manager doesn't currently have any information\r
5339                    pertaining to the specified EMM handle.  The program has\r
5340                    probably corrupted its EMM handle.\r
5341 \r
5342                AH = 84h   NON-RECOVERABLE.\r
5343                    The function code passed to the manager is not defined.\r
5344 \r
5345                AH = 8Ah   RECOVERABLE.\r
5346                    One or more of the logical pages to be mapped is out of\r
5347                    the range of logical pages allocated to the EMM handle. \r
5348                    The program can recover from this condition by mapping a\r
5349                    logical page which is within the bounds for the speci-\r
5350                    fied EMM handle.  When this error occurs, the only pages\r
5351                    mapped or unmapped were the ones valid up to the point\r
5352                    that the error occurred.\r
5353 \r
5354                AH = 8Bh   RECOVERABLE.\r
5355                    One or more of the mappable segment addresses specified\r
5356                    is not mappable, the segment address doesn't fall\r
5357                    exactly on a mappable address boundary, or the log_to_-\r
5358                    segment_map_len exceeds the number of mappable segments\r
5359                    in the system.  The program can recover from this\r
5360                    condition by mapping into memory on an exact mappable\r
5361                    segment address.  When this error occurs, the only pages\r
5362                    mapped were the ones valid up to the point that the\r
5363                    error occurred.\r
5364 \r
5365                AH = 8Fh   NON-RECOVERABLE.\r
5366                    The subfunction parameter is invalid.\r
5367 \r
5368 \r
5369 \r
5370           EMM Functions                                                  86\r
5371 \f\r
5372 \r
5373 \r
5374 \r
5375 \r
5376           Function 17. Map/Unmap Multiple Handle Pages\r
5377           Logical Page/Segment Address Method\r
5378 \r
5379 \r
5380 \r
5381           EXAMPLE\r
5382 \r
5383           log_to_seg_map             log_to_seg_map_struct 4 DUP (?)\r
5384 \r
5385           emm_handle                 DW ?\r
5386 \r
5387           MOV   AX,SEG log_to_seg_map\r
5388           MOV   DS,AX\r
5389           LEA   SI,log_to_seg_map             ; DS:SI points to\r
5390                                               ; log_to_seg_map\r
5391           MOV   CX,LENGTH log_to_seg_map\r
5392           MOV   DX,emm_handle\r
5393           MOV   AX,5001h                      ; load function code\r
5394           INT   67h                           ; call the memory manager\r
5395           OR    AH,AH                         ; check EMM status\r
5396           JNZ   emm_err_handler               ; jump to error handler on   \r
5397                                               ; error\r
5398 \r
5399 \r
5400 \r
5401 \r
5402 \r
5403 \r
5404 \r
5405 \r
5406 \r
5407 \r
5408 \r
5409 \r
5410 \r
5411 \r
5412 \r
5413 \r
5414 \r
5415 \r
5416 \r
5417 \r
5418 \r
5419 \r
5420 \r
5421 \r
5422 \r
5423 \r
5424 \r
5425 \r
5426 \r
5427 \r
5428 \r
5429           EMM Functions                                                  87\r
5430 \f\r
5431 \r
5432 \r
5433 \r
5434 \r
5435           Function 18. Reallocate Pages\r
5436 \r
5437 \r
5438 \r
5439           PURPOSE\r
5440 \r
5441                This function allows an application program to increase or\r
5442                decrease (reallocate) the number of logical pages allocated\r
5443                to an EMM handle.  There are four reallocation cases of\r
5444                interest:\r
5445 \r
5446                1.  A reallocation count of zero.  The handle assigned to\r
5447                    the application remains assigned and is still available\r
5448                    for use by the application.  The memory manager won't\r
5449                    reassign the handle to any other application.  However,\r
5450                    the handle will have any currently allocated pages\r
5451                    returned to the memory manager.  The application must\r
5452                    invoke the Deallocate Pages function (Function 6) before\r
5453                    returning to DOS, or the handle will remain assigned and\r
5454                    no other application will be able to use it.\r
5455 \r
5456                2.  A reallocation count equal to the current allocation\r
5457                    count.  This is not treated as an error, and a success-\r
5458                    ful status is returned.\r
5459 \r
5460                3.  A reallocation count greater than the current allocation\r
5461                    count.  The memory manager will attempt to add new pages\r
5462                    to those pages already allocated to the specified EMM\r
5463                    handle.  The number of new pages added is the difference\r
5464                    between the reallocation count and the current alloca-\r
5465                    tion count.  The sequence of logical pages allocated to\r
5466                    the EMM handle remains continuous after this operation. \r
5467                    The newly allocated pages have logical page numbers\r
5468                    which begin where the previously allocated pages ended,\r
5469                    and continue in ascending sequence.\r
5470 \r
5471                4.  A reallocation count less than the current allocation\r
5472                    count.  The memory manager will attempt to subtract some\r
5473                    of the currently allocated pages and return them to the\r
5474                    memory manager.  The number of old pages subtracted is\r
5475                    the difference between the current allocation count and\r
5476                    the re-allocation count.  The pages are subtracted from\r
5477                    the end of the sequence of pages currently allocated to\r
5478                    the specified EMM handle.  The sequence of logical pages\r
5479                    allocated to the EMM handle remains continuous after\r
5480                    this operation.\r
5481 \r
5482 \r
5483 \r
5484 \r
5485 \r
5486 \r
5487 \r
5488           EMM Functions                                                  88\r
5489 \f\r
5490 \r
5491 \r
5492 \r
5493 \r
5494           Function 18. Reallocate Pages\r
5495 \r
5496 \r
5497 \r
5498           The handle determines what type of logical pages are being\r
5499           reallocated.  Logical pages which were originally allocated with\r
5500           Function 4 or Function 27 (Allocate Standard Pages subfunction)\r
5501           are called pages and are 16K bytes long.  Logical pages which\r
5502           were allocated with Function 27 (Allocate Raw Pages subfunction)\r
5503           are called raw pages and might not be the same size as pages\r
5504           allocated with Function 4.\r
5505 \r
5506 \r
5507           CALLING PARAMETERS\r
5508 \r
5509                AH = 51h\r
5510                    Contains the Reallocate Handle Pages function.\r
5511 \r
5512                DX = handle\r
5513                    Contains the EMM handle.\r
5514 \r
5515                BX = reallocation_count\r
5516                    Contains the total number of pages this handle should\r
5517                    have allocated to it after this function is invoked.\r
5518 \r
5519 \r
5520           RESULTS\r
5521 \r
5522                BX = number of pages allocated to handle after reallocation\r
5523                    Contains the number of pages now allocated to the EMM\r
5524                    handle after the pages have been added or subtracted. \r
5525                    If the status returned is not zero, the value in BX is\r
5526                    equal to the number of pages allocated to the handle\r
5527                    prior to the invocation of this function.  This informa-\r
5528                    tion can be used to verify that the request generated\r
5529                    the expected results.\r
5530 \r
5531 \r
5532           REGISTERS MODIFIED\r
5533 \r
5534                AX, BX\r
5535 \r
5536 \r
5537           STATUS\r
5538 \r
5539                AH = 0   SUCCESSFUL.\r
5540                    The pages specified have been added to or subtracted\r
5541                    from the handle specified.\r
5542 \r
5543                AH = 80h   NON-RECOVERABLE.\r
5544                    The manager has detected a malfunction in the memory\r
5545                    manager software.\r
5546 \r
5547           EMM Functions                                                  89\r
5548 \f\r
5549 \r
5550 \r
5551 \r
5552 \r
5553           Function 18. Reallocate Pages\r
5554 \r
5555 \r
5556 \r
5557                AH = 81h   NON-RECOVERABLE.\r
5558                    The manager has detected a malfunction in the expanded\r
5559                    memory hardware.\r
5560 \r
5561                AH = 83h   NON-RECOVERABLE.\r
5562                    The manager could not find the specified EMM handle. \r
5563                    The manager doesn't have any information pertaining to\r
5564                    the specified EMM handle.  The program may have cor-\r
5565                    rupted its EMM handle.\r
5566 \r
5567                AH = 84h   NON-RECOVERABLE.\r
5568                    The function code passed to the manager is not defined.\r
5569 \r
5570                AH = 87h   RECOVERABLE.\r
5571                    The number of pages that are available in the system is\r
5572                    insufficient for the new allocation request.  The\r
5573                    program can recover from this condition by specifying\r
5574                    fewer pages be allocated to the EMM handle.\r
5575 \r
5576                AH = 88h   RECOVERABLE.\r
5577                    The number of unallocated pages is insufficient for the\r
5578                    new allocation request.  The program can recover from\r
5579                    this condition by either requesting again when addition-\r
5580                    al pages are available or specifying fewer pages.\r
5581 \r
5582 \r
5583           EXAMPLE\r
5584 \r
5585           emm_handle                          DW ?\r
5586           realloc_count                       DW ?\r
5587           current_alloc_page_count            DW ?\r
5588 \r
5589           MOV   DX,emm_handle                 ; specify EMM handle\r
5590           MOV   BX,realloc_count              ; specify count\r
5591           MOV   AH,51h                        ; load function code\r
5592           INT   67h                           ; call the memory manager\r
5593           OR    AH,AH                         ; check EMM status\r
5594           JNZ   emm_err_handler               ; jump to error handler on   \r
5595                                               ; error\r
5596           MOV   current_alloc_page_count,BX\r
5597 \r
5598 \r
5599 \r
5600 \r
5601 \r
5602 \r
5603 \r
5604 \r
5605 \r
5606           EMM Functions                                                  90\r
5607 \f\r
5608 \r
5609 \r
5610 \r
5611 \r
5612           Function 19. Get/Set Handle Attribute\r
5613 \r
5614 \r
5615 \r
5616           Design Considerations\r
5617 \r
5618                This function is an option which will probably not be\r
5619                available in a typical expanded memory manager, system, or\r
5620                memory board.  Most personal computer systems disable memory\r
5621                refresh signals for a considerable period during a warm\r
5622                boot.  This can corrupt some of the data in memory boards,\r
5623                even though there is no problem with the design of the\r
5624                memory board, its operation, or the memory chips.  This\r
5625                memory refresh deficiency is present in the software design\r
5626                of the ROM BIOS in most personal computer systems.\r
5627 \r
5628                The majority of memory board designs, chip types, or\r
5629                personal computer systems won't be able to support the non-\r
5630                volatility feature.  The reason that this ROM BIOS deficien-\r
5631                cy is not evident in the conventional or extended memory\r
5632                area is that the ROM BIOS always initializes this area\r
5633                during a warm boot.  Memory data integrity is not a problem\r
5634                with the conventional or extended memory region, because it\r
5635                isn't physically possible to have data retained there across\r
5636                a warm boot event -- the ROM BIOS sets it to zero.\r
5637 \r
5638                Consequently, expanded memory board manufacturers should not\r
5639                supply this function unless their board can guarantee the\r
5640                integrity of data stored in the board's memory during a warm\r
5641                boot.  Generally, this means the memory board has an\r
5642                independent memory refresh controller which does not depend\r
5643                on the system board's memory refresh.\r
5644 \r
5645                If the expanded memory manager, system, or memory board\r
5646                cannot support this feature, it should return the not\r
5647                supported status described in the function.\r
5648 \r
5649 \r
5650 \r
5651 \r
5652 \r
5653 \r
5654 \r
5655 \r
5656 \r
5657 \r
5658 \r
5659 \r
5660 \r
5661 \r
5662 \r
5663 \r
5664 \r
5665           EMM Functions                                                  91\r
5666 \f\r
5667 \r
5668 \r
5669 \r
5670 \r
5671           Function 19. Get/Set Handle Attribute\r
5672           Get Handle Attribute subfunction\r
5673 \r
5674 \r
5675 \r
5676           PURPOSE\r
5677 \r
5678                This subfunction returns the attribute associated with a\r
5679                handle.  The attributes are volatile or non-volatile. \r
5680                Handles with non-volatile attributes enable the memory\r
5681                manager to save the contents of a handle's pages between\r
5682                warm boots.  However, this function may be disabled with a\r
5683                user option or may not be supported by the memory board or\r
5684                system hardware.\r
5685 \r
5686                If the handle's attribute has been set to non-volatile, the\r
5687                handle, its name (if it is assigned one), and the contents\r
5688                of the pages allocated to the handle are all maintained\r
5689                after a warm boot.\r
5690 \r
5691 \r
5692           CALLING PARAMETERS\r
5693 \r
5694                AX = 5200h\r
5695                    Contains the Get Handle Attribute subfunction.\r
5696 \r
5697                DX = handle\r
5698                    Contains the EMM handle.\r
5699 \r
5700 \r
5701           RESULTS\r
5702 \r
5703                These results are valid only if the status returned is zero.\r
5704 \r
5705                AL = handle attribute\r
5706                    Contains the EMM handle's attribute.  The only at-\r
5707                    tributes a handle may have are volatile or non-volatile. \r
5708                    A value of zero indicates the handle is volatile.  A\r
5709                    value of one indicates that the handle is non-volatile.\r
5710 \r
5711 \r
5712           REGISTERS MODIFIED\r
5713 \r
5714                AX\r
5715 \r
5716 \r
5717           STATUS\r
5718 \r
5719                AH = 0   SUCCESSFUL.\r
5720                    The handle's attribute has been obtained.\r
5721 \r
5722 \r
5723 \r
5724           EMM Functions                                                  92\r
5725 \f\r
5726 \r
5727 \r
5728 \r
5729 \r
5730           Function 19. Get/Set Handle Attribute\r
5731           Get Handle Attribute subfunction\r
5732 \r
5733 \r
5734 \r
5735                AH = 80h   NON-RECOVERABLE.\r
5736                    The manager has detected a malfunction in the memory\r
5737                    manager software.\r
5738 \r
5739                AH = 81h   NON-RECOVERABLE.\r
5740                    The manager has detected a malfunction in the expanded\r
5741                    memory hardware.\r
5742 \r
5743                AH = 83h   NON-RECOVERABLE.\r
5744                    The manager couldn't find the specified EMM handle.  The\r
5745                    manager doesn't have any information pertaining to the\r
5746                    specified EMM handle.  The program may have corrupted\r
5747                    its EMM handle.\r
5748 \r
5749                AH = 84h   NON-RECOVERABLE.\r
5750                    The function code passed to the manager is not defined.\r
5751 \r
5752                AH = 8Fh   NON-RECOVERABLE.\r
5753                    The subfunction parameter is invalid.\r
5754 \r
5755                AH = 91h   NON-RECOVERABLE.\r
5756                    This feature is not supported.\r
5757 \r
5758 \r
5759           EXAMPLE\r
5760 \r
5761           emm_handle                     DW ?\r
5762           handle_attrib                  DB ?\r
5763 \r
5764           MOV   DX,emm_handle            ; specify EMM handle\r
5765           MOV   AX,5200h                 ; load function code\r
5766           INT   67h                      ; call the memory manager\r
5767           OR    AH,AH                    ; check EMM status\r
5768           JNZ   emm_err_handler          ; jump to error handler on error\r
5769           MOV   handle_attrib,AL         ; save handle attribute\r
5770 \r
5771 \r
5772 \r
5773 \r
5774 \r
5775 \r
5776 \r
5777 \r
5778 \r
5779 \r
5780 \r
5781 \r
5782 \r
5783           EMM Functions                                                  93\r
5784 \f\r
5785 \r
5786 \r
5787 \r
5788 \r
5789           Function 19. Get/Set Handle Attribute\r
5790           Set Handle Attribute subfunction\r
5791 \r
5792 \r
5793 \r
5794           PURPOSE\r
5795 \r
5796                This subfunction can be used to modify the attribute which a\r
5797                handle has associated with it.  The attributes which a\r
5798                handle may have are volatile or non-volatile.  The non-\r
5799                volatile attribute enables the EMM to save the contents of a\r
5800                handle's pages between warm boots.  However, this function\r
5801                may be disabled with a user option or may not be supported\r
5802                by the memory board or system hardware.\r
5803 \r
5804                If the handle's attribute has been set to non-volatile, the\r
5805                handle, its name (if it is assigned one), and the contents\r
5806                of the pages allocated to the handle are all maintained\r
5807                after a warm boot.\r
5808 \r
5809 \r
5810           CALLING PARAMETERS\r
5811 \r
5812                AX = 5201h\r
5813                    Contains the Set Handle Attribute function.\r
5814 \r
5815                DX = handle\r
5816                    Contains the EMM handle.\r
5817 \r
5818                BL = new handle attribute\r
5819                    Contains the handle's new attribute.  A value of zero\r
5820                    indicates that the handle should be made volatile.  A\r
5821                    value of one indicates that the handle should be made\r
5822                    non-volatile.\r
5823 \r
5824                    A volatile handle attribute instructs the memory manager\r
5825                    to deallocate both the handle and the pages allocated to\r
5826                    it after a warm boot.  If all handles have the volatile\r
5827                    attribute (the default attribute) at warm boot, the\r
5828                    handle directory will be empty and all of expanded\r
5829                    memory will be initialized to zero immediately after a\r
5830                    warm boot.\r
5831 \r
5832 \r
5833           REGISTERS MODIFIED\r
5834 \r
5835                AX\r
5836 \r
5837 \r
5838 \r
5839 \r
5840 \r
5841 \r
5842           EMM Functions                                                  94\r
5843 \f\r
5844 \r
5845 \r
5846 \r
5847 \r
5848           Function 19. Get/Set Handle Attribute\r
5849           Set Handle Attribute subfunction\r
5850 \r
5851 \r
5852 \r
5853           STATUS\r
5854 \r
5855                AH = 0   SUCCESSFUL.\r
5856                    The handle's attribute has been modified.\r
5857 \r
5858                AH = 80h   NON-RECOVERABLE.\r
5859                    The manager has detected a malfunction in the memory\r
5860                    manager software.\r
5861 \r
5862                AH = 81h   NON-RECOVERABLE.\r
5863                    The manager has detected a malfunction in the expanded\r
5864                    memory hardware.\r
5865 \r
5866                AH = 83h   NON-RECOVERABLE.\r
5867                    The manager could not find the specified EMM handle. \r
5868                    The manager doesn't have any information pertaining to\r
5869                    the specified EMM handle.  The program may have cor-\r
5870                    rupted its EMM handle.\r
5871 \r
5872                AH = 84h   NON-RECOVERABLE.\r
5873                    The function code passed to the manager is not defined.\r
5874 \r
5875                AH = 8Fh   NON-RECOVERABLE.\r
5876                    The subfunction parameter is invalid.\r
5877 \r
5878                AH = 90h   NON-RECOVERABLE.\r
5879                    The attribute type is undefined.\r
5880 \r
5881                AH = 91h   NON-RECOVERABLE.\r
5882                    This feature is not supported.\r
5883 \r
5884 \r
5885           EXAMPLE\r
5886 \r
5887           emm_handle                     DW ?\r
5888           new_handle_attrib              DB ?\r
5889 \r
5890           MOV   DX,emm_handle            ; specify EMM handle\r
5891           MOV   BL,new_handle_attrib     ; specify the set attribute\r
5892           MOV   AX,5201h                 ; load function code\r
5893           INT   67h                      ; call the memory manager\r
5894           OR    AH,AH                    ; check EMM status\r
5895           JNZ   emm_err_handler          ; jump to error handler on error\r
5896 \r
5897 \r
5898 \r
5899 \r
5900 \r
5901           EMM Functions                                                  95\r
5902 \f\r
5903 \r
5904 \r
5905 \r
5906 \r
5907           Function 19. Get/Set Handle Attribute\r
5908           Get Attribute Capability subfunction\r
5909 \r
5910 \r
5911 \r
5912           PURPOSE\r
5913 \r
5914                This subfunction can be used to determine whether the memory\r
5915                manager can support the non-volatile attribute.\r
5916 \r
5917 \r
5918           CALLING PARAMETERS\r
5919 \r
5920                AX = 5202h\r
5921                    Contains the Get Attribute Capability subfunction.\r
5922 \r
5923 \r
5924           RESULTS\r
5925 \r
5926                These results are valid only if the status returned is zero.\r
5927 \r
5928                AL = attribute capability\r
5929                    Contains the attribute capability.  A value of zero\r
5930                    indicates that the memory manager and hardware supports\r
5931                    only volatile handles.  A value of one indicates that\r
5932                    the memory manager/hardware supports both volatile and\r
5933                    non-volatile handles.\r
5934 \r
5935 \r
5936           REGISTERS MODIFIED\r
5937 \r
5938                AX\r
5939 \r
5940 \r
5941           STATUS\r
5942 \r
5943                AH = 0   SUCCESSFUL.\r
5944                    The attribute capability has been returned.\r
5945 \r
5946                AH = 80h   NON-RECOVERABLE.\r
5947                    The manager has detected a malfunction in the memory\r
5948                    manager software.\r
5949 \r
5950                AH = 81h   NON-RECOVERABLE.\r
5951                    The manager has detected a malfunction in the expanded\r
5952                    memory hardware.\r
5953 \r
5954                AH = 84h   NON-RECOVERABLE.\r
5955                    The function code passed to the manager is not defined.\r
5956 \r
5957                AH = 8Fh   NON-RECOVERABLE.\r
5958                    The subfunction parameter is invalid.\r
5959 \r
5960           EMM Functions                                                  96\r
5961 \f\r
5962 \r
5963 \r
5964 \r
5965 \r
5966           Function 19. Get/Set Handle Attribute\r
5967           Get Attribute Capability subfunction\r
5968 \r
5969 \r
5970 \r
5971           EXAMPLE\r
5972 \r
5973           attrib_capability              DB ?\r
5974 \r
5975           MOV   AX,5202h                 ; load function code\r
5976           INT   67h                      ; call the memory manager\r
5977           OR    AH,AH                    ; check EMM status\r
5978           JNZ   emm_err_handler          ; jump to error handler on error\r
5979           MOV   attrib_capability,AL     ; save attribute capability\r
5980 \r
5981 \r
5982 \r
5983 \r
5984 \r
5985 \r
5986 \r
5987 \r
5988 \r
5989 \r
5990 \r
5991 \r
5992 \r
5993 \r
5994 \r
5995 \r
5996 \r
5997 \r
5998 \r
5999 \r
6000 \r
6001 \r
6002 \r
6003 \r
6004 \r
6005 \r
6006 \r
6007 \r
6008 \r
6009 \r
6010 \r
6011 \r
6012 \r
6013 \r
6014 \r
6015 \r
6016 \r
6017 \r
6018 \r
6019           EMM Functions                                                  97\r
6020 \f\r
6021 \r
6022 \r
6023 \r
6024 \r
6025           Function 20. Get/Set Handle Name\r
6026           Get Handle Name subfunction\r
6027 \r
6028 \r
6029 \r
6030           PURPOSE\r
6031 \r
6032                This subfunction gets the eight character name currently\r
6033                assigned to a handle.  There is no restriction on the\r
6034                characters which may be used in the handle name (that is,\r
6035                anything from 00h through FFh).\r
6036 \r
6037                The handle name is initialized to ASCII nulls (binary zeros)\r
6038                three times:  when the memory manager is installed, when a\r
6039                handle is allocated, and when a handle is deallocated.  A\r
6040                handle with a name which is all ASCII nulls, by definition,\r
6041                has no name.  When a handle is assigned a name, at least one\r
6042                character in the name must be a non-null character in order\r
6043                to distinguish it from a handle without a name.\r
6044 \r
6045 \r
6046           CALLING PARAMETERS\r
6047 \r
6048                AX = 5300h\r
6049                    Contains the Get Handle Name function.\r
6050 \r
6051                DX = handle number\r
6052                    Contains the EMM handle.\r
6053 \r
6054                ES:DI = pointer to handle_name array\r
6055                    Contains a pointer to an eight-byte array into which the\r
6056                    name currently assigned to the handle will be copied.\r
6057 \r
6058 \r
6059           RESULTS\r
6060 \r
6061                These results are valid only if the status returned is zero.\r
6062 \r
6063                handle_name array\r
6064                    Contains the name associated with the specified handle.\r
6065 \r
6066 \r
6067           REGISTERS MODIFIED\r
6068 \r
6069                AX\r
6070 \r
6071 \r
6072           STATUS\r
6073 \r
6074                AH = 0   SUCCESSFUL.\r
6075                    The handle name has been returned.\r
6076 \r
6077 \r
6078           EMM Functions                                                  98\r
6079 \f\r
6080 \r
6081 \r
6082 \r
6083 \r
6084           Function 20. Get/Set Handle Name\r
6085           Get Handle Name subfunction\r
6086 \r
6087 \r
6088 \r
6089                AH = 80h   NON-RECOVERABLE.\r
6090                    The manager has detected a malfunction in the memory\r
6091                    manager software.\r
6092 \r
6093                AH = 81h   NON-RECOVERABLE.\r
6094                    The manager has detected a malfunction in the expanded\r
6095                    memory hardware.\r
6096 \r
6097                AH = 83h   NON-RECOVERABLE.\r
6098                    The manager couldn't find the specified EMM handle.  The\r
6099                    manager doesn't have any information on the specified\r
6100                    EMM handle.  The program may have corrupted its EMM\r
6101                    handle.\r
6102 \r
6103                AH = 84h   NON-RECOVERABLE.\r
6104                    The function code passed to the manager is not defined.\r
6105 \r
6106                AH = 8Fh   NON-RECOVERABLE.\r
6107                    The subfunction parameter is invalid.\r
6108 \r
6109 \r
6110           EXAMPLE\r
6111 \r
6112           handle_name                    DB 8 DUP (?)\r
6113           emm_handle                     DW ?\r
6114 \r
6115           MOV   AX,SEG handle_name\r
6116           MOV   ES,AX\r
6117           LEA   DI,handle_name           ; ES:DI points to handle_name\r
6118           MOV   DX,emm_handle            ; specify EMM handle\r
6119           MOV   AX,5300h                 ; load function code\r
6120           INT   67h                      ; call the memory manager\r
6121           OR    AH,AH                    ; check EMM status\r
6122           JNZ   emm_err_handler          ; jump to error handler on error\r
6123 \r
6124 \r
6125 \r
6126 \r
6127 \r
6128 \r
6129 \r
6130 \r
6131 \r
6132 \r
6133 \r
6134 \r
6135 \r
6136 \r
6137           EMM Functions                                                  99\r
6138 \f\r
6139 \r
6140 \r
6141 \r
6142 \r
6143           Function 20. Get/Set Handle Name\r
6144           Set Handle Name subfunction\r
6145 \r
6146 \r
6147 \r
6148           PURPOSE\r
6149 \r
6150                This subfunction assigns an eight character name to a\r
6151                handle.  There is no restriction on the characters which may\r
6152                be used in the handle name.  The full range of values may be\r
6153                assigned to each character in a name (that is, 00h through\r
6154                FFh).\r
6155 \r
6156                At installation, all handles have their name initialized to\r
6157                ASCII nulls (binary zeros).  A handle with a name consisting\r
6158                of all ASCII nulls has no name.  When a handle is assigned a\r
6159                name, at least one character in the name must be a non-null\r
6160                character in order to distinguish it from a handle without a\r
6161                name.  No two handles may have the same name.\r
6162 \r
6163                A handle can be renamed at any time by setting the handle's\r
6164                name to a new value.  A handle can have its name removed by\r
6165                setting the handle's name to all ASCII nulls.  When a handle\r
6166                is deallocated, its name is removed (set to ASCII nulls).\r
6167 \r
6168 \r
6169           CALLING PARAMETERS\r
6170 \r
6171                AX = 5301h\r
6172                    Contains the Set Handle Name function.\r
6173 \r
6174                DX = handle number\r
6175                    Contains the EMM handle.\r
6176 \r
6177                DS:SI = pointer to handle_name\r
6178                    Contains a pointer to a byte array which contains the\r
6179                    name that is to be assigned to the handle.  The handle\r
6180                    name must be padded with nulls if the name is less than\r
6181                    eight characters long.\r
6182 \r
6183 \r
6184           REGISTERS MODIFIED\r
6185 \r
6186                AX\r
6187 \r
6188 \r
6189           STATUS\r
6190 \r
6191                AH = 0   SUCCESSFUL.\r
6192                    The handle name has been assigned.\r
6193 \r
6194 \r
6195 \r
6196           EMM Functions                                                 100\r
6197 \f\r
6198 \r
6199 \r
6200 \r
6201 \r
6202           Function 20. Get/Set Handle Name\r
6203           Set Handle Name subfunction\r
6204 \r
6205 \r
6206 \r
6207                AH = 80h   NON-RECOVERABLE.\r
6208                    The manager has detected a malfunction in the memory\r
6209                    manager software.\r
6210 \r
6211                AH = 81h   NON-RECOVERABLE.\r
6212                    The manager has detected a malfunction in the expanded\r
6213                    memory hardware.\r
6214 \r
6215                AH = 83h   NON-RECOVERABLE.\r
6216                    The manager couldn't find the specified EMM handle.  The\r
6217                    manager doesn't currently have any information pertain-\r
6218                    ing to the specified EMM handle.  The program may have\r
6219                    corrupted its EMM handle.\r
6220 \r
6221                AH = 84h   NON-RECOVERABLE.\r
6222                    The function code passed to the manager is not defined.\r
6223 \r
6224                AH = 8Fh   NON-RECOVERABLE.\r
6225                    The subfunction parameter is invalid.\r
6226 \r
6227                AH = A1h   RECOVERABLE.\r
6228                    A handle with this name already exists.  The specified\r
6229                    handle was not assigned a name.\r
6230 \r
6231 \r
6232           EXAMPLE\r
6233 \r
6234           handle_name                    DB 'AARDVARK'\r
6235           emm_handle                     DW ?\r
6236 \r
6237           MOV   AX,SEG handle_name\r
6238           MOV   DS,AX\r
6239           LEA   SI,handle_name           ; DS:SI points to handle_name\r
6240           MOV   DX,emm_handle            ; specify EMM handle\r
6241           MOV   AX,5301h                 ; load function code\r
6242           INT   67h                      ; call the memory manager\r
6243           OR    AH,AH                    ; check EMM status\r
6244           JNZ   emm_err_handler          ; jump to error handler on error\r
6245 \r
6246 \r
6247 \r
6248 \r
6249 \r
6250 \r
6251 \r
6252 \r
6253 \r
6254 \r
6255           EMM Functions                                                 101\r
6256 \f\r
6257 \r
6258 \r
6259 \r
6260 \r
6261           Function 21. Get Handle Directory\r
6262           Get Handle Directory subfunction\r
6263 \r
6264 \r
6265 \r
6266           PURPOSE\r
6267 \r
6268                This function returns an array which contains all active\r
6269                handles and the names associated with each.  Handles which\r
6270                have not been assigned names have a default name of all\r
6271                ASCII nulls (binary zeros).  When a handle is first allo-\r
6272                cated, or when all the pages belonging to a handle are\r
6273                deallocated (that is, an open handle is closed), its default\r
6274                name is set to ASCII nulls.  It takes a subsequent assign-\r
6275                ment of a name for a handle to have a name after it has been\r
6276                opened.  The full range of values may be assigned to each\r
6277                character in a name (that is, 00h through FFh).\r
6278 \r
6279                The number of bytes required by the array is:\r
6280 \r
6281                            10 bytes * total number of handles\r
6282 \r
6283                The maximum size of this array is:\r
6284 \r
6285                            (10 bytes/entry) * 255 entries = 2550 bytes.\r
6286 \r
6287 \r
6288           CALLING PARAMETERS\r
6289 \r
6290                AX = 5400h\r
6291                    Contains the Get Handle Directory function.\r
6292 \r
6293                    handle_dir_struct               STRUC\r
6294                        handle_value                DW ?\r
6295                        handle_name                 DB 8 DUP (?)\r
6296                    handle_dir_struct               ENDS\r
6297 \r
6298                ES:DI = pointer to handle_dir\r
6299                    Contains a pointer to an area of memory into which the\r
6300                    memory manager will copy the handle directory.  The\r
6301                    handle directory is an array of structures.  There are\r
6302                    as many entries in the array as there are open EMM\r
6303                    handles.  The structure consists of the following\r
6304                    elements:\r
6305 \r
6306                    .handle_value\r
6307                        The first member is a word which contains the value\r
6308                        of the open EMM handle.\r
6309 \r
6310 \r
6311 \r
6312 \r
6313 \r
6314           EMM Functions                                                 102\r
6315 \f\r
6316 \r
6317 \r
6318 \r
6319 \r
6320           Function 21. Get Handle Directory\r
6321           Get Handle Directory subfunction\r
6322 \r
6323 \r
6324 \r
6325                    .handle_name\r
6326                        The second member is an 8 byte array which contains\r
6327                        the ASCII name associated with the EMM handle.  If\r
6328                        there is no name currently associated with the\r
6329                        handle, it has a value of all zeros (ASCII nulls).\r
6330 \r
6331 \r
6332           RESULTS\r
6333 \r
6334                These results are valid only if the status returned is zero.\r
6335 \r
6336                handle_dir\r
6337                    Contains the handle values and handle names associated\r
6338                    with each handle value.\r
6339 \r
6340                AL = number of entries in the handle_dir array\r
6341                    Contains the number of entries in the handle directory\r
6342                    array.  This is also the same as the number of open\r
6343                    handles.  For example, if only one handle is active, AL\r
6344                    will contain a one.\r
6345 \r
6346 \r
6347           REGISTERS MODIFIED\r
6348 \r
6349                AX\r
6350 \r
6351 \r
6352           STATUS\r
6353 \r
6354                AH = 0   SUCCESSFUL.\r
6355                    The handle directory has been returned.\r
6356 \r
6357                AH = 80h   NON-RECOVERABLE.\r
6358                    The manager has detected a malfunction in the memory\r
6359                    manager software.\r
6360 \r
6361                AH = 81h   NON-RECOVERABLE.\r
6362                    The manager has detected a malfunction in the expanded\r
6363                    memory hardware.\r
6364 \r
6365                AH = 84h   NON-RECOVERABLE.\r
6366                    The function code passed to the manager is not defined.\r
6367 \r
6368                AH = 8Fh   NON-RECOVERABLE.\r
6369                    The subfunction parameter is invalid.\r
6370 \r
6371 \r
6372 \r
6373           EMM Functions                                                 103\r
6374 \f\r
6375 \r
6376 \r
6377 \r
6378 \r
6379           Function 21. Get Handle Directory\r
6380           Get Handle Directory subfunction\r
6381 \r
6382 \r
6383 \r
6384           EXAMPLE\r
6385 \r
6386           handle_dir                    handle_dir_struct 255 DUP (?)\r
6387 \r
6388           num_entries_in_handle_dir     DB ?\r
6389 \r
6390           MOV   AX,SEG handle_dir\r
6391           MOV   ES,AX\r
6392           LEA   DI,handle_dir                 ; ES:DI points to handle_dir\r
6393           MOV   AX,5400h                      ; load function code\r
6394           INT   67h                           ; call the memory manager\r
6395           OR    AH,AH                         ; check EMM status\r
6396           JNZ   emm_err_handler               ; jump to error handler on   \r
6397                                               ; error\r
6398           MOV   num_entries_in_handle_dir,AL  ; save number of entries\r
6399 \r
6400 \r
6401 \r
6402 \r
6403 \r
6404 \r
6405 \r
6406 \r
6407 \r
6408 \r
6409 \r
6410 \r
6411 \r
6412 \r
6413 \r
6414 \r
6415 \r
6416 \r
6417 \r
6418 \r
6419 \r
6420 \r
6421 \r
6422 \r
6423 \r
6424 \r
6425 \r
6426 \r
6427 \r
6428 \r
6429 \r
6430 \r
6431 \r
6432           EMM Functions                                                 104\r
6433 \f\r
6434 \r
6435 \r
6436 \r
6437 \r
6438           Function 21. Get Handle Directory\r
6439           Search For Named Handle subfunction\r
6440 \r
6441 \r
6442 \r
6443           PURPOSE\r
6444 \r
6445                This subfunction searches the handle name directory for a\r
6446                handle with a particular name.  If the named handle is\r
6447                found, this subfunction returns the handle number associated\r
6448                with the name.  At the time of installation, all handles\r
6449                have their names initialized to ASCII nulls.  A handle with\r
6450                a name which is all ASCII nulls has, by definition, no name. \r
6451                When a handle is assigned a name, at least one character in\r
6452                the name must be a non-null character in order to distin-\r
6453                guish it from a handle without a name.\r
6454 \r
6455 \r
6456           CALLING PARAMETERS\r
6457 \r
6458                AX = 5401h\r
6459                    Contains the Search for Named Handle subfunction.\r
6460 \r
6461                DS:SI = handle_name\r
6462                    Contains a pointer to an 8-byte string that contains the\r
6463                    name of the handle being searched for.\r
6464 \r
6465 \r
6466           RESULTS\r
6467 \r
6468                These results are valid only if the status returned is zero.\r
6469 \r
6470                DX = value of named handle\r
6471                    The value of the handle which matches the handle name\r
6472                    specified.\r
6473 \r
6474 \r
6475           REGISTERS MODIFIED\r
6476 \r
6477                AX, DX\r
6478 \r
6479 \r
6480           STATUS\r
6481 \r
6482                AH = 0   SUCCESSFUL.\r
6483                    The handle value for the named handle has been found.\r
6484 \r
6485                AH = 80h   NON-RECOVERABLE.\r
6486                    The manager has detected a malfunction in the memory\r
6487                    manager software.\r
6488 \r
6489 \r
6490 \r
6491           EMM Functions                                                 105\r
6492 \f\r
6493 \r
6494 \r
6495 \r
6496 \r
6497           Function 21. Get Handle Directory\r
6498           Search For Named Handle subfunction\r
6499 \r
6500 \r
6501 \r
6502                AH = 81h   NON-RECOVERABLE.\r
6503                    The manager has detected a malfunction in the expanded\r
6504                    memory hardware.\r
6505 \r
6506                AH = 84h   NON-RECOVERABLE.\r
6507                    The function code passed to the manager is not defined.\r
6508 \r
6509                AH = 8Fh   NON-RECOVERABLE.\r
6510                    The subfunction parameter is invalid.\r
6511 \r
6512                AH = A0h   NON-RECOVERABLE.\r
6513                    No corresponding handle could be found for the handle\r
6514                    name specified.\r
6515 \r
6516                AH = A1h   NON-RECOVERABLE.\r
6517                    A handle found had no name (all ASCII nulls).\r
6518 \r
6519 \r
6520           EXAMPLE\r
6521 \r
6522           named_handle                   DB 'AARDVARK'\r
6523           named_handle_value             DW ?\r
6524 \r
6525           MOV   AX,SEG named_handle\r
6526           MOV   DS,AX\r
6527           LEA   SI,named_handle          ; DS:SI points to named_handle\r
6528           MOV   AX,5401h                 ; load function code\r
6529           INT   67h                      ; call the memory manager\r
6530           OR    AH,AH                    ; check EMM status\r
6531           JNZ   emm_err_handler          ; jump to error handler on error\r
6532           MOV   named_handle_value,DX    ; save value of named handle\r
6533 \r
6534 \r
6535 \r
6536 \r
6537 \r
6538 \r
6539 \r
6540 \r
6541 \r
6542 \r
6543 \r
6544 \r
6545 \r
6546 \r
6547 \r
6548 \r
6549 \r
6550           EMM Functions                                                 106\r
6551 \f\r
6552 \r
6553 \r
6554 \r
6555 \r
6556           Function 21. Get Handle Directory\r
6557           Get Total Handles subfunction\r
6558 \r
6559 \r
6560 \r
6561           PURPOSE\r
6562 \r
6563                This subfunction returns the total number of handles that\r
6564                the memory manager supports, including the operating system\r
6565                handle (handle value 0).\r
6566 \r
6567 \r
6568           CALLING PARAMETERS\r
6569 \r
6570                AX = 5402h\r
6571                    Contains the Get Total Handles subfunction.\r
6572 \r
6573 \r
6574           RESULTS\r
6575 \r
6576                These results are valid only if the status returned is zero.\r
6577 \r
6578                BX = total_handles\r
6579                    The value returned represents the maximum number of\r
6580                    handles which a program may request the memory manager\r
6581                    to allocate memory to.  The value returned includes the\r
6582                    operating system handle (handle value 0).\r
6583 \r
6584 \r
6585           REGISTERS MODIFIED\r
6586 \r
6587                AX, BX\r
6588 \r
6589 \r
6590           STATUS\r
6591 \r
6592                AH = 0   SUCCESSFUL.\r
6593                    The total number of handles supported has been returned.\r
6594 \r
6595                AH = 80h   NON-RECOVERABLE.\r
6596                    The manager has detected a malfunction in the memory\r
6597                    manager software.\r
6598 \r
6599                AH = 81h   NON-RECOVERABLE.\r
6600                    The manager has detected a malfunction in the expanded\r
6601                    memory hardware.\r
6602 \r
6603                AH = 84h   NON-RECOVERABLE.\r
6604                    The function code passed to the manager is not defined.\r
6605 \r
6606                AH = 8Fh   NON-RECOVERABLE.\r
6607                    The subfunction parameter is invalid.\r
6608 \r
6609           EMM Functions                                                 107\r
6610 \f\r
6611 \r
6612 \r
6613 \r
6614 \r
6615           Function 21. Get Handle Directory\r
6616           Get Total Handles subfunction\r
6617 \r
6618 \r
6619 \r
6620           EXAMPLE\r
6621 \r
6622           total_handles                  DW ?\r
6623 \r
6624           MOV   AX,5402h                 ; load function code\r
6625           INT   67h                      ; call the memory manager\r
6626           OR    AH,AH                    ; check EMM status\r
6627           JNZ   emm_err_handler          ; jump to error handler on error\r
6628           MOV   total_handles,BX         ; save total handle count\r
6629 \r
6630 \r
6631 \r
6632 \r
6633 \r
6634 \r
6635 \r
6636 \r
6637 \r
6638 \r
6639 \r
6640 \r
6641 \r
6642 \r
6643 \r
6644 \r
6645 \r
6646 \r
6647 \r
6648 \r
6649 \r
6650 \r
6651 \r
6652 \r
6653 \r
6654 \r
6655 \r
6656 \r
6657 \r
6658 \r
6659 \r
6660 \r
6661 \r
6662 \r
6663 \r
6664 \r
6665 \r
6666 \r
6667 \r
6668           EMM Functions                                                 108\r
6669 \f\r
6670 \r
6671 \r
6672 \r
6673 \r
6674           Function 22. Alter Page Map & Jump\r
6675 \r
6676 \r
6677 \r
6678           PURPOSE\r
6679 \r
6680                This function alters the memory mapping context and trans-\r
6681                fers control to the specified address.  It is analogous to\r
6682                the FAR JUMP in the 8086 family architecture.  The memory\r
6683                mapping context which existed before the invocation of this\r
6684                function is lost.\r
6685 \r
6686                Mapping no pages and jumping is not considered an error.  If\r
6687                a request to map zero pages and jump is made, control is\r
6688                transferred to the target address, and this function\r
6689                performs a far jump.\r
6690 \r
6691 \r
6692           CALLING PARAMETERS\r
6693 \r
6694                AH = 55h\r
6695                    Contains the Alter Page Map & Jump function.\r
6696 \r
6697                    log_phys_map_struct             STRUC\r
6698                        log_page_number             DW ?\r
6699                        phys_page_number_seg        DW ?\r
6700                    log_phys_map_struct             ENDS\r
6701 \r
6702                    map_and_jump_struct             STRUC\r
6703                        target_address              DD ?\r
6704                        log_phys_map_len            DB ?\r
6705                        log_phys_map_ptr            DD ?\r
6706                    map_and_jump_struct             ENDS\r
6707 \r
6708                AL = physical page number/segment selector\r
6709                    Contains a code which indicates whether the value\r
6710                    contained in the\r
6711 \r
6712                        .log_phys_map.phys_page_number_seg\r
6713 \r
6714                    members are physical page numbers or are the segment\r
6715                    address representation of the physical page numbers.  A\r
6716                    zero in AL indicates that the values are physical page\r
6717                    numbers.  A one in AL indicates that the values in these\r
6718                    members are the segment address representations of the\r
6719                    physical page numbers.\r
6720 \r
6721                DX = handle number\r
6722                    Contains the EMM handle.\r
6723 \r
6724 \r
6725 \r
6726 \r
6727           EMM Functions                                                 109\r
6728 \f\r
6729 \r
6730 \r
6731 \r
6732 \r
6733           Function 22. Alter Page Map & Jump\r
6734 \r
6735 \r
6736 \r
6737                DS:SI = pointer to map_and_jump structure\r
6738                    Contains a pointer to a structure that contains the\r
6739                    information necessary to map the desired physical pages\r
6740                    and jump to the target address.  The structure consists\r
6741                    of the following elements:\r
6742 \r
6743                    .target_address\r
6744                        The first member is a far pointer which contains the\r
6745                        target address to which control is to be trans-\r
6746                        ferred.  The address is represented in segment:of-\r
6747                        fset format.  The offset portion of the address is\r
6748                        stored in the low portion of the double word.\r
6749 \r
6750                    .log_phys_map_len\r
6751                        The second member is a byte which contains the\r
6752                        number of entries in the array of structures which\r
6753                        immediately follows it.  The array is as long as the\r
6754                        application developer needs in order to map the\r
6755                        desired logical pages into physical pages.  The\r
6756                        number of entries cannot exceed the number of\r
6757                        mappable pages in the system.\r
6758 \r
6759                    .log_phys_map_ptr\r
6760                        The third member is a pointer to an array of struc-\r
6761                        tures which contain the logical page numbers and\r
6762                        physical pages or segment address at which they are\r
6763                        to be mapped.  Each entry in the array of structures\r
6764                        contains the following two elements:\r
6765 \r
6766                    .log_page_number\r
6767                        The first member of this structure is a word which\r
6768                        contains the number of the logical page to be\r
6769                        mapped.\r
6770 \r
6771                    .phys_page_number_seg\r
6772                        The second member of this structure is a word which\r
6773                        contains either the physical page number or the\r
6774                        segment address representation of the physical page\r
6775                        number at which the previous logical page number is\r
6776                        to be mapped.  The value passed in AL determines the\r
6777                        type of representation.\r
6778 \r
6779 \r
6780           REGISTERS MODIFIED\r
6781 \r
6782                AX\r
6783 \r
6784 \r
6785 \r
6786           EMM Functions                                                 110\r
6787 \f\r
6788 \r
6789 \r
6790 \r
6791 \r
6792           Function 22. Alter Page Map & Jump\r
6793 \r
6794 \r
6795 \r
6796           Note............................................................\r
6797                Values in registers which don't contain required parameters\r
6798                maintain the values across the jump.  The values in regis-\r
6799                ters (with the exception of AX) and the flag state at the\r
6800                beginning of the function are still in the registers and\r
6801                flags when the target address is reached.\r
6802 \r
6803 \r
6804           STATUS\r
6805 \r
6806                AH = 0   SUCCESSFUL.\r
6807                    Control has been transferred to the target address.\r
6808 \r
6809                AH = 80h   NON-RECOVERABLE.\r
6810                    The manager has detected a malfunction in the memory\r
6811                    manager software.\r
6812 \r
6813                AH = 81h   NON-RECOVERABLE.\r
6814                    The manager has detected a malfunction in the expanded\r
6815                    memory hardware.\r
6816 \r
6817                AH = 83h   NON-RECOVERABLE.\r
6818                    The manager could not find the specified EMM handle. \r
6819                    The manager does not currently have any information\r
6820                    pertaining to the specified EMM handle.  The program may\r
6821                    have corrupted its EMM handle.\r
6822 \r
6823                AH = 84h   NON-RECOVERABLE.\r
6824                    The function code passed to the manager is not defined.\r
6825 \r
6826                AH = 8Ah   RECOVERABLE.\r
6827                    One or more of the logical pages to map into a cor-\r
6828                    responding physical page is out of the range of logical\r
6829                    pages which are allocated to the EMM handle.  The\r
6830                    program can recover from this condition by mapping a\r
6831                    logical page which is within the bounds for the EMM\r
6832                    handle.\r
6833 \r
6834                AH = 8Bh   RECOVERABLE.\r
6835                    One or more of the physical pages is out of the range of\r
6836                    allowable physical pages, or the log_phys_map_len\r
6837                    exceeds the number of mappable pages in the system. \r
6838                    Physical page numbers are numbered zero-relative.  The\r
6839                    program can recover from this condition by mapping into\r
6840                    memory at a physical page which is in the range of\r
6841                    supported physical pages.\r
6842 \r
6843 \r
6844 \r
6845           EMM Functions                                                 111\r
6846 \f\r
6847 \r
6848 \r
6849 \r
6850 \r
6851           Function 22. Alter Page Map & Jump\r
6852 \r
6853 \r
6854 \r
6855                AH = 8Fh   NON-RECOVERABLE.\r
6856                    The subfunction parameter is invalid.\r
6857 \r
6858 \r
6859           EXAMPLE\r
6860 \r
6861           log_phys_map              log_phys_map_struct (?) DUP (?)\r
6862 \r
6863           map_and_jump              map_and_jump_struct (?)\r
6864 \r
6865           emm_handle                          DW ?\r
6866           phys_page_or_seg_mode               DB ?\r
6867 \r
6868           MOV   AX,SEG map_and_jump\r
6869           MOV   DS,AX\r
6870           LEA   SI,map_and_jump               ; DS:SI points to\r
6871                                               ; map_and_jump\r
6872           MOV   DX,emm_handle\r
6873           MOV   AH,55h                        ; load function code\r
6874           MOV   AL,phys_page_or_seg_mode      ; specify physical page\r
6875                                               ; or segment mode\r
6876           INT   67h                           ; call memory manager\r
6877           OR    AH,AH                         ; check EMM status\r
6878           JNZ   emm_err_handler               ; jump to error handler on   \r
6879                                               ; error\r
6880 \r
6881 \r
6882 \r
6883 \r
6884 \r
6885 \r
6886 \r
6887 \r
6888 \r
6889 \r
6890 \r
6891 \r
6892 \r
6893 \r
6894 \r
6895 \r
6896 \r
6897 \r
6898 \r
6899 \r
6900 \r
6901 \r
6902 \r
6903 \r
6904           EMM Functions                                                 112\r
6905 \f\r
6906 \r
6907 \r
6908 \r
6909 \r
6910           Function 23. Alter Page Map & Call\r
6911           Alter Page Map & Call subfunction\r
6912 \r
6913 \r
6914 \r
6915           PURPOSE\r
6916 \r
6917                This subfunction saves the current memory mapping context,\r
6918                alters the specified memory mapping context, and transfers\r
6919                control to the specified address.  It is analogous to the\r
6920                FAR CALL in the 8086 family architecture.  Just as a return\r
6921                from a FAR CALL restores the original value in the code\r
6922                segment register, this subfunction restores the state of the\r
6923                specified mapping context after the return.\r
6924 \r
6925                There is no explicit expanded memory subfunction which\r
6926                emulates a return from a FAR CALL.  However, this facility\r
6927                is implicitly available through the standard return from a\r
6928                FAR CALL.  The following paragraphs describe how this works:\r
6929 \r
6930                After this function is invoked, unless an error is detected,\r
6931                the memory manager will transfer control to the address\r
6932                specified.  If an error occurs, the memory manager returns\r
6933                immediately with the error code in the AH register. \r
6934                Otherwise, the memory manager pushes on the stack informa-\r
6935                tion which enables it to restore the mapping context after\r
6936                the return.\r
6937 \r
6938                When the called procedure wants to return to the calling\r
6939                procedure, it simply issues a standard FAR RETURN.  The\r
6940                memory manager traps this return, restores the specified\r
6941                mapping context, and returns to the calling procedure.  The\r
6942                memory manager also returns a status from a successful\r
6943                return just as it does for all functions.\r
6944 \r
6945                Developers using this subfunction must make allowances for\r
6946                the additional stack space this subfunction will use.\r
6947 \r
6948 \r
6949           CALLING PARAMETERS\r
6950 \r
6951                AH = 56h\r
6952                    Contains the Alter Page Map & Call function.\r
6953 \r
6954                    log_phys_map_struct             STRUC\r
6955                        log_page_number             DW ?\r
6956                        phys_page_number_seg        DW ?\r
6957                    log_phys_map_struct             ENDS\r
6958 \r
6959 \r
6960 \r
6961 \r
6962 \r
6963           EMM Functions                                                 113\r
6964 \f\r
6965 \r
6966 \r
6967 \r
6968 \r
6969           Function 23. Alter Page Map & Call\r
6970           Alter Page Map & Call subfunction\r
6971 \r
6972 \r
6973 \r
6974                    map_and_call_struct             STRUC\r
6975                        target_address              DD ?\r
6976                        new_page_map_len            DB ?\r
6977                        new_page_map_ptr            DD ?\r
6978                        old_page_map_len            DB ?\r
6979                        old_page_map_ptr            DD ?\r
6980                        reserved                    DW 4 DUP (?)\r
6981                    map_and_call_struct             ENDS\r
6982 \r
6983                AL = physical page number/segment selector\r
6984                    Contains a code which indicates whether the value\r
6985                    contained in the\r
6986 \r
6987                        .new_page_map.phys_page_number_seg\r
6988                        .old_page_map.phys_page_number_seg\r
6989 \r
6990                    members are physical page numbers or are the segment\r
6991                    address representation of the physical page numbers.  A\r
6992                    value of zero in AL indicates that the values in these\r
6993                    members are physical page numbers.  A value of one in AL\r
6994                    indicates that the values in these members are the\r
6995                    segment address representations of the physical page\r
6996                    numbers.\r
6997 \r
6998                DX = handle number\r
6999                    Contains the EMM handle.\r
7000 \r
7001                DS:SI = pointer to map_and_call structure\r
7002                    Contains a pointer to a structure which contains the\r
7003                    information necessary to map the desired physical pages\r
7004                    and call the target address.  The structure members are\r
7005                    described here:\r
7006 \r
7007                    .target_address\r
7008                        The first member is a far pointer which contains the\r
7009                        target address to which control is to be trans-\r
7010                        ferred.  The address is represented in segment:of-\r
7011                        fset format.  The offset portion of the address is\r
7012                        stored in the low portion of the pointer.  The\r
7013                        application must supply this value.\r
7014 \r
7015                    .new_page_map_len\r
7016                        The second member is a byte which contains the\r
7017                        number of entries in the new mapping context to\r
7018                        which new_page_map_ptr points.  This number cannot\r
7019                        exceed the number of mappable pages in the system.\r
7020 \r
7021 \r
7022           EMM Functions                                                 114\r
7023 \f\r
7024 \r
7025 \r
7026 \r
7027 \r
7028           Function 23. Alter Page Map & Call\r
7029           Alter Page Map & Call subfunction\r
7030 \r
7031 \r
7032 \r
7033                    .new_page_map_ptr\r
7034                        The third member is a far pointer that points to an\r
7035                        array of structures which contains a list of the\r
7036                        logical page numbers and the physical page num-\r
7037                        bers/segments at which they are to be mapped im-\r
7038                        mediately after the call.  The contents of the new\r
7039                        array of structures are described at the end of the\r
7040                        map_and_call structure.\r
7041 \r
7042                    .old_page_map_len\r
7043                        The fourth member is a byte which contains the\r
7044                        number of entries in the old mapping context to\r
7045                        which old_page_map_ptr points.  This number cannot\r
7046                        exceed the number of mappable pages in the system.\r
7047 \r
7048                    .old_page_map_ptr\r
7049                        The fifth member is a far pointer that points to an\r
7050                        array of structures which contains a list of the\r
7051                        logical page numbers and the physical page num-\r
7052                        bers/segments at which they are to be mapped im-\r
7053                        mediately after the return.  The contents of the old\r
7054                        array of structures are described at the end of the\r
7055                        map_and_call structure.\r
7056 \r
7057                    .reserved\r
7058                        The sixth member is reserved for use by the memory\r
7059                        manager.\r
7060 \r
7061                Each entry in the old and new array of structures contains\r
7062                two elements:\r
7063 \r
7064                    .log_page_number\r
7065                        The first member of this structure is a word which\r
7066                        contains a logical page number which is to be mapped\r
7067                        at the succeeding physical page number/segment\r
7068                        immediately after the CALL (in the case of the new\r
7069                        array of structures) or after the RETURN (in the\r
7070                        case of the old array of structures).\r
7071 \r
7072                    .phys_page_number_seg\r
7073                        The second member of this structure is a word which\r
7074                        contains either the physical page number or the\r
7075                        segment address representation of the physical page\r
7076                        number/segment at which the preceding logical page\r
7077                        is to be mapped immediately after the CALL (in the\r
7078                        case of the new array of structures) or after the\r
7079                        RETURN (in the case of the old array of structures).\r
7080 \r
7081           EMM Functions                                                 115\r
7082 \f\r
7083 \r
7084 \r
7085 \r
7086 \r
7087           Function 23. Alter Page Map & Call\r
7088           Alter Page Map & Call subfunction\r
7089 \r
7090 \r
7091 \r
7092           REGISTERS MODIFIED\r
7093 \r
7094                AX\r
7095 \r
7096           Note............................................................\r
7097                Values in registers which don't contain required parameters\r
7098                maintain the values across the call.  The values in regis-\r
7099                ters (with the exception of AX) and the flag state at the\r
7100                beginning of the function are still in the registers and\r
7101                flags when the target address is reached.\r
7102 \r
7103 \r
7104           STATUS\r
7105 \r
7106                AH = 0   SUCCESSFUL.\r
7107                    Control has been transferred to the target address.\r
7108 \r
7109                AH = 80h   NON-RECOVERABLE.\r
7110                    The manager has detected a malfunction in the memory\r
7111                    manager software.\r
7112 \r
7113                AH = 81h   NON-RECOVERABLE.\r
7114                    The manager has detected a malfunction in the expanded\r
7115                    memory hardware.\r
7116 \r
7117                AH = 83h   NON-RECOVERABLE.\r
7118                    The manager couldn't find the specified EMM handle.  The\r
7119                    manager doesn't have any information pertaining to the\r
7120                    specified EMM handle.  The program may have corrupted\r
7121                    its EMM handle.\r
7122 \r
7123                AH = 84h   NON-RECOVERABLE.\r
7124                    The function code passed to the manager is not defined.\r
7125 \r
7126                AH = 8Ah   RECOVERABLE.\r
7127                    One or more of the logical pages to map into a cor-\r
7128                    responding physical page is out of the range of logical\r
7129                    pages which are allocated to the EMM handle.  The\r
7130                    program can recover from this condition by mapping a\r
7131                    logical page which is within the bounds for the EMM\r
7132                    handle.\r
7133 \r
7134 \r
7135 \r
7136 \r
7137 \r
7138 \r
7139 \r
7140           EMM Functions                                                 116\r
7141 \f\r
7142 \r
7143 \r
7144 \r
7145 \r
7146           Function 23. Alter Page Map & Call\r
7147           Alter Page Map & Call subfunction\r
7148 \r
7149 \r
7150 \r
7151                AH = 8Bh   RECOVERABLE.\r
7152                    One or more of the physical pages is out of the range of\r
7153                    allowable physical pages, or you've specified more\r
7154                    physical pages than exist in the system.  Physical page\r
7155                    numbers are numbered zero-relative.  The program can\r
7156                    recover from this condition by mapping a physical page\r
7157                    which is in the range from zero to three.\r
7158 \r
7159                AH = 8Fh   NON-RECOVERABLE.\r
7160                    The subfunction parameter is invalid.\r
7161 \r
7162 \r
7163           EXAMPLE\r
7164 \r
7165           new_page_map              log_phys_map_struct (?) DUP (?)\r
7166 \r
7167           old_page_map              log_phys_map_struct (?) DUP (?)\r
7168 \r
7169           map_and_call              map_and_call_struct (?)\r
7170 \r
7171           emm_handle                DW ?\r
7172           phys_page_or_seg_mode     DB ?\r
7173 \r
7174           MOV   AX,SEG map_and_call\r
7175           MOV   DS,AX\r
7176           LEA   SI,map_and_call               ; DS:SI points to\r
7177                                               ; map_and_call\r
7178           MOV   DX,emm_handle                 ; specify EMM handle\r
7179           MOV   AH,56h                        ; load function code\r
7180           MOV   AL,phys_page_or_seg_mode      ; specify physical page\r
7181                                               ; or segment mode\r
7182           INT   67h                           ; control is actually\r
7183                                               ; transferred to the called\r
7184                                               ; procedure at this point\r
7185           OR    AH,AH                         ; check EMM status\r
7186           JNZ   emm_err_handler               ; jump to error handler on\r
7187                                               ; error\r
7188 \r
7189 \r
7190 \r
7191 \r
7192 \r
7193 \r
7194 \r
7195 \r
7196 \r
7197 \r
7198 \r
7199           EMM Functions                                                 117\r
7200 \f\r
7201 \r
7202 \r
7203 \r
7204 \r
7205           Function 23. Alter Page Map & Call\r
7206           Get Page Map Stack Space Size subfunction\r
7207 \r
7208 \r
7209 \r
7210           PURPOSE\r
7211 \r
7212                Since the Alter Page Map & Call function pushes additional\r
7213                information onto the stack, this subfunction returns the\r
7214                number of bytes of stack space the function requires.\r
7215 \r
7216 \r
7217           CALLING PARAMETERS\r
7218 \r
7219                AX = 5602h\r
7220                    Contains the Get Page Map Stack Space Size subfunction.\r
7221 \r
7222 \r
7223           RESULTS\r
7224 \r
7225                These results are valid only if the status returned is zero.\r
7226 \r
7227                BX = stack space required\r
7228                    Contains the number of bytes which the Alter Page Map &\r
7229                    Call function will require.  In other words, BX contains\r
7230                    the number (including the return address) which has to\r
7231                    be added to the stack pointer to remove all elements\r
7232                    from the stack.\r
7233 \r
7234 \r
7235           REGISTERS MODIFIED\r
7236 \r
7237                AX, BX\r
7238 \r
7239 \r
7240           STATUS\r
7241 \r
7242                AH = 0   SUCCESSFUL.\r
7243                    The size of the array has been returned.\r
7244 \r
7245                AH = 80h   NON-RECOVERABLE.\r
7246                    The manager has detected a malfunction in the memory\r
7247                    manager software.\r
7248 \r
7249                AH = 81h   NON-RECOVERABLE.\r
7250                    The manager has detected a malfunction in the expanded\r
7251                    memory hardware.\r
7252 \r
7253                AH = 84h   NON-RECOVERABLE.\r
7254                    The function code passed to the manager is not defined.\r
7255 \r
7256 \r
7257 \r
7258           EMM Functions                                                 118\r
7259 \f\r
7260 \r
7261 \r
7262 \r
7263 \r
7264           Function 23. Alter Page Map & Call\r
7265           Get Page Map Stack Space Size subfunction\r
7266 \r
7267 \r
7268 \r
7269                AH = 8Fh   NON-RECOVERABLE.\r
7270                    The subfunction parameter is invalid.\r
7271 \r
7272 \r
7273           EXAMPLE\r
7274 \r
7275           stack_space_reqd               DW ?\r
7276 \r
7277           MOV   AX,5602h                 ; load function code\r
7278           INT   67h                      ; call the memory manager\r
7279           OR    AH,AH                    ; check EMM status\r
7280           JNZ   emm_err_handler          ; jump to error handler on error\r
7281           MOV   stack_space_reqd,BX      ; save required stack size count\r
7282 \r
7283 \r
7284 \r
7285 \r
7286 \r
7287 \r
7288 \r
7289 \r
7290 \r
7291 \r
7292 \r
7293 \r
7294 \r
7295 \r
7296 \r
7297 \r
7298 \r
7299 \r
7300 \r
7301 \r
7302 \r
7303 \r
7304 \r
7305 \r
7306 \r
7307 \r
7308 \r
7309 \r
7310 \r
7311 \r
7312 \r
7313 \r
7314 \r
7315 \r
7316 \r
7317           EMM Functions                                                 119\r
7318 \f\r
7319 \r
7320 \r
7321 \r
7322 \r
7323           Function 24. Move/Exchange Memory Region\r
7324           Move Memory Region subfunction\r
7325 \r
7326 \r
7327 \r
7328           PURPOSE\r
7329 \r
7330                This subfunction copies a region of memory in the following\r
7331                memory source/destination combinations.\r
7332 \r
7333                o   conventional memory to conventional memory\r
7334 \r
7335                o   conventional memory to expanded memory\r
7336 \r
7337                o   expanded memory to conventional memory\r
7338 \r
7339                o   expanded memory to expanded memory\r
7340 \r
7341                You do not have to save and restore the expanded memory\r
7342                mapping context to perform these move operations.  The\r
7343                current mapping context is maintained throughout this\r
7344                operation.\r
7345 \r
7346                The length of the region is limited by the amount of\r
7347                expanded memory allocated to the handles specified. \r
7348                However, in most practical applications, the region length\r
7349                will be considerably smaller.  A region length of zero is\r
7350                not an error, and no move will be performed.\r
7351 \r
7352                A region length which exceeds 16K bytes is not an error.  In\r
7353                this case the function assumes that a group of logical pages\r
7354                is the target for the move.  The logical page specified\r
7355                represents the first logical page in which the move will\r
7356                take place.  If the region length exceeds 16K bytes, or if\r
7357                the region is less than 16K bytes but spans logical pages,\r
7358                there must be sufficient logical pages remaining after the\r
7359                first logical page for the entire region to fit.\r
7360 \r
7361                If your application needs to save a region of conventional\r
7362                memory in expanded memory, you can move it without having to\r
7363                perform a save or restore of the current mapping context. \r
7364                The memory manager maintains the context.  A move of up to\r
7365                1M bytes may be performed, although practical lengths are\r
7366                substantially less than this value.\r
7367 \r
7368                If the source and destination handles are identical, the\r
7369                source and destination regions are tested for overlap before\r
7370                the move.  If they overlap, the move direction is chosen so\r
7371                that the destination region receives an intact copy of the\r
7372                source region.  A status will be returned indicating that\r
7373                this overlap has occurred.\r
7374 \r
7375 \r
7376           EMM Functions                                                 120\r
7377 \f\r
7378 \r
7379 \r
7380 \r
7381 \r
7382           Function 24. Move/Exchange Memory Region\r
7383           Move Memory Region subfunction\r
7384 \r
7385 \r
7386 \r
7387           CALLING PARAMETERS\r
7388 \r
7389                AX = 5700h\r
7390                    Contains the Move Memory Region function.\r
7391 \r
7392                    move_source_dest_struct         STRUC\r
7393                        region_length               DD ?\r
7394                        source_memory_type          DB ?\r
7395                        source_handle               DW ?\r
7396                        source_initial_offset       DW ?\r
7397                        source_initial_seg_page     DW ?\r
7398                        dest_memory_type            DB ?\r
7399                        dest_handle                 DW ?\r
7400                        dest_initial_offset         DW ?\r
7401                        dest_initial_seg_page       DW ?\r
7402                    move_source_dest_struct         ENDS\r
7403 \r
7404                DS:SI = pointer to move_source_dest structure\r
7405                    Contains a pointer to a data structure which contains\r
7406                    the source and destination information for the move. \r
7407                    The structure members are described here:\r
7408 \r
7409                    .region_length\r
7410                        The first member is a double word which specifies\r
7411                        the length of the memory region (in bytes) to be\r
7412                        moved.\r
7413 \r
7414                    .source_memory_type\r
7415                        The second member is a byte which specifies the type\r
7416                        of memory where the source region resides.  A value\r
7417                        of zero indicates that the source region resides in\r
7418                        conventional memory (excluding the page frame seg-\r
7419                        ment).  A value of one indicates that the source\r
7420                        region resides in expanded memory.\r
7421 \r
7422                    .source_handle\r
7423                        If the source region resides in expanded memory, the\r
7424                        third member is a word which specifies the handle\r
7425                        number associated with the source memory region.  If\r
7426                        the source region resides in conventional memory,\r
7427                        this variable has no meaning and should be set to\r
7428                        zero for future compatibility.\r
7429 \r
7430                    .source_initial_offset\r
7431                        The fourth member is a word which specifies the\r
7432                        offset within the source region from which to begin\r
7433                        the move.\r
7434 \r
7435           EMM Functions                                                 121\r
7436 \f\r
7437 \r
7438 \r
7439 \r
7440 \r
7441           Function 24. Move/Exchange Memory Region\r
7442           Move Memory Region subfunction\r
7443 \r
7444 \r
7445 \r
7446                        If the source region resides in expanded memory, the\r
7447                        source_initial_offset is relative to the beginning\r
7448                        of the 16K logical page.  Because the offset is\r
7449                        relative to the beginning of a 16K expanded memory\r
7450                        page, it may only take on values between 0000h and\r
7451                        3FFFh.\r
7452 \r
7453                        If the source region resides in conventional memory,\r
7454                        the source_initial_offset is a word which specifies\r
7455                        the offset, relative to the beginning of the source\r
7456                        segment, from which to begin the move.  Because the\r
7457                        offset is relative to the beginning of a 64K-byte\r
7458                        conventional memory segment, it may take on values\r
7459                        between 0000h and FFFFh.\r
7460 \r
7461                    .source_initial_seg_page\r
7462                        The fifth member is a word which specifies the\r
7463                        initial segment or logical page number within the\r
7464                        source region from which to begin the move.\r
7465 \r
7466                        If the source region resides in expanded memory, the\r
7467                        value specifies the logical page within the source\r
7468                        region from which to begin the move.\r
7469 \r
7470                        If the source region resides in conventional memory,\r
7471                        the source_initial_seg_page specifies the initial\r
7472                        segment address within conventional memory from\r
7473                        which to begin the move.\r
7474 \r
7475                    .dest_memory_type\r
7476                        The sixth member is a byte which specifies the type\r
7477                        of memory where the destination region resides.  A\r
7478                        value of zero indicates conventional memory; a value\r
7479                        of one indicates expanded memory.\r
7480 \r
7481                    .dest_handle\r
7482                        If the destination region resides in expanded\r
7483                        memory, the seventh member is a word which specifies\r
7484                        the handle number associated with the destination\r
7485                        memory region.  If the destination region resides in\r
7486                        conventional memory, this variable has no meaning\r
7487                        and should be set to zero for future compatibility.\r
7488 \r
7489                    .dest_initial_offset\r
7490                        The eighth member is a word which specifies the\r
7491                        offset within the destination region from which to\r
7492                        begin the move.\r
7493 \r
7494           EMM Functions                                                 122\r
7495 \f\r
7496 \r
7497 \r
7498 \r
7499 \r
7500           Function 24. Move/Exchange Memory Region\r
7501           Move Memory Region subfunction\r
7502 \r
7503 \r
7504 \r
7505                        If the destination region resides in expanded\r
7506                        memory, the dest_initial_offset is relative to the\r
7507                        beginning of the 16K-byte logical page.  Because the\r
7508                        offset is relative to the beginning of a 16K-byte\r
7509                        expanded memory page, it may only take on values\r
7510                        between 0000h and 3FFFh.\r
7511 \r
7512                        If the destination region resides in conventional\r
7513                        memory, the dest_initial_offset is a word which\r
7514                        specifies the offset, relative to the beginning of\r
7515                        the destination segment, to begin the move.  Because\r
7516                        the offset is relative to the beginning of a 64K\r
7517                        conventional memory segment, it may take on values\r
7518                        between 0000h and FFFFh.\r
7519 \r
7520                    .dest_initial_seg_page\r
7521                        The ninth member is a word which specifies the\r
7522                        initial segment or logical page number within the\r
7523                        destination region from which to begin the move.\r
7524 \r
7525                        If the destination region resides in expanded memory\r
7526                        then the value specifies the logical page within the\r
7527                        destination region from which to begin the move.\r
7528 \r
7529                        If the destination region resides in conventional\r
7530                        memory, the dest_initial_seg_page specifies the\r
7531                        initial segment address within conventional memory\r
7532                        from which to begin the move.\r
7533 \r
7534 \r
7535           REGISTERS MODIFIED\r
7536 \r
7537                AX\r
7538 \r
7539 \r
7540           STATUS\r
7541 \r
7542                AH = 0   SUCCESSFUL.\r
7543                    The memory regions have been moved.\r
7544 \r
7545                AH = 80h   NON-RECOVERABLE.\r
7546                    The manager has detected a malfunction in the memory\r
7547                    manager software.\r
7548 \r
7549                AH = 81h   NON-RECOVERABLE.\r
7550                    The manager has detected a malfunction in the expanded\r
7551                    memory hardware.\r
7552 \r
7553           EMM Functions                                                 123\r
7554 \f\r
7555 \r
7556 \r
7557 \r
7558 \r
7559           Function 24. Move/Exchange Memory Region\r
7560           Move Memory Region subfunction\r
7561 \r
7562 \r
7563 \r
7564                AH = 83h   NON-RECOVERABLE.\r
7565                    The manager couldn't find either the source or destina-\r
7566                    tion EMM handles.  The memory manager doesn't have any\r
7567                    information on the handles specified.  The program may\r
7568                    have corrupted its EMM handles.\r
7569 \r
7570                AH = 84h   NON-RECOVERABLE.\r
7571                    The function code passed to the manager is not defined.\r
7572 \r
7573                AH = 8Ah   NON-RECOVERABLE.\r
7574                    One or more of the logical pages is out of the range of\r
7575                    logical pages allocated to the source/destination\r
7576                    handle.\r
7577 \r
7578                AH = 8Fh   NON-RECOVERABLE.\r
7579                    The subfunction parameter is invalid.\r
7580 \r
7581                AH = 92h   SUCCESSFUL.\r
7582                    The source and destination expanded memory regions have\r
7583                    the same handle and overlap.  This is valid for a move. \r
7584                    The move has been completed and the destination region\r
7585                    has a full copy of the source region.  However, at least\r
7586                    a portion of the source region has been overwritten by\r
7587                    the move.  Note that the source and destination expanded\r
7588                    memory regions with different handles will never physi-\r
7589                    cally overlap because the different handles specify\r
7590                    totally different regions of expanded memory.\r
7591 \r
7592                AH = 93h   CONDITIONALLY-RECOVERABLE.\r
7593                    The length of the source or destination expanded memory\r
7594                    region specified exceeds the length of the expanded\r
7595                    memory region allocated either the source or destination\r
7596                    handle.  Insufficient pages are allocated to this handle\r
7597                    to move a region of the size specified.  The program can\r
7598                    recover from this condition by allocating additional\r
7599                    pages to the destination or source handle and attempting\r
7600                    to execute the function again.  However, if the applica-\r
7601                    tion program allocated as much expanded memory as it\r
7602                    thought it needed, this may be a program error and is\r
7603                    not recoverable.\r
7604 \r
7605                AH = 94h   NON-RECOVERABLE.\r
7606                    The conventional memory region and expanded memory\r
7607                    region overlap.  This is invalid, the conventional\r
7608                    memory region cannot overlap the expanded memory region.\r
7609 \r
7610 \r
7611 \r
7612           EMM Functions                                                 124\r
7613 \f\r
7614 \r
7615 \r
7616 \r
7617 \r
7618           Function 24. Move/Exchange Memory Region\r
7619           Move Memory Region subfunction\r
7620 \r
7621 \r
7622 \r
7623                AH = 95h   NON-RECOVERABLE.\r
7624                    The offset within the logical page exceeds the length of\r
7625                    the logical page.  The initial source or destination\r
7626                    offsets within an expanded memory region must be between\r
7627                    0000h and 3FFFh (16383 or (length of a logical page\r
7628                    - 1)).\r
7629 \r
7630                AH = 96h   NON-RECOVERABLE.\r
7631                    Region length exceeds 1M bytes.\r
7632 \r
7633                AH = 98h   NON-RECOVERABLE.\r
7634                    The memory source and destination types are undefined.\r
7635 \r
7636                AH = A2h   NON-RECOVERABLE.\r
7637                    An attempt was made to wrap around the 1M-byte address\r
7638                    space of conventional memory during the move.  The\r
7639                    combination of source/destination starting address and\r
7640                    length of the region to be moved exceeds 1M bytes.  No\r
7641                    data was moved.\r
7642 \r
7643 \r
7644           EXAMPLE\r
7645 \r
7646           move_source_dest               move_source_dest_struct (?)\r
7647 \r
7648           MOV   AX,SEG move_source_dest\r
7649           MOV   DS,AX\r
7650           LEA   SI,move_source_dest      ; DS:SI points to move_source_dest\r
7651           MOV   AX,5700h                 ; load function code\r
7652           INT   67h                      ; call the memory manager\r
7653           OR    AH,AH                    ; check EMM status\r
7654           JNZ   emm_err_handler          ; jump to error handler on error\r
7655 \r
7656 \r
7657 \r
7658 \r
7659 \r
7660 \r
7661 \r
7662 \r
7663 \r
7664 \r
7665 \r
7666 \r
7667 \r
7668 \r
7669 \r
7670 \r
7671           EMM Functions                                                 125\r
7672 \f\r
7673 \r
7674 \r
7675 \r
7676 \r
7677           Function 24. Move/Exchange Memory Region\r
7678           Exchange Memory Region subfunction\r
7679 \r
7680 \r
7681 \r
7682           PURPOSE\r
7683 \r
7684                This subfunction exchanges (using a string move) a region of\r
7685                memory in any of the following memory source/destination\r
7686                combinations.\r
7687 \r
7688                o   conventional memory to conventional memory\r
7689 \r
7690                o   conventional memory to expanded memory\r
7691 \r
7692                o   expanded memory to conventional memory\r
7693 \r
7694                o   expanded memory to expanded memory\r
7695 \r
7696                The term expanded memory region refers only to the area of\r
7697                memory above 640K bytes (9FFFFh).  If a system provides\r
7698                mappable conventional memory, this function treats the\r
7699                mappable conventional memory regions as ordinary convention-\r
7700                al memory.  The contents of the source region and the\r
7701                destination region are exchanged.\r
7702 \r
7703                The exchange operation can be performed without having to\r
7704                save and restore the expanded memory mapping context.  The\r
7705                current mapping context is maintained throughout this\r
7706                operation.  The length of the region is limited to the\r
7707                amount of expanded memory allocated to the specified EMM\r
7708                handles.  A length of zero is not an error; however, no\r
7709                exchange will be performed.  A region length which exceeds\r
7710                16K bytes is not an error.  In this case the function\r
7711                assumes that a group of logical pages is the target for the\r
7712                exchange.  The logical page specified represents the first\r
7713                logical page in which the exchange will take place.  If the\r
7714                region length exceeds 16K bytes, or if the region is less\r
7715                than 16K bytes but spans logical pages, there must be\r
7716                sufficient logical pages remaining after the first logical\r
7717                page for the entire region to fit.\r
7718 \r
7719                If your application needs to exchange a region of conven-\r
7720                tional memory with expanded memory, you can simply exchange\r
7721                it with the region of interest without having to perform a\r
7722                save or restore of the current mapping context.  An exchange\r
7723                of up to 1M bytes may be performed, although practical\r
7724                lengths are obviously below that value.  Checking is done\r
7725                before starting the exchange to prevent the possibility of\r
7726                overlap during the exchange operation.  Overlapping source\r
7727                and destination regions for an exchange are invalid, and the\r
7728                exchange will not take place.\r
7729 \r
7730           EMM Functions                                                 126\r
7731 \f\r
7732 \r
7733 \r
7734 \r
7735 \r
7736           Function 24. Move/Exchange Memory Region\r
7737           Exchange Memory Region subfunction\r
7738 \r
7739 \r
7740 \r
7741           CALLING PARAMETERS\r
7742 \r
7743                AX = 5701h\r
7744                    Contains the Exchange Memory Region function.\r
7745 \r
7746                    xchg_source_dest_struct         STRUC\r
7747                        region_length               DD ?\r
7748                        source_memory_type          DB ?\r
7749                        source_handle               DW ?\r
7750                        source_initial_offset       DW ?\r
7751                        source_initial_seg_page     DW ?\r
7752                        dest_memory_type            DB ?\r
7753                        dest_handle                 DW ?\r
7754                        dest_initial_offset         DW ?\r
7755                        dest_initial_seg_page       DW ?\r
7756                    xchg_source_dest_struct         ENDS\r
7757 \r
7758                DS:SI = pointer to xchg_source_dest structure\r
7759                    Contains a pointer to the data structure which contains\r
7760                    the source and destination information for the exchange. \r
7761                    The structure members are described here:\r
7762 \r
7763                    .region_length\r
7764                        The first member is a double word which specifies\r
7765                        the length of the memory region to be exchanged.\r
7766 \r
7767                    .source_memory_type\r
7768                        The second member is a byte which specifies the type\r
7769                        of memory where the source region resides.  A value\r
7770                        of zero indicates that the source region resides in\r
7771                        conventional memory.  A value of one indicates that\r
7772                        the source region resides in expanded memory.\r
7773 \r
7774                    .source_handle\r
7775                        If the source region resides in expanded memory, the\r
7776                        third member is a word which specifies the handle\r
7777                        number associated with the source memory region.  If\r
7778                        the source region resides in conventional memory,\r
7779                        this variable has no meaning and should be set to\r
7780                        zero for future compatibility.\r
7781 \r
7782                    .source_initial_offset\r
7783                        The fourth member is a word which specifies the\r
7784                        offset within the source region from which to begin\r
7785                        the exchange.\r
7786 \r
7787 \r
7788 \r
7789           EMM Functions                                                 127\r
7790 \f\r
7791 \r
7792 \r
7793 \r
7794 \r
7795           Function 24. Move/Exchange Memory Region\r
7796           Exchange Memory Region subfunction\r
7797 \r
7798 \r
7799 \r
7800                        If the source region resides in expanded memory, the\r
7801                        source_initial_offset is relative to the beginning\r
7802                        of the 16K logical page.  Because the offset is\r
7803                        relative to the beginning of a 16K expanded memory\r
7804                        page, it may only take on values between 0000h and\r
7805                        3FFFh.\r
7806 \r
7807                        If the source region resides in conventional memory,\r
7808                        the source_initial_offset is a word which specifies\r
7809                        the offset, relative to the beginning of the source\r
7810                        segment, from which to begin the exchange at. \r
7811                        Because the offset is relative to the beginning of a\r
7812                        64K-byte conventional memory segment, it may take on\r
7813                        values between 0000h and FFFFh.\r
7814 \r
7815                    .source_initial_seg_page\r
7816                        The fifth member is a word which specifies the\r
7817                        initial segment or logical page number within the\r
7818                        source region from which to begin the exchange.\r
7819 \r
7820                        If the source region resides in expanded memory then\r
7821                        the value specifies the logical page within the\r
7822                        source region from which to begin the exchange.\r
7823 \r
7824                        If the source region resides in conventional memory,\r
7825                        the source_initial_seg_page specifies the initial\r
7826                        segment address within conventional memory from\r
7827                        which to begin the exchange.\r
7828 \r
7829                    .dest_memory_type\r
7830                        The sixth member is a byte which specifies the type\r
7831                        of memory where the destination region resides.  A\r
7832                        value of zero indicates that the destination region\r
7833                        resides in conventional memory (excluding the page\r
7834                        frame segment).  A value of one indicates that the\r
7835                        destination region resides in expanded memory.\r
7836 \r
7837                    .dest_handle\r
7838                        If the destination region resides in expanded\r
7839                        memory, the seventh member is a word which specifies\r
7840                        the handle number associated with the destination\r
7841                        memory region.  If the destination region resides in\r
7842                        conventional memory, this variable has no meaning\r
7843                        and should be set to zero for future compatibility.\r
7844 \r
7845 \r
7846 \r
7847 \r
7848           EMM Functions                                                 128\r
7849 \f\r
7850 \r
7851 \r
7852 \r
7853 \r
7854           Function 24. Move/Exchange Memory Region\r
7855           Exchange Memory Region subfunction\r
7856 \r
7857 \r
7858 \r
7859                    .dest_initial_offset\r
7860                        The eighth member is a word which specifies the\r
7861                        offset within the destination region from which to\r
7862                        begin the exchange.\r
7863 \r
7864                        If the destination region resides in expanded\r
7865                        memory, the dest_initial_offset is relative to the\r
7866                        beginning of the 16K-byte logical page.  Because the\r
7867                        offset is relative to the beginning of a 16K-byte\r
7868                        expanded memory page, it may only take on values\r
7869                        between 0000h and 3FFFh.\r
7870 \r
7871                        If the destination region resides in conventional\r
7872                        memory, the dest_initial_offset is a word which\r
7873                        specifies the offset, relative to the beginning of\r
7874                        the destination segment, to begin the exchange at. \r
7875                        Because the offset is relative to the beginning of a\r
7876                        64K conventional memory segment, it may take on\r
7877                        values between 0000h and FFFFh.\r
7878 \r
7879                    .dest_initial_seg_page\r
7880                        The ninth member is a word which specifies the\r
7881                        initial segment or logical page number within the\r
7882                        destination region from which to begin the exchange.\r
7883 \r
7884                        If the destination region resides in expanded memory\r
7885                        then the value specifies the logical page within the\r
7886                        destination region from which to begin the exchange.\r
7887 \r
7888                        If the destination region resides in conventional\r
7889                        memory, the dest_initial_seg_page specifies the\r
7890                        initial segment address within conventional memory\r
7891                        from which to begin the exchange.\r
7892 \r
7893 \r
7894 \r
7895           REGISTERS MODIFIED\r
7896 \r
7897                AX\r
7898 \r
7899 \r
7900           STATUS\r
7901 \r
7902                AH = 0   SUCCESSFUL.\r
7903                    The memory regions have been exchanged.\r
7904 \r
7905 \r
7906 \r
7907           EMM Functions                                                 129\r
7908 \f\r
7909 \r
7910 \r
7911 \r
7912 \r
7913           Function 24. Move/Exchange Memory Region\r
7914           Exchange Memory Region subfunction\r
7915 \r
7916 \r
7917 \r
7918                AH = 80h   NON-RECOVERABLE.\r
7919                    The manager has detected a malfunction in the memory\r
7920                    manager software.\r
7921 \r
7922                AH = 81h   NON-RECOVERABLE.\r
7923                    The manager has detected a malfunction in the expanded\r
7924                    memory hardware.\r
7925 \r
7926                AH = 83h   NON-RECOVERABLE.\r
7927                    The manager could not find either the source or destina-\r
7928                    tion EMM handles.  The memory manager does not currently\r
7929                    have any information pertaining to the handles speci-\r
7930                    fied.  The program may have corrupted its EMM handles.\r
7931 \r
7932                AH = 84h   NON-RECOVERABLE.\r
7933                    The function code passed to the manager is not defined.\r
7934 \r
7935                AH = 8Ah   NON-RECOVERABLE.\r
7936                    One or more of the logical pages is out of the range of\r
7937                    logical pages allocated to the source/destination\r
7938                    handle.\r
7939 \r
7940                AH = 8Fh   NON-RECOVERABLE.\r
7941                    The subfunction parameter is invalid.\r
7942 \r
7943                AH = 93h   CONDITIONALLY-RECOVERABLE.\r
7944                    The length of the source or destination expanded memory\r
7945                    region specified, exceeds the length of the expanded\r
7946                    memory region allocated to the source or destination\r
7947                    specified EMM handle.  There are insufficient pages\r
7948                    allocated to this handle to exchange a region of the\r
7949                    size specified.  The program can recover from this\r
7950                    condition by attempting to allocate additional pages to\r
7951                    the destination or source handle and attempting to\r
7952                    execute the function again.  However, if the application\r
7953                    program was allocated as much expanded memory as it\r
7954                    thought it needed, this may be a program error and is\r
7955                    therefore not recoverable.\r
7956 \r
7957                AH = 94h   NON-RECOVERABLE.\r
7958                    The conventional memory region and expanded memory\r
7959                    region overlap.  This is invalid, the conventional\r
7960                    memory region cannot overlap the expanded memory region.\r
7961 \r
7962 \r
7963 \r
7964 \r
7965 \r
7966           EMM Functions                                                 130\r
7967 \f\r
7968 \r
7969 \r
7970 \r
7971 \r
7972           Function 24. Move/Exchange Memory Region\r
7973           Exchange Memory Region subfunction\r
7974 \r
7975 \r
7976 \r
7977                AH = 95h   NON-RECOVERABLE.\r
7978                    The offset within the logical page exceeds the length of\r
7979                    the logical page.  The initial source or destination\r
7980                    offsets within an expanded memory region must be between\r
7981                    0000h and 3FFFh (16383 or (length of a logical page\r
7982                    - 1)).\r
7983 \r
7984                AH = 96h   NON-RECOVERABLE.\r
7985                    Region length exceeds 1M-byte limit.\r
7986 \r
7987                AH = 97h   NON-RECOVERABLE.\r
7988                    The source and destination expanded memory regions have\r
7989                    the same handle and overlap.  This is invalid, the\r
7990                    source and destination expanded memory regions cannot\r
7991                    have the same handle and overlap when they are being\r
7992                    exchanged.  Note that the source and destination\r
7993                    expanded memory regions which have different handles\r
7994                    will never physically overlap because the different\r
7995                    handles specify totally different regions of expanded\r
7996                    memory.\r
7997 \r
7998                AH = 98h   NON-RECOVERABLE.\r
7999                    The memory source and destination types are undefined.\r
8000 \r
8001                AH = A2h   NON-RECOVERABLE.\r
8002                    An attempt was made to wrap around the 1M-byte address\r
8003                    space of conventional memory during the exchange.  The\r
8004                    combination of source/destination starting address and\r
8005                    length of the region to be exchanged exceeds 1M bytes. \r
8006                    No data was exchanged.\r
8007 \r
8008 \r
8009           EXAMPLE\r
8010 \r
8011           xchg_source_dest               xchg_source_dest_struct (?)\r
8012 \r
8013           MOV   AX,SEG xchg_source_dest\r
8014           MOV   DS,AX\r
8015           LEA   SI,xchg_source_dest      ; DS:SI points to xchg_source_dest\r
8016           MOV   AX,5701h                 ; load function code\r
8017           INT   67h                      ; call the memory manager\r
8018           OR    AH,AH                    ; check EMM status\r
8019           JNZ   emm_err_handler          ; jump to error handler on error\r
8020 \r
8021 \r
8022 \r
8023 \r
8024 \r
8025           EMM Functions                                                 131\r
8026 \f\r
8027 \r
8028 \r
8029 \r
8030 \r
8031           Function 25. Get Mappable Physical Address Array\r
8032           Get Mappable Physical Address Array subfunction\r
8033 \r
8034 \r
8035 \r
8036           PURPOSE\r
8037 \r
8038                This subfunction returns an array containing the segment\r
8039                address and physical page number for each mappable physical\r
8040                page in a system.  The contents of this array provide a\r
8041                cross reference between physical page numbers and the actual\r
8042                segment addresses for each mappable page in the system.  The\r
8043                array is sorted in ascending segment order.  This does not\r
8044                mean that the physical page numbers associated with the\r
8045                segment addresses are also in ascending order.\r
8046 \r
8047 \r
8048           CALLING PARAMETERS\r
8049 \r
8050                AX = 5800h\r
8051                    Contains the Get Mappable Physical Address Array\r
8052                    subfunction\r
8053 \r
8054                    mappable_phys_page_struct       STRUC\r
8055                        phys_page_segment           DW ?\r
8056                        phys_page_number            DW ?\r
8057                    mappable_phys_page_struct       ENDS\r
8058 \r
8059                ES:DI = mappable_phys_page\r
8060                    Contains a pointer to an application-supplied memory\r
8061                    area where the memory manager will copy the physical\r
8062                    address array.  Each entry in the array is a structure\r
8063                    containing two members:\r
8064 \r
8065                    .phys_page_segment\r
8066                        The first member is a word which contains the\r
8067                        segment address of the mappable physical page\r
8068                        associated with the physical page number following\r
8069                        it.  The array entries are sorted in ascending\r
8070                        segment address order.\r
8071 \r
8072                    .phys_page_number\r
8073                        The second member is a word which contains the\r
8074                        physical page number which corresponds to the\r
8075                        previous segment address.  The physical page numbers\r
8076                        are not necessarily in ascending order.\r
8077 \r
8078 \r
8079 \r
8080 \r
8081 \r
8082 \r
8083 \r
8084           EMM Functions                                                 132\r
8085 \f\r
8086 \r
8087 \r
8088 \r
8089 \r
8090           Function 25. Get Mappable Physical Address Array\r
8091           Get Mappable Physical Address Array subfunction\r
8092 \r
8093 \r
8094 \r
8095                    Example 1\r
8096 \r
8097                        An expanded memory board has its page frame starting\r
8098                        at address C0000h and has no mappable conventional\r
8099                        memory.  For this configuration, physical page 0\r
8100                        corresponds to segment address C000h, physical page\r
8101                        1 corresponds to segment address C400h, etc.  The\r
8102                        array would contain the following data (in this\r
8103                        order):\r
8104 \r
8105                        C000h, 00h\r
8106                        C400h, 01h\r
8107                        C800h, 02h\r
8108                        CC00h, 03h\r
8109 \r
8110 \r
8111                    Example 2\r
8112 \r
8113                        An expanded memory board has a large page frame\r
8114                        starting at address C0000h and has mappable conven-\r
8115                        tional memory from 90000h through 9FFFFh.  For this\r
8116                        configuration, physical page 0 corresponds to\r
8117                        segment address C000h, physical page 1 corresponds\r
8118                        to segment address C400h, etc.  The array would\r
8119                        contain the following data in the order specified. \r
8120                        Note that the expanded memory region always has the\r
8121                        lowest numerically valued physical page numbers.\r
8122 \r
8123                        9000h, 0Ch\r
8124                        9400h, 0Dh\r
8125                        9800h, 0Eh\r
8126                        9C00h, 0Fh\r
8127                        C000h, 00h\r
8128                        C400h, 01h\r
8129                        C800h, 02h\r
8130                        CC00h, 03h\r
8131                        D000h, 04h\r
8132                        D400h, 05h\r
8133                        D800h, 06h\r
8134                        DC00h, 07h\r
8135                        E000h, 08h\r
8136                        E400h, 09h\r
8137                        E800h, 0Ah\r
8138                        EC00h, 0Bh\r
8139 \r
8140 \r
8141 \r
8142 \r
8143           EMM Functions                                                 133\r
8144 \f\r
8145 \r
8146 \r
8147 \r
8148 \r
8149           Function 25. Get Mappable Physical Address Array\r
8150           Get Mappable Physical Address Array subfunction\r
8151 \r
8152 \r
8153 \r
8154           RESULTS\r
8155 \r
8156                These results are valid only if the status returned is zero.\r
8157 \r
8158                CX = number of entries in the mappable_phys_page\r
8159                    Multiply this number by (SIZE mappable_phys_page_struct)\r
8160                    to determine the number of bytes the physical page\r
8161                    address array requires.\r
8162 \r
8163 \r
8164           REGISTERS MODIFIED\r
8165 \r
8166                AX, CX\r
8167 \r
8168 \r
8169           STATUS\r
8170 \r
8171                AH = 0   SUCCESSFUL.\r
8172                    The hardware configuration array has been returned.\r
8173 \r
8174                AH = 80h   NON-RECOVERABLE.\r
8175                    The manager has detected a malfunction in the memory\r
8176                    manager software.\r
8177 \r
8178                AH = 81h   NON-RECOVERABLE.\r
8179                    The manager has detected a malfunction in the expanded\r
8180                    memory hardware.\r
8181 \r
8182                AH = 84h   NON-RECOVERABLE.\r
8183                    The function code passed to the manager is not defined.\r
8184 \r
8185                AH = 8Fh   NON-RECOVERABLE.\r
8186                    The subfunction parameter is invalid.\r
8187 \r
8188 \r
8189 \r
8190 \r
8191 \r
8192 \r
8193 \r
8194 \r
8195 \r
8196 \r
8197 \r
8198 \r
8199 \r
8200 \r
8201 \r
8202           EMM Functions                                                 134\r
8203 \f\r
8204 \r
8205 \r
8206 \r
8207 \r
8208           Function 25. Get Mappable Physical Address Array\r
8209           Get Mappable Physical Address Array subfunction\r
8210 \r
8211 \r
8212 \r
8213           EXAMPLE\r
8214 \r
8215           mappable_phys_page             mappable_phys_page_struct (?)\r
8216 \r
8217           mappable_page_entry_count      DW ?\r
8218 \r
8219           MOV   AX,SEG mappable_phys_page\r
8220           MOV   ES,AX\r
8221           LEA   DI,mappable_phys_page         ; ES:DI points to\r
8222                                               ; mappable_phys_page\r
8223           MOV   AX,5800h                      ; load function code\r
8224           INT   67h                           ; call the memory\r
8225                                               ; manager\r
8226           OR    AH,AH                         ; check EMM status\r
8227           JNZ   emm_err_handler               ; jump to error handler\r
8228                                               ; on error\r
8229           MOV   mappable_page_entry_count,CX  ; save mappable\r
8230                                               ; page entry count\r
8231 \r
8232 \r
8233 \r
8234 \r
8235 \r
8236 \r
8237 \r
8238 \r
8239 \r
8240 \r
8241 \r
8242 \r
8243 \r
8244 \r
8245 \r
8246 \r
8247 \r
8248 \r
8249 \r
8250 \r
8251 \r
8252 \r
8253 \r
8254 \r
8255 \r
8256 \r
8257 \r
8258 \r
8259 \r
8260 \r
8261           EMM Functions                                                 135\r
8262 \f\r
8263 \r
8264 \r
8265 \r
8266 \r
8267           Function 25. Get Mappable Physical Address Array\r
8268           Get Mappable Physical Address Array Entries subfunction\r
8269 \r
8270 \r
8271 \r
8272           PURPOSE\r
8273 \r
8274                This subfunction gets the number of entries which will be\r
8275                required for the array the first subfunction returns.\r
8276 \r
8277 \r
8278           CALLING PARAMETERS\r
8279 \r
8280                AX = 5801h\r
8281                    Contains the Get Physical Page Address Array Entries\r
8282                    subfunction.  This subfunction returns a word which\r
8283                    represents the number of entries in the array returned\r
8284                    by the previous subfunction.  This number also repre-\r
8285                    sents the number of mappable physical pages in a system.\r
8286 \r
8287 \r
8288           RESULTS\r
8289 \r
8290                These results are valid only if the status returned is zero.\r
8291 \r
8292                CX = number of entries in the mappable_phys_page\r
8293                    Multiply this number by (SIZE mappable_phys_page_struct)\r
8294                    to determine the number of bytes the physical page\r
8295                    address array will require.\r
8296 \r
8297 \r
8298           REGISTERS MODIFIED\r
8299 \r
8300                AX, CX\r
8301 \r
8302 \r
8303           STATUS\r
8304 \r
8305                AH = 0   SUCCESSFUL.\r
8306                    The number of mappable physical pages has been returned.\r
8307 \r
8308                AH = 80h   NON-RECOVERABLE.\r
8309                    The manager has detected a malfunction in the memory\r
8310                    manager software.\r
8311 \r
8312                AH = 81h   NON-RECOVERABLE.\r
8313                    The manager has detected a malfunction in the expanded\r
8314                    memory hardware.\r
8315 \r
8316                AH = 84h   NON-RECOVERABLE.\r
8317                    The function code passed to the manager is not defined.\r
8318 \r
8319 \r
8320           EMM Functions                                                 136\r
8321 \f\r
8322 \r
8323 \r
8324 \r
8325 \r
8326           Function 25. Get Mappable Physical Address Array\r
8327           Get Mappable Physical Address Array Entries subfunction\r
8328 \r
8329 \r
8330 \r
8331                AH = 8Fh   NON-RECOVERABLE.\r
8332                    The subfunction parameter is invalid.\r
8333 \r
8334 \r
8335           EXAMPLE\r
8336 \r
8337           mappable_page_entry_count           DW ?\r
8338 \r
8339           MOV   AX,5801h                      ; load function code\r
8340           INT   67h                           ; call memory manager\r
8341           OR    AH,AH                         ; check EMM status\r
8342           JNZ   emm_err_handler               ; jump to error handler\r
8343                                               ; on error\r
8344           MOV   mappable_page_entry_count,CX  ; save mappable\r
8345                                               ; page entry count\r
8346 \r
8347 \r
8348 \r
8349 \r
8350 \r
8351 \r
8352 \r
8353 \r
8354 \r
8355 \r
8356 \r
8357 \r
8358 \r
8359 \r
8360 \r
8361 \r
8362 \r
8363 \r
8364 \r
8365 \r
8366 \r
8367 \r
8368 \r
8369 \r
8370 \r
8371 \r
8372 \r
8373 \r
8374 \r
8375 \r
8376 \r
8377 \r
8378 \r
8379           EMM Functions                                                 137\r
8380 \f\r
8381 \r
8382 \r
8383 \r
8384 \r
8385           Function 26. Get Expanded Memory Hardware Information\r
8386           Get Hardware Configuration Array subfunction\r
8387 \r
8388 \r
8389 \r
8390           Note............................................................\r
8391                This function is for use by operating systems only.  This\r
8392                function can be disabled at any time by the operating\r
8393                system.  Refer to Function 30 for a description of how an\r
8394                operating system does this.\r
8395 \r
8396 \r
8397           PURPOSE\r
8398 \r
8399                This subfunction returns an array containing expanded memory\r
8400                hardware configuration information for use by an operating\r
8401                system/environment.\r
8402 \r
8403 \r
8404           CALLING PARAMETERS\r
8405 \r
8406                AX = 5900h\r
8407                    Contains the Get Hardware Configuration Array subfunc-\r
8408                    tion.\r
8409 \r
8410                    hardware_info_struct            STRUC\r
8411                        raw_page_size               DW ?\r
8412                        alternate_register_sets     DW ?\r
8413                        context_save_area_size      DW ?\r
8414                        DMA_register_sets           DW ?\r
8415                        DMA_channel_operation       DW ?\r
8416                    hardware_info_struct            ENDS\r
8417 \r
8418                ES:DI = hardware_info\r
8419                    Contains a pointer to a memory area that the operating\r
8420                    system supplies where the memory manager will copy\r
8421                    expanded memory hardware information.  The structure\r
8422                    contains these five members:\r
8423 \r
8424                    .raw_page_size\r
8425                        The first member is a word which contains the size\r
8426                        of a raw mappable physical page in paragraphs (16\r
8427                        bytes).  LIM standard pages are always 16K bytes. \r
8428                        However, other implementations of expanded memory\r
8429                        boards do not necessarily comply with this standard\r
8430                        and can emulate a 16K-byte page by mapping in\r
8431                        multiple smaller pages.  This member specifies the\r
8432                        size of a mappable physical page viewed from the\r
8433                        hardware implementation level.\r
8434 \r
8435 \r
8436 \r
8437 \r
8438           EMM Functions                                                 138\r
8439 \f\r
8440 \r
8441 \r
8442 \r
8443 \r
8444           Function 26. Get Expanded Memory Hardware Information\r
8445           Get Hardware Configuration Array subfunction\r
8446 \r
8447 \r
8448 \r
8449                    .alternate_register_sets\r
8450                        The second member is a word which specifies the\r
8451                        number of alternate mapping register sets.  The\r
8452                        additional mapping register sets are termed alter-\r
8453                        nate mapping register sets in this document.\r
8454 \r
8455                        All expanded memory boards have at least one set of\r
8456                        hardware registers to perform the logical to\r
8457                        physical page mapping.  Some expanded memory boards\r
8458                        have more than one set of these mapping registers. \r
8459                        This member specifies how many of these alternate\r
8460                        mapping register sets exist (beyond the one set that\r
8461                        all expanded memory boards have) on the expanded\r
8462                        memory boards in the system.  If an expanded memory\r
8463                        card has only one set of mapping registers (that is,\r
8464                        no alternate mapping register sets) this member has\r
8465                        a value of zero.\r
8466 \r
8467                    .context_save_area_size\r
8468                        The third member is a word which contains the\r
8469                        storage requirements for the array required to save\r
8470                        a mapping context.  The value returned in this\r
8471                        member is exactly the same as that returned by\r
8472                        Function 15 (Get Size of Page Map Save Array\r
8473                        subfunction).\r
8474 \r
8475                    .DMA_register_sets\r
8476                        The fourth member is a word which contains the\r
8477                        number of register sets that can be assigned to DMA\r
8478                        channels.  These DMA register sets, although similar\r
8479                        in use to alternate register sets, are for DMA\r
8480                        mapping and not task mapping.\r
8481 \r
8482                        If the expanded memory hardware does not support DMA\r
8483                        register sets, care must be taken when DMA is taking\r
8484                        place.\r
8485 \r
8486                        In a multitasking operating system, when one task is\r
8487                        waiting for DMA to complete, it is useful to be able\r
8488                        to switch to another task.  However, if the DMA is\r
8489                        taking place in memory that the second task will\r
8490                        need to remap, remapping would be disastrous.\r
8491 \r
8492 \r
8493 \r
8494 \r
8495 \r
8496 \r
8497           EMM Functions                                                 139\r
8498 \f\r
8499 \r
8500 \r
8501 \r
8502 \r
8503           Function 26. Get Expanded Memory Hardware Information\r
8504           Get Hardware Configuration Array subfunction\r
8505 \r
8506 \r
8507 \r
8508                        If the expanded memory hardware can detect when DMA\r
8509                        is occurring, the OS/E should allow task switches\r
8510                        and remapping during DMA.  If no special support for\r
8511                        DMA is available, no remapping should be done when\r
8512                        DMA is in progress.\r
8513 \r
8514                    .DMA_channel_operation\r
8515                        The fifth member is a word which specifies a special\r
8516                        case for the DMA register sets.  A value of zero\r
8517                        specifies that the DMA register sets behave as\r
8518                        described in Function 28.  A value of one specifies\r
8519                        that the expanded memory hardware has only one DMA\r
8520                        register set.  In addition, if any channel is mapped\r
8521                        through this register set, then all channels are\r
8522                        mapped through it.  For LIM standard boards, this\r
8523                        value is zero.\r
8524 \r
8525 \r
8526           RESULTS\r
8527 \r
8528                These results are valid only if the status returned is zero.\r
8529 \r
8530                hardware_info\r
8531                    Contains the expanded memory hardware-specific informa-\r
8532                    tion described above.\r
8533 \r
8534 \r
8535           REGISTERS MODIFIED\r
8536 \r
8537                AX\r
8538 \r
8539 \r
8540           STATUS\r
8541 \r
8542                AH = 0   SUCCESSFUL.\r
8543                    The hardware configuration array has been returned.\r
8544 \r
8545                AH = 80h   NON-RECOVERABLE.\r
8546                    The manager has detected a malfunction in the memory\r
8547                    manager software.\r
8548 \r
8549                AH = 81h   NON-RECOVERABLE.\r
8550                    The manager has detected a malfunction in the expanded\r
8551                    memory hardware.\r
8552 \r
8553                AH = 84h   NON-RECOVERABLE.\r
8554                    The function code passed to the manager is not defined.\r
8555 \r
8556           EMM Functions                                                 140\r
8557 \f\r
8558 \r
8559 \r
8560 \r
8561 \r
8562           Function 26. Get Expanded Memory Hardware Information\r
8563           Get Hardware Configuration Array subfunction\r
8564 \r
8565 \r
8566 \r
8567                AH = 8Fh   NON-RECOVERABLE.\r
8568                    The subfunction parameter is invalid.\r
8569 \r
8570                AH = A4h   NON-RECOVERABLE.\r
8571                    Access to this function has been denied by the operating\r
8572                    system.  The function cannot be used at this time.\r
8573 \r
8574 \r
8575           EXAMPLE\r
8576 \r
8577           hardware_info                  hardware_info_struct (?)\r
8578 \r
8579           MOV   AX,SEG hardware_info\r
8580           MOV   ES,AX\r
8581           LEA   DI,hardware_info         ; ES:DI points to hardware_info\r
8582           MOV   AX,5900h                 ; load function code\r
8583           INT   67h                      ; call the memory manager\r
8584           OR    AH,AH                    ; check EMM status\r
8585           JNZ   emm_err_handler          ; jump to error handler on error\r
8586 \r
8587 \r
8588 \r
8589 \r
8590 \r
8591 \r
8592 \r
8593 \r
8594 \r
8595 \r
8596 \r
8597 \r
8598 \r
8599 \r
8600 \r
8601 \r
8602 \r
8603 \r
8604 \r
8605 \r
8606 \r
8607 \r
8608 \r
8609 \r
8610 \r
8611 \r
8612 \r
8613 \r
8614 \r
8615           EMM Functions                                                 141\r
8616 \f\r
8617 \r
8618 \r
8619 \r
8620 \r
8621           Function 26. Get Expanded Memory Hardware Information\r
8622           Get Unallocated Raw Page Count subfunction\r
8623 \r
8624 \r
8625 \r
8626           PURPOSE\r
8627 \r
8628                The Get Unallocated Raw Page Count subfunction returns the\r
8629                number of unallocated non-standard length mappable pages as\r
8630                well as the total number of non-standard length mappable\r
8631                pages in expanded memory to the operating system.\r
8632 \r
8633                One variety of expanded memory board has a page size which\r
8634                is a sub-multiple of 16K bytes.  An expanded memory page\r
8635                which is a sub-multiple of 16K is termed a raw page.  An\r
8636                operating system may deal with mappable physical page sizes\r
8637                which are sub-multiples of 16K bytes.\r
8638 \r
8639                If the expanded memory board supplies pages in exact\r
8640                multiples of 16K bytes, the number of pages this function\r
8641                returns is identical to the number Function 3 (Get Unallo-\r
8642                cated Page Count) returns.  In this case, there is no\r
8643                difference between a page and a raw page.\r
8644 \r
8645 \r
8646           CALLING PARAMETERS\r
8647 \r
8648                AX = 5901h\r
8649                    Contains the Get Unallocated Raw Page Count subfunction.\r
8650 \r
8651 \r
8652           RESULTS\r
8653 \r
8654                These results are valid only if the status returned is zero.\r
8655 \r
8656                BX = unallocated raw pages\r
8657                    The number of raw pages that are currently available for\r
8658                    use.\r
8659 \r
8660                DX = total raw pages\r
8661                    The total number of raw pages in expanded memory.\r
8662 \r
8663 \r
8664           REGISTERS MODIFIED\r
8665 \r
8666                AX, BX, DX\r
8667 \r
8668 \r
8669 \r
8670 \r
8671 \r
8672 \r
8673 \r
8674           EMM Functions                                                 142\r
8675 \f\r
8676 \r
8677 \r
8678 \r
8679 \r
8680           Function 26. Get Expanded Memory Hardware Information\r
8681           Get Unallocated Raw Page Count subfunction\r
8682 \r
8683 \r
8684 \r
8685           STATUS\r
8686 \r
8687                AH = 0   SUCCESSFUL.\r
8688                    The manager has returned the number of unallocated raw\r
8689                    pages and the number of total raw pages in expanded\r
8690                    memory.\r
8691 \r
8692                AH = 80h   NON-RECOVERABLE.\r
8693                    The manager detected a malfunction in the memory manager\r
8694                    software.\r
8695 \r
8696                AH = 81h   NON-RECOVERABLE.\r
8697                    The manager detected a malfunction in the expanded\r
8698                    memory hardware.\r
8699 \r
8700                AH = 84h   NON-RECOVERABLE.\r
8701                    The function code passed to the memory manager is not\r
8702                    defined.\r
8703 \r
8704                AH = 8Fh   NON-RECOVERABLE.\r
8705                    The subfunction parameter is invalid.\r
8706 \r
8707 \r
8708           EXAMPLE\r
8709 \r
8710           unalloc_raw_pages              DW ?\r
8711           total_raw_pages                DW ?\r
8712 \r
8713           MOV   AX,5901h                 ; load function code\r
8714           INT   67h                      ; call the memory manager\r
8715           OR    AH,AH                    ; check EMM status\r
8716           JNZ   emm_err_handler          ; jump to error handler on error\r
8717           MOV   unalloc_raw_pages,BX     ; save unallocated raw page count\r
8718           MOV   total_raw_pages,DX       ; save total raw page count\r
8719 \r
8720 \r
8721 \r
8722 \r
8723 \r
8724 \r
8725 \r
8726 \r
8727 \r
8728 \r
8729 \r
8730 \r
8731 \r
8732 \r
8733           EMM Functions                                                 143\r
8734 \f\r
8735 \r
8736 \r
8737 \r
8738 \r
8739           Function 27. Allocate Standard/Raw Pages\r
8740           Allocate Standard Pages subfunction\r
8741 \r
8742 \r
8743 \r
8744           PURPOSE\r
8745 \r
8746                The Allocate Standard Pages subfunction allocates the number\r
8747                of standard size (16K bytes) pages that the operating system\r
8748                requests and assigns a unique EMM handle to these pages. \r
8749                The EMM handle owns these pages until the operating system\r
8750                deallocates them.  This subfunction allows you to allocate\r
8751                zero pages to a handle, unlike Function 4 (Allocate Pages).\r
8752 \r
8753           Note............................................................\r
8754                This note affects expanded memory manager implementors and\r
8755                operating system developers only.  Applications should not\r
8756                use the following characteristic of the memory manager.  An\r
8757                application violating this rule will be incompatible with\r
8758                future versions of Microsoft's operating systems and\r
8759                environments.\r
8760 \r
8761                To be compatible with this specification, an expanded memory\r
8762                manager will provide a special handle which is available to\r
8763                the operating system only.  This handle will have a value of\r
8764                0000h and will have a set of pages allocated to it when the\r
8765                expanded memory manager driver installs.  The pages that the\r
8766                memory manager will automatically allocate to handle 0000h\r
8767                are those that backfill conventional memory.  Typically,\r
8768                this backfill occurs between addresses 40000h (256K) and\r
8769                9FFFFh (640K).  However, the range can extend below and\r
8770                above this limit if the hardware and memory manager have the\r
8771                capability.\r
8772 \r
8773                An operating system won't have to invoke Function 27 to\r
8774                obtain this handle because it can assume the handle already\r
8775                exists and is available for use immediately after the\r
8776                expanded memory device driver installs.  When an operating\r
8777                system wants to use this handle, it uses the special handle\r
8778                value of 0000h.  The operating system will be able to invoke\r
8779                any EMM function using this special handle value.  To\r
8780                allocate pages to this handle, the operating system need\r
8781                only invoke Function 18 (Reallocate Pages).\r
8782 \r
8783                There are two special cases for this handle:\r
8784 \r
8785                1.  Function 27 (Allocate Standard Pages subfunction).  This\r
8786                    function must never return zero as a handle value. \r
8787                    Applications must always invoke Function 27 to allocate\r
8788                    pages and obtain a handle which identifies the pages\r
8789                    which belong to it.  Since Function 27 never returns a\r
8790 \r
8791 \r
8792           EMM Functions                                                 144\r
8793 \f\r
8794 \r
8795 \r
8796 \r
8797 \r
8798           Function 27. Allocate Standard/Raw Pages\r
8799           Allocate Standard Pages subfunction\r
8800 \r
8801 \r
8802 \r
8803                    handle value of zero, an application will never gain\r
8804                    access to this special handle.\r
8805 \r
8806                2.  Function 6 (Deallocate Pages).  If the operating system\r
8807                    uses it to deallocate the pages which are allocated to\r
8808                    this handle, the pages the handle owns will be returned\r
8809                    to the manager for use.  But the handle will not be\r
8810                    available for reassignment.  The manager should treat a\r
8811                    deallocate pages function request for this handle the\r
8812                    same as a reallocate pages function request, where the\r
8813                    number of pages to reallocate to this handle is zero.\r
8814 \r
8815 \r
8816           CALLING PARAMETERS\r
8817 \r
8818                AX = 5A00h\r
8819                    Contains the Allocate Standard Pages subfunction.\r
8820 \r
8821                BX = num_of_standard_pages_to_alloc\r
8822                    Contains the number of standard pages the operating\r
8823                    system wants to allocate.\r
8824 \r
8825 \r
8826           RESULTS\r
8827 \r
8828                These results are valid only if the status returned is zero.\r
8829 \r
8830                DX = handle\r
8831                    Contains a unique EMM handle.  The operating system must\r
8832                    use this EMM handle as a parameter in any function that\r
8833                    requires it.  Up to 255 handles may be obtained.  (Both\r
8834                    Function 27 and Function 4 must share the same 255\r
8835                    handles.)\r
8836 \r
8837                    For all functions using this handle, the length of the\r
8838                    physical and logical pages allocated to it are standard\r
8839                    length (that is, 16K bytes).\r
8840 \r
8841 \r
8842           REGISTERS MODIFIED\r
8843 \r
8844                AX, DX\r
8845 \r
8846 \r
8847 \r
8848 \r
8849 \r
8850 \r
8851           EMM Functions                                                 145\r
8852 \f\r
8853 \r
8854 \r
8855 \r
8856 \r
8857           Function 27. Allocate Standard/Raw Pages\r
8858           Allocate Standard Pages subfunction\r
8859 \r
8860 \r
8861 \r
8862           STATUS\r
8863 \r
8864                AH = 0   SUCCESSFUL.\r
8865                    The manager has allocated the pages to an assigned EMM\r
8866                    standard handle.\r
8867 \r
8868                AH = 80h   NON-RECOVERABLE.\r
8869                    The manager detected a malfunction in the memory manager\r
8870                    software.\r
8871 \r
8872                AH = 81h   NON-RECOVERABLE.\r
8873                    The manager detected a malfunction in the expanded\r
8874                    memory hardware.\r
8875 \r
8876                AH = 84h   NON-RECOVERABLE.\r
8877                    The function code passed to the memory manager is not\r
8878                    defined.\r
8879 \r
8880                AH = 85h   RECOVERABLE.\r
8881                    All EMM handles are being used.\r
8882 \r
8883                AH = 87h   RECOVERABLE.\r
8884                    There aren't enough expanded memory pages present in the\r
8885                    system to satisfy the operating system's request.\r
8886 \r
8887                AH = 88h   RECOVERABLE.\r
8888                    There aren't enough unallocated pages to satisfy the\r
8889                    operating system's request.\r
8890 \r
8891                AH = 8Fh   NON-RECOVERABLE.\r
8892                    The subfunction parameter is invalid.\r
8893 \r
8894 \r
8895           EXAMPLE\r
8896 \r
8897           num_of_standard_pages_to_alloc      DW ?\r
8898           emm_handle                          DW ?\r
8899 \r
8900           MOV   BX,num_of_standard_pages_to_alloc\r
8901           MOV   AX,5A00h                      ; load function code\r
8902           INT   67h                           ; call the memory manager\r
8903           OR    AH,AH                         ; check EMM status\r
8904           JNZ   emm_err_handler               ; jump to error handler on\r
8905                                               ; error\r
8906           MOV   emm_handle,DX                 ; save handle\r
8907 \r
8908 \r
8909 \r
8910           EMM Functions                                                 146\r
8911 \f\r
8912 \r
8913 \r
8914 \r
8915 \r
8916           Function 27. Allocate Standard/Raw Pages\r
8917           Allocate Raw Pages subfunction\r
8918 \r
8919 \r
8920 \r
8921           PURPOSE\r
8922 \r
8923                The Allocate Raw Pages function allocates the number of non-\r
8924                standard size pages that the operating system requests and\r
8925                assigns a unique EMM handle to these pages.  The EMM handle\r
8926                owns these pages until the operating system deallocates\r
8927                them.  This function allows you to allocate zero pages to a\r
8928                handle, unlike Function 4 (Allocate Pages).\r
8929 \r
8930                A hardware vendor may design an expanded memory board that\r
8931                has a page size which is a sub-multiple of 16K bytes.  A\r
8932                physical page which is a sub-multiple of 16K is termed a raw\r
8933                page.  The operating system may deal with page sizes which\r
8934                are sub-multiples of 16K bytes.  The memory manager must\r
8935                treat any function using a handle with raw pages allocated\r
8936                to it by Function 27 (Allocate Raw Pages subfunction)\r
8937                differently than it does a handle that has normal 16K-byte\r
8938                pages allocated to it.\r
8939 \r
8940                Handles which are assigned using Function 4 (Allocate Pages)\r
8941                or Function 27 (Allocate Standard Pages subfunction) must\r
8942                have pages which are 16K bytes -- this is the length of a\r
8943                standard expanded memory page.  If the expanded memory board\r
8944                hardware is not able to supply 16K-byte pages, the memory\r
8945                manager must emulate pages which are 16K bytes combining\r
8946                multiple non-standard size pages to form a single 16K-byte\r
8947                page.\r
8948 \r
8949                Handles which are assigned using Function 27 (Allocate Raw\r
8950                Pages subfunction) are called raw handles.  All logical\r
8951                pages allocated to a raw handle may have a non-standard\r
8952                length (that is, not 16K bytes).  However, once the operat-\r
8953                ing system has allocated a number of raw pages to a handle,\r
8954                it is the responsibility of the memory manager to recognize\r
8955                that raw handle as one that has non-standard size pages\r
8956                allocated to it.  The memory manager must identify these\r
8957                handles and treat all functions which use handles which have\r
8958                non-standard page lengths differently.  The logical page\r
8959                length becomes the length of the non-standard size page for\r
8960                any raw handle that Function 27 assigns.\r
8961 \r
8962           Note............................................................\r
8963                This note affects expanded memory manager implementors and\r
8964                operating system developers only.  Applications should not\r
8965                use the following characteristic of the memory manager.  An\r
8966                application violating this rule will be incompatible with\r
8967 \r
8968 \r
8969           EMM Functions                                                 147\r
8970 \f\r
8971 \r
8972 \r
8973 \r
8974 \r
8975           Function 27. Allocate Standard/Raw Pages\r
8976           Allocate Raw Pages subfunction\r
8977 \r
8978 \r
8979 \r
8980                future versions of Microsoft's operating systems and\r
8981                environments.\r
8982 \r
8983                To be compatible with this specification, an expanded memory\r
8984                manager will provide a special handle which is available to\r
8985                the operating system only.  This handle will have a value of\r
8986                0000h and will have a set of pages allocated to it when the\r
8987                expanded memory manager driver installs.  The pages that the\r
8988                memory manager will automatically allocate to handle 0000h\r
8989                are those that backfill conventional memory.  Typically,\r
8990                this backfill occurs between addresses 40000h (256K) and\r
8991                9FFFFh (640K).  However, the range can extend below and\r
8992                above this limit if the hardware and memory manager have the\r
8993                capability.\r
8994 \r
8995                An operating system won't have to invoke Function 27 to\r
8996                obtain this handle because it can assume the handle already\r
8997                exists and is available for use immediately after the\r
8998                expanded memory device driver installs.  When an operating\r
8999                system wants to use this handle, it uses the special handle\r
9000                value of 0000h.  The operating system will be able to invoke\r
9001                any EMM function using this special handle value.  To\r
9002                allocate pages to this handle, the operating system need\r
9003                only invoke Function 18 (Reallocate Pages).\r
9004 \r
9005                There are two special cases for this handle:\r
9006 \r
9007                1.  Function 27 (Allocate Raw Pages subfunction).  This\r
9008                    function must never return zero as a handle value. \r
9009                    Applications must always invoke Function 27 to allocate\r
9010                    pages and obtain a handle which identifies the pages\r
9011                    which belong to it.  Since Function 27 never returns a\r
9012                    handle value of zero, an application will never gain\r
9013                    access to this special handle.\r
9014 \r
9015                2.  Function 6 (Deallocate Pages).  If the operating system\r
9016                    uses it to deallocate the pages which are allocated to\r
9017                    this handle, the pages the handle owns will be returned\r
9018                    to the manager for use.  But the handle will not be\r
9019                    available for reassignment.  The manager should treat a\r
9020                    deallocate pages function request for this handle the\r
9021                    same as a reallocate pages function request, where the\r
9022                    number of pages to reallocate to this handle is zero.\r
9023 \r
9024 \r
9025 \r
9026 \r
9027 \r
9028           EMM Functions                                                 148\r
9029 \f\r
9030 \r
9031 \r
9032 \r
9033 \r
9034           Function 27. Allocate Standard/Raw Pages\r
9035           Allocate Raw Pages subfunction\r
9036 \r
9037 \r
9038 \r
9039           CALLING PARAMETERS\r
9040 \r
9041                AX = 5A01h\r
9042                    Contains the Allocate Raw Pages subfunction.\r
9043 \r
9044                BX = num_of_raw_pages_to_alloc\r
9045                    Contains the number of raw pages the operating system\r
9046                    wishes to allocate.\r
9047 \r
9048 \r
9049           RESULTS\r
9050 \r
9051                These results are valid only if the status returned is zero.\r
9052 \r
9053                DX = raw handle\r
9054                    Contains a unique EMM raw handle.  The operating system\r
9055                    must use this EMM raw handle as a parameter in any\r
9056                    function that requires it.  Up to 255 handles may be\r
9057                    obtained.  (Both Function 4 and Function 27 must share\r
9058                    the same 255 handles).\r
9059 \r
9060                    For all functions using this raw handle, the length of\r
9061                    the physical and logical pages allocated to it may be\r
9062                    non-standard (that is, not 16K bytes).\r
9063 \r
9064 \r
9065           REGISTERS MODIFIED\r
9066 \r
9067                AX, DX\r
9068 \r
9069 \r
9070           STATUS\r
9071 \r
9072                AH = 0   SUCCESSFUL.\r
9073                    The manager has allocated the raw pages to an assigned\r
9074                    EMM raw handle.\r
9075 \r
9076                AH = 80h   NON-RECOVERABLE.\r
9077                    The manager detected a malfunction in the memory manager\r
9078                    software.\r
9079 \r
9080                AH = 81h   NON-RECOVERABLE.\r
9081                    The manager detected a malfunction in the expanded\r
9082                    memory hardware.\r
9083 \r
9084 \r
9085 \r
9086 \r
9087           EMM Functions                                                 149\r
9088 \f\r
9089 \r
9090 \r
9091 \r
9092 \r
9093           Function 27. Allocate Standard/Raw Pages\r
9094           Allocate Raw Pages subfunction\r
9095 \r
9096 \r
9097 \r
9098                AH = 84h   NON-RECOVERABLE.\r
9099                    The function code passed to the memory manager is not\r
9100                    defined.\r
9101 \r
9102                AH = 85h   RECOVERABLE.\r
9103                    All EMM handles are being used.\r
9104 \r
9105                AH = 87h   RECOVERABLE.\r
9106                    There aren't enough expanded memory raw pages present in\r
9107                    the system to satisfy the operating system's request.\r
9108 \r
9109                AH = 88h   RECOVERABLE.\r
9110                    There aren't enough unallocated raw pages to satisfy the\r
9111                    operating system's request.\r
9112 \r
9113                AH = 8Fh   NON-RECOVERABLE.\r
9114                    The subfunction parameter is invalid.\r
9115 \r
9116 \r
9117           EXAMPLE\r
9118 \r
9119           num_of_raw_pages_to_alloc           DW ?\r
9120           emm_raw_handle                      DW ?\r
9121 \r
9122           MOV   BX,num_of_raw_pages_to_alloc\r
9123           MOV   AX,5A01h                      ; load function code\r
9124           INT   67h                           ; call the memory manager\r
9125           OR    AH,AH                         ; check EMM status\r
9126           JNZ   emm_err_handler               ; jump to error handler\r
9127                                               ; on error\r
9128           MOV   emm_raw_handle,DX             ; save raw handle\r
9129 \r
9130 \r
9131 \r
9132 \r
9133 \r
9134 \r
9135 \r
9136 \r
9137 \r
9138 \r
9139 \r
9140 \r
9141 \r
9142 \r
9143 \r
9144 \r
9145 \r
9146           EMM Functions                                                 150\r
9147 \f\r
9148 \r
9149 \r
9150 \r
9151 \r
9152           Function 28. Alternate Map Register Set\r
9153 \r
9154 \r
9155 \r
9156           Note............................................................\r
9157                This function is for use by operating systems only.  The\r
9158                operating system can disable this function at any time. \r
9159                Refer to Function 30 for a description of how an operating\r
9160                system can enable or disable this function.\r
9161 \r
9162 \r
9163           Design Considerations\r
9164 \r
9165                The hardware support for the entire set of subfunctions\r
9166                described is generally not present on every expanded memory\r
9167                board from every vendor of expanded memory board products. \r
9168                For some of the subfunctions, software emulation is provid-\r
9169                ed.  For other subfunctions, a certain protocol in their use\r
9170                must be observed.  The subfunctions for which this is most\r
9171                crucial are those which address system DMA capabilities.\r
9172 \r
9173 \r
9174           System DMA Capabilities & Expanded Memory Support of DMA\r
9175 \r
9176                In a multitasking operating system, when one task is waiting\r
9177                for DMA to complete, it is useful to be able to switch to\r
9178                another task.  This specification describes a capability\r
9179                which may be designed into expanded memory boards to provide\r
9180                DMA into memory regions which may be mapped out while the\r
9181                DMA is occurring.  For expanded memory boards that do not\r
9182                provide this, it is crucial to understand that while DMA is\r
9183                in progress into a region of mappable memory, the memory\r
9184                mapping context cannot be changed.  That is, all DMA action\r
9185                must be complete before any remapping of pages can be done.\r
9186 \r
9187 \r
9188           Expanded Memory Support of DMA Register Sets\r
9189 \r
9190                Expanded memory boards which have DMA register sets could\r
9191                support DMA into a region of mappable memory while the\r
9192                memory mapping context is being switched.  It is important\r
9193                to realize that these DMA register sets are separate from\r
9194                the alternate map register sets.  An example of how an OS/E\r
9195                might use DMA register sets follows:\r
9196 \r
9197                                       Example 1\r
9198 \r
9199                1.  Allocate a DMA register set.\r
9200 \r
9201                2.  Get current register set.\r
9202 \r
9203                3.  Set the DMA register set.\r
9204 \r
9205           EMM Functions                                                 151\r
9206 \f\r
9207 \r
9208 \r
9209 \r
9210 \r
9211           Function 28. Alternate Map Register Set\r
9212 \r
9213 \r
9214 \r
9215                4.  Map in the memory desired.\r
9216 \r
9217                5.  Get the DMA register set.\r
9218 \r
9219                6.  Set the original register set.\r
9220 \r
9221                7.  Assign the desired DMA channel to the DMA register set.\r
9222 \r
9223                The preceding set of calls makes all DMA accesses for the\r
9224                desired DMA channel get mapped through the current DMA\r
9225                register set regardless of the current register set.  In\r
9226                other words, the DMA register set overrides the current\r
9227                mapping register set for DMA operations on the DMA channel\r
9228                specified.  A DMA channel that is not assigned to a DMA\r
9229                register set has all its DMA operations mapped through the\r
9230                current mapping register set.\r
9231 \r
9232 \r
9233 \r
9234 \r
9235 \r
9236 \r
9237 \r
9238 \r
9239 \r
9240 \r
9241 \r
9242 \r
9243 \r
9244 \r
9245 \r
9246 \r
9247 \r
9248 \r
9249 \r
9250 \r
9251 \r
9252 \r
9253 \r
9254 \r
9255 \r
9256 \r
9257 \r
9258 \r
9259 \r
9260 \r
9261 \r
9262 \r
9263 \r
9264           EMM Functions                                                 152\r
9265 \f\r
9266 \r
9267 \r
9268 \r
9269 \r
9270           Function 28. Alternate Map Register Set\r
9271           Get Alternate Map Register Set subfunction\r
9272 \r
9273 \r
9274 \r
9275           Note............................................................\r
9276                This function is for use by operating systems only.  The\r
9277                operating system can disable this function at any time. \r
9278                Refer to Function 30 for a description of how an operating\r
9279                system can enable or disable this function.\r
9280 \r
9281 \r
9282           PURPOSE\r
9283 \r
9284                The subfunction does one of two things depending on the map\r
9285                register set which is active at the time this function is\r
9286                invoked:\r
9287 \r
9288                1.  If the preceding Set Alternate Map Register Set call was\r
9289                    done with the alternate map register set equal to zero\r
9290                    (BL = 0), these points apply:\r
9291 \r
9292                    a.  The context save area pointer saved within EMM by\r
9293                        the Set Alternate Map Register subfunction is\r
9294                        returned by this call.  This pointer is always\r
9295                        returned for boards which do not supply alternate\r
9296                        mapping register sets.\r
9297 \r
9298                    b.  If the context save area pointer returned is not\r
9299                        equal to zero, this subfunction copies the contents\r
9300                        of the mapping registers on each expanded memory\r
9301                        board in the system into the save area specified by\r
9302                        the pointer.  The format of this save area is the\r
9303                        same as that returned by Function 15 (Get Page Map\r
9304                        subfunction).  This is intended to simulate getting\r
9305                        an alternate map register set.  Note that the memory\r
9306                        manager does not allocate the space for the context: \r
9307                        the operating system must do so.\r
9308 \r
9309                    c.  If the context save area pointer returned is equal\r
9310                        to zero, this subfunction does not copy the contents\r
9311                        of the mapping registers on each expanded memory\r
9312                        board in the system into the save area specified by\r
9313                        the pointer.\r
9314 \r
9315                    d.  The context save area pointer must have been\r
9316                        initialized by a previous Set Alternate Map Register\r
9317                        Set call.  Note that the value of the context save\r
9318                        area pointer saved within EMM is zero immediately\r
9319                        after installation.\r
9320 \r
9321 \r
9322 \r
9323           EMM Functions                                                 153\r
9324 \f\r
9325 \r
9326 \r
9327 \r
9328 \r
9329           Function 28. Alternate Map Register Set\r
9330           Get Alternate Map Register Set subfunction\r
9331 \r
9332 \r
9333 \r
9334                    e.  The context save area must be initialized by a\r
9335                        previous Get Page Map call (Function 15).\r
9336 \r
9337                2.  If the preceding Set Alternate Map Register Set call was\r
9338                    done with the alternate map register set greater than\r
9339                    zero (BL > 0), then the number of the alternate map\r
9340                    register set which is in use at the time that this\r
9341                    function is invoked is returned.  The context save area\r
9342                    pointer is not returned in this case.\r
9343 \r
9344 \r
9345           CALLING PARAMETERS\r
9346 \r
9347                AX = 5B00h\r
9348                    Contains the Get Alternate Map Register Set subfunction.\r
9349 \r
9350 \r
9351           RESULTS\r
9352 \r
9353                These results are valid only if the status returned is zero.\r
9354 \r
9355                If BL <> 0, current active alternate map register set number\r
9356                    Contains the alternate map register set which was active\r
9357                    at the time that this function was invoked.\r
9358 \r
9359                ES:DI   Unaffected.\r
9360 \r
9361                If BL = 0\r
9362                    Indicates that a pointer to an area which contains the\r
9363                    state of all the map registers on all boards in the\r
9364                    system, and any additional information necessary to\r
9365                    restore the boards to their original state, has been\r
9366                    returned.\r
9367 \r
9368                ES:DI = pointer to a map register context save area\r
9369                    Contains a pointer to an operating system supplied\r
9370                    context save area.  The pointer is in standard seg-\r
9371                    ment:offset format.  This pointer is always returned if\r
9372                    the expanded memory hardware does not supply alternate\r
9373                    mapping register sets.\r
9374 \r
9375 \r
9376 \r
9377 \r
9378 \r
9379 \r
9380 \r
9381 \r
9382           EMM Functions                                                 154\r
9383 \f\r
9384 \r
9385 \r
9386 \r
9387 \r
9388           Function 28. Alternate Map Register Set\r
9389           Get Alternate Map Register Set subfunction\r
9390 \r
9391 \r
9392 \r
9393                    The operating system first passes this pointer to the\r
9394                    memory manager whenever it invokes a Set Alternate Map\r
9395                    Register Set subfunction (the description follows).  If\r
9396                    the OS/E invokes this function before invoking a Set\r
9397                    Alternate Map Register Set subfunction, this function\r
9398                    returns a pointer value of zero.  The OS/E must have\r
9399                    allocated the space for the save area.  However, the OS\r
9400                    must request that the memory manager initialize the\r
9401                    contents of this save area before it contains any useful\r
9402                    information.\r
9403 \r
9404                    The OS/E must initialize the save area it has allocated\r
9405                    by invoking Function 15 (Get Page Map subfunction). \r
9406                    After the OS/E has done this, the save area will contain\r
9407                    the state of all the map registers on all boards in the\r
9408                    system.  The save area will also contain any additional\r
9409                    information necessary to restore the boards to their\r
9410                    original state when the operating system invokes a Set\r
9411                    Alternate Map Register Set subfunction.\r
9412 \r
9413 \r
9414           REGISTERS MODIFIED\r
9415 \r
9416                AX, BX, ES:DI\r
9417 \r
9418 \r
9419           STATUS\r
9420 \r
9421                AH = 0   SUCCESSFUL.\r
9422                    The manager got the alternate map register set.\r
9423 \r
9424                AH = 80h   NON-RECOVERABLE.\r
9425                    The manager detected a malfunction in the memory manager\r
9426                    software.\r
9427 \r
9428                AH = 81h   NON-RECOVERABLE.\r
9429                    The manager detected a malfunction in the expanded\r
9430                    memory hardware.\r
9431 \r
9432                AH = 84h   NON-RECOVERABLE.\r
9433                    The function code passed to the memory manager is not\r
9434                    defined.\r
9435 \r
9436                AH = 8Fh   NON-RECOVERABLE.\r
9437                    The subfunction parameter is invalid.\r
9438 \r
9439 \r
9440 \r
9441           EMM Functions                                                 155\r
9442 \f\r
9443 \r
9444 \r
9445 \r
9446 \r
9447           Function 28. Alternate Map Register Set\r
9448           Get Alternate Map Register Set subfunction\r
9449 \r
9450 \r
9451 \r
9452                AH = A4h   NON-RECOVERABLE.\r
9453                    The operating system denied access to this function. \r
9454                    The function cannot be used at this time.\r
9455 \r
9456 \r
9457           EXAMPLE\r
9458 \r
9459           alt_map_reg_set                        DB ?\r
9460           context_save_area_ptr_seg              DW ?\r
9461           context_save_area_ptr_offset           DW ?\r
9462 \r
9463           MOV   AX,5B00h                         ; load function code\r
9464           INT   67h                              ; call the memory manager\r
9465           OR    AH,AH                            ; check EMM status\r
9466           JNZ   emm_err_handler                  ; jump to error handler\r
9467                                                  ; on error\r
9468           MOV   alt_map_reg_set,BL\r
9469           TEST  BL,BL\r
9470           JNZ   no_ptr_returned\r
9471 \r
9472           MOV   context_save_area_ptr_seg,ES     ; save pointer values\r
9473           MOV   context_save_area_ptr_offset,DI\r
9474 \r
9475           no_ptr_returned:\r
9476 \r
9477 \r
9478 \r
9479 \r
9480 \r
9481 \r
9482 \r
9483 \r
9484 \r
9485 \r
9486 \r
9487 \r
9488 \r
9489 \r
9490 \r
9491 \r
9492 \r
9493 \r
9494 \r
9495 \r
9496 \r
9497 \r
9498 \r
9499 \r
9500           EMM Functions                                                 156\r
9501 \f\r
9502 \r
9503 \r
9504 \r
9505 \r
9506           Function 28. Alternate Map Register Set\r
9507           Set Alternate Map Register Set subfunction\r
9508 \r
9509 \r
9510 \r
9511           Note............................................................\r
9512                This function is for use by operating systems only.  The\r
9513                operating system can disable this function at any time. \r
9514                Refer to Function 30 for a description of how an operating\r
9515                system can enable or disable this function.\r
9516 \r
9517 \r
9518           PURPOSE\r
9519 \r
9520                The subfunction does one of two things, depending on the map\r
9521                register set specified:\r
9522 \r
9523                1.  If the alternate map register set specified is zero, map\r
9524                    register set zero is activated.  If the map register\r
9525                    context restore area pointer is not equal to zero, the\r
9526                    contents of the restore area pointed to by ES:DI are\r
9527                    copied into register set zero on each expanded memory\r
9528                    board in the system.  If the pointer is equal to zero,\r
9529                    the contents are not copied.\r
9530 \r
9531                    Regardless of its value, the map register context\r
9532                    restore area pointer is saved within the memory manager. \r
9533                    It will be used during the Get Alternate Map Register\r
9534                    Set subfunction.\r
9535 \r
9536                    The operating system must supply the pointer to the\r
9537                    area.  This subfunction is intended to simulate setting\r
9538                    an alternate map register set.  Note that the operating\r
9539                    system must allocate the space for the context.  The\r
9540                    memory manager saves the context save area pointer\r
9541                    internally.\r
9542 \r
9543                2.  If the alternate map register set specified is not zero,\r
9544                    the alternate map register set specified is activated. \r
9545                    The restore area, which the operating system is pointing\r
9546                    to, is not used.\r
9547 \r
9548 \r
9549           CALLING PARAMETERS\r
9550 \r
9551                AX = 5B01h\r
9552                    Contains the Set Alternate Map Register Set subfunction.\r
9553 \r
9554 \r
9555 \r
9556 \r
9557 \r
9558 \r
9559           EMM Functions                                                 157\r
9560 \f\r
9561 \r
9562 \r
9563 \r
9564 \r
9565           Function 28. Alternate Map Register Set\r
9566           Set Alternate Map Register Set subfunction\r
9567 \r
9568 \r
9569 \r
9570                BL = new alternate map register set number\r
9571                    Contains the number of the alternate map register set\r
9572                    which is to be activated.\r
9573 \r
9574                    If BL <> 0\r
9575                        A pointer to a map register context restore area is\r
9576                        not required and the contents of ES:DI is unaffected\r
9577                        and ignored.  The alternate map register set\r
9578                        specified in BL is activated if the board supports\r
9579                        it.\r
9580 \r
9581                    If BL = 0\r
9582                        A pointer to an area which contains the state of all\r
9583                        the map registers on all boards in the system, and\r
9584                        any additional information necessary to restore the\r
9585                        boards to their original state, has been passed in\r
9586                        ES:DI.\r
9587 \r
9588                ES:DI = pointer to a map register context restore area\r
9589                    Contains a pointer to an OS/E supplied map register\r
9590                    context restore area.  The pointer is in standard\r
9591                    segment:offset format.  This pointer must always be\r
9592                    passed if the expanded memory hardware does not supply\r
9593                    alternate mapping register sets.\r
9594 \r
9595                    The memory manager must save this pointer whenever the\r
9596                    OS/E invokes this function.  The OS/E must have allo-\r
9597                    cated the space for the restore area.  Additionally, the\r
9598                    contents of this restore area must have been initialized\r
9599                    by the memory manager before it will contain any useful\r
9600                    information.  The OS/E initializes the restore area it\r
9601                    has allocated by invoking Function 15 (Get Page Map\r
9602                    subfunction).  After the OS/E has done this, the restore\r
9603                    area will contain the state of the map registers on all\r
9604                    boards in the system, and any additional information\r
9605                    necessary to restore the boards to their original state\r
9606                    when the operating system invokes a Set Alternate Map\r
9607                    Register Set subfunction.\r
9608 \r
9609 \r
9610           REGISTERS MODIFIED\r
9611 \r
9612                AX\r
9613 \r
9614 \r
9615 \r
9616 \r
9617 \r
9618           EMM Functions                                                 158\r
9619 \f\r
9620 \r
9621 \r
9622 \r
9623 \r
9624           Function 28. Alternate Map Register Set\r
9625           Set Alternate Map Register Set subfunction\r
9626 \r
9627 \r
9628 \r
9629           STATUS\r
9630 \r
9631                AH = 0   SUCCESSFUL.\r
9632                    The manager set the alternate map register set.\r
9633 \r
9634                AH = 80h   NON-RECOVERABLE.\r
9635                    The manager detected a malfunction in the memory manager\r
9636                    software.\r
9637 \r
9638                AH = 81h   NON-RECOVERABLE.\r
9639                    The manager detected a malfunction in the expanded\r
9640                    memory hardware.\r
9641 \r
9642                AH = 84h   NON-RECOVERABLE.\r
9643                    The function code passed to the memory manager is not\r
9644                    defined.\r
9645 \r
9646                AH = 8Fh   NON-RECOVERABLE.\r
9647                    The subfunction parameter is invalid.\r
9648 \r
9649                AH = 9Ah   NON-RECOVERABLE.\r
9650                    Alternate map register sets are supported, but the\r
9651                    alternate map register set specified is not supported.\r
9652 \r
9653                AH = 9Ch   NON-RECOVERABLE.\r
9654                    Alternate map register sets are not supported, and the\r
9655                    alternate map register set specified is not zero.\r
9656 \r
9657                AH = 9Dh   NON-RECOVERABLE.\r
9658                    Alternate map register sets are supported, but the\r
9659                    alternate map register set specified is either not\r
9660                    defined or not allocated.\r
9661 \r
9662                AH = A3h   NON-RECOVERABLE.\r
9663                    The contents of the source array have been corrupted, or\r
9664                    the pointer passed to the subfunction is invalid.\r
9665 \r
9666                AH = A4h   NON-RECOVERABLE.\r
9667                    The operating system has denied access to this function. \r
9668                    The function cannot be used at this time.\r
9669 \r
9670 \r
9671 \r
9672 \r
9673 \r
9674 \r
9675 \r
9676 \r
9677           EMM Functions                                                 159\r
9678 \f\r
9679 \r
9680 \r
9681 \r
9682 \r
9683           Function 28. Alternate Map Register Set\r
9684           Set Alternate Map Register Set subfunction\r
9685 \r
9686 \r
9687 \r
9688           EXAMPLE\r
9689 \r
9690           alt_map_reg_set                        DB ?\r
9691           context_restore_area_ptr_seg           DW ?\r
9692           context_restore_area_ptr_offset        DW ?\r
9693 \r
9694           MOV   AX,5B01h                         ; load function code\r
9695           MOV   BL,alt_map_reg_set\r
9696           TEST  BL,BL\r
9697           JZ    no_ptr_passed\r
9698 \r
9699           MOV   ES,context_restore_area_ptr_seg\r
9700           MOV   DI,context_restore_area_ptr_offset\r
9701 \r
9702           no_ptr_passed:\r
9703 \r
9704           INT   67h                              ; call the memory manger\r
9705           OR    AH,AH                            ; check EMM status\r
9706           JNZ   emm_err_handler                  ; jump to error handler\r
9707                                                  ; on error\r
9708 \r
9709 \r
9710 \r
9711 \r
9712 \r
9713 \r
9714 \r
9715 \r
9716 \r
9717 \r
9718 \r
9719 \r
9720 \r
9721 \r
9722 \r
9723 \r
9724 \r
9725 \r
9726 \r
9727 \r
9728 \r
9729 \r
9730 \r
9731 \r
9732 \r
9733 \r
9734 \r
9735 \r
9736           EMM Functions                                                 160\r
9737 \f\r
9738 \r
9739 \r
9740 \r
9741 \r
9742           Function 28. Alternate Map Register Set\r
9743           Get Alternate Map Save Array Size subfunction\r
9744 \r
9745 \r
9746 \r
9747           Note............................................................\r
9748                This function is for use by operating systems only.  The\r
9749                operating system can disable this function at any time. \r
9750                Refer to Function 30 for a description of how an operating\r
9751                system can enable or disable this function.\r
9752 \r
9753 \r
9754           PURPOSE\r
9755 \r
9756                This subfunction returns the storage requirements for the\r
9757                map register context save area referenced by the other\r
9758                subfunctions.\r
9759 \r
9760 \r
9761           CALLING PARAMETERS\r
9762 \r
9763                AX = 5B02h\r
9764                    Contains the Get Alternate Map Save Array Size subfunc-\r
9765                    tion.\r
9766 \r
9767 \r
9768           RESULTS\r
9769 \r
9770                These results are valid only if the status returned is zero.\r
9771 \r
9772                DX = size_of_array\r
9773                    Contains the number of bytes that will be transferred to\r
9774                    the memory area supplied by an operating system whenever\r
9775                    an operating system requests the Get, Set, or Get and\r
9776                    Set subfunction.\r
9777 \r
9778 \r
9779           REGISTERS MODIFIED\r
9780 \r
9781                AX, DX\r
9782 \r
9783 \r
9784           STATUS\r
9785 \r
9786                AH = 0   SUCCESSFUL.\r
9787                    The manager has returned the array size.\r
9788 \r
9789                AH = 80h   NON-RECOVERABLE.\r
9790                    The manager detected a malfunction in the memory manager\r
9791                    software.\r
9792 \r
9793 \r
9794 \r
9795           EMM Functions                                                 161\r
9796 \f\r
9797 \r
9798 \r
9799 \r
9800 \r
9801           Function 28. Alternate Map Register Set\r
9802           Get Alternate Map Save Array Size subfunction\r
9803 \r
9804 \r
9805 \r
9806                AH = 81h   NON-RECOVERABLE.\r
9807                    The manager detected a malfunction in the expanded\r
9808                    memory hardware.\r
9809 \r
9810                AH = 84h   NON-RECOVERABLE.\r
9811                    The function code passed to the memory manager is not\r
9812                    defined.\r
9813 \r
9814                AH = 8Fh   NON-RECOVERABLE.\r
9815                    The subfunction parameter is invalid.\r
9816 \r
9817                AH = A4h   NON-RECOVERABLE.\r
9818                    The operating system has denied access to this function. \r
9819                    The function cannot be used at this time.\r
9820 \r
9821 \r
9822           EXAMPLE\r
9823 \r
9824           size_of_array                  DW ?\r
9825 \r
9826           MOV   AX,5B02h                 ; load function code\r
9827           INT   67h                      ; call the memory manager\r
9828           OR    AH,AH                    ; check EMM status\r
9829           JNZ   emm_err_handler          ; jump to error handler on error\r
9830           MOV   size_of_array,DX         ; save size of array\r
9831 \r
9832 \r
9833 \r
9834 \r
9835 \r
9836 \r
9837 \r
9838 \r
9839 \r
9840 \r
9841 \r
9842 \r
9843 \r
9844 \r
9845 \r
9846 \r
9847 \r
9848 \r
9849 \r
9850 \r
9851 \r
9852 \r
9853 \r
9854           EMM Functions                                                 162\r
9855 \f\r
9856 \r
9857 \r
9858 \r
9859 \r
9860           Function 28. Alternate Map Register Set\r
9861           Allocate Alternate Map Register Set subfunction\r
9862 \r
9863 \r
9864 \r
9865           Note............................................................\r
9866                This function is for use by operating systems only.  The\r
9867                operating system can disable this function at any time. \r
9868                Refer to Function 30 for a description of how an operating\r
9869                system can enable or disable this function.\r
9870 \r
9871 \r
9872           PURPOSE\r
9873 \r
9874                The Allocate Alternate Map Register Set subfunction gets the\r
9875                number of an alternate map register set for an operating\r
9876                system if an alternate map register set is currently\r
9877                available for use.  If the hardware does not support\r
9878                alternate map register sets, an alternate map register set\r
9879                number of zero will be returned.\r
9880 \r
9881                The alternate map register set allocated may be referred to\r
9882                by this number when using the Get or Set Alternate Map\r
9883                Register Set subfunctions.  The operating system can use\r
9884                these subfunctions to switch map contexts very rapidly on\r
9885                expanded memory boards with alternate map register sets.\r
9886 \r
9887                This subfunction copies the currently active alternate map\r
9888                register set's contents into the newly allocated alternate\r
9889                map register set's mapping registers.  This is done so that\r
9890                when the OS/E performs a Set Alternate Map Register Set\r
9891                subfunction the memory mapped before the allocation of the\r
9892                new alternate map will be available for reading and writing. \r
9893                This function does not actually change the alternate map\r
9894                register set in use, but in addition to allocating a new\r
9895                alternate map register set, it prepares the new alternate\r
9896                map register set for a subsequent Set Alternate Map Register\r
9897                Set subfunction.\r
9898 \r
9899 \r
9900           CALLING PARAMETERS\r
9901 \r
9902                AX = 5B03h\r
9903                    Contains the Allocate Alternate Map Register Set\r
9904                    subfunction.\r
9905 \r
9906 \r
9907 \r
9908 \r
9909 \r
9910 \r
9911 \r
9912 \r
9913           EMM Functions                                                 163\r
9914 \f\r
9915 \r
9916 \r
9917 \r
9918 \r
9919           Function 28. Alternate Map Register Set\r
9920           Allocate Alternate Map Register Set subfunction\r
9921 \r
9922 \r
9923 \r
9924           RESULTS\r
9925 \r
9926                These results are valid only if the status returned is zero.\r
9927 \r
9928                BL = alternate map register set number\r
9929                    Contains the number of an alternate map register set. \r
9930                    If there are no alternate map register sets supported by\r
9931                    the hardware, a zero will be returned.  In this case,\r
9932                    the Get Alternate Map function (Function 28) should be\r
9933                    invoked in order to obtain a pointer to a map register\r
9934                    context save area.  The OS/E must supply this area.  The\r
9935                    save area is necessary because the hardware doesn't\r
9936                    support alternate map register sets.\r
9937 \r
9938 \r
9939           REGISTERS MODIFIED\r
9940 \r
9941                AX, BX\r
9942 \r
9943 \r
9944           STATUS\r
9945 \r
9946                AH = 0   SUCCESSFUL.\r
9947                    The manager has returned the alternate map register set\r
9948                    number.\r
9949 \r
9950                AH = 80h   NON-RECOVERABLE.\r
9951                    The manager detected a malfunction in the memory manager\r
9952                    software.\r
9953 \r
9954                AH = 81h   NON-RECOVERABLE.\r
9955                    The manager detected a malfunction in the expanded\r
9956                    memory hardware.\r
9957 \r
9958                AH = 84h   NON-RECOVERABLE.\r
9959                    The function code passed to the memory manager is not\r
9960                    defined.\r
9961 \r
9962                AH = 8Fh   NON-RECOVERABLE.\r
9963                    The subfunction parameter is invalid.\r
9964 \r
9965                AH = 9Bh   NON-RECOVERABLE.\r
9966                    Alternate map register sets are supported.  However, all\r
9967                    alternate map register sets are currently allocated.\r
9968 \r
9969 \r
9970 \r
9971 \r
9972           EMM Functions                                                 164\r
9973 \f\r
9974 \r
9975 \r
9976 \r
9977 \r
9978           Function 28. Alternate Map Register Set\r
9979           Allocate Alternate Map Register Set subfunction\r
9980 \r
9981 \r
9982 \r
9983                AH = A4h   NON-RECOVERABLE.\r
9984                    The operating system has denied access to this function. \r
9985                    The function cannot be used at this time.\r
9986 \r
9987 \r
9988           EXAMPLE\r
9989 \r
9990           alt_map_reg_num                DB ?\r
9991 \r
9992           MOV   AX,5B03h                 ; load function code\r
9993           INT   67h                      ; call the memory manager\r
9994           OR    AH,AH                    ; check EMM status\r
9995           JNZ   emm_err_handler          ; jump to error handler on error\r
9996           MOV   alt_map_reg_num,BL       ; save number of\r
9997                                          ; alternate map register set\r
9998 \r
9999 \r
10000 \r
10001 \r
10002 \r
10003 \r
10004 \r
10005 \r
10006 \r
10007 \r
10008 \r
10009 \r
10010 \r
10011 \r
10012 \r
10013 \r
10014 \r
10015 \r
10016 \r
10017 \r
10018 \r
10019 \r
10020 \r
10021 \r
10022 \r
10023 \r
10024 \r
10025 \r
10026 \r
10027 \r
10028 \r
10029 \r
10030 \r
10031           EMM Functions                                                 165\r
10032 \f\r
10033 \r
10034 \r
10035 \r
10036 \r
10037           Function 28. Alternate Map Register Set\r
10038           Deallocate Alternate Map Register Set subfunction\r
10039 \r
10040 \r
10041 \r
10042           Note............................................................\r
10043                This function is for use by operating systems only.  The\r
10044                operating system can disable this function at any time. \r
10045                Refer to Function 30 for a description of how an operating\r
10046                system can enable or disable this function.\r
10047 \r
10048 \r
10049           PURPOSE\r
10050 \r
10051                The Deallocate Alternate Map Register Set subfunction\r
10052                returns the alternate map register set to the memory manager\r
10053                for future use.  The memory manager may reallocate the\r
10054                alternate map register set when needed.\r
10055 \r
10056                This subfunction also makes the mapping context of the\r
10057                alternate map register specified unavailable for reading or\r
10058                writing (unmapping).  This protects the pages previously\r
10059                mapped in an alternate map register set by making them\r
10060                inaccessible.  Note that the current alternate map register\r
10061                set cannot be deallocated.  This makes all memory which was\r
10062                currently mapped into conventional and expanded memory\r
10063                inaccessible.\r
10064 \r
10065 \r
10066           CALLING PARAMETERS\r
10067 \r
10068                AX = 5B04h\r
10069                    Contains the Deallocate Alternate Map Register Set\r
10070                    subfunction.\r
10071 \r
10072                BL = alternate register set number\r
10073                    Contains the number of the alternate map register set to\r
10074                    deallocate.  Map register set zero cannot be allocated\r
10075                    or deallocated.  However, if alternate map register set\r
10076                    zero is specified and this subfunction is invoked, no\r
10077                    error will be returned.  The function invocation is\r
10078                    ignored in this case.\r
10079 \r
10080 \r
10081           REGISTERS MODIFIED\r
10082 \r
10083                AX\r
10084 \r
10085 \r
10086 \r
10087 \r
10088 \r
10089 \r
10090           EMM Functions                                                 166\r
10091 \f\r
10092 \r
10093 \r
10094 \r
10095 \r
10096           Function 28. Alternate Map Register Set\r
10097           Deallocate Alternate Map Register Set subfunction\r
10098 \r
10099 \r
10100 \r
10101           STATUS\r
10102 \r
10103                AH = 0   SUCCESSFUL.\r
10104                    The manager has deallocated the alternate map register\r
10105                    set.\r
10106 \r
10107                AH = 80h   NON-RECOVERABLE.\r
10108                    The manager detected a malfunction in the memory manager\r
10109                    software.\r
10110 \r
10111                AH = 81h   NON-RECOVERABLE.\r
10112                    The manager detected a malfunction in the expanded\r
10113                    memory hardware.\r
10114 \r
10115                AH = 84h   NON-RECOVERABLE.\r
10116                    The function code passed to the memory manager is not\r
10117                    defined.\r
10118 \r
10119                AH = 8Fh   NON-RECOVERABLE.\r
10120                    The subfunction parameter is invalid.\r
10121 \r
10122                AH = 9Ch   NON-RECOVERABLE.\r
10123                    Alternate map register sets are not supported and the\r
10124                    alternate map register set specified is not zero.\r
10125 \r
10126                AH = 9Dh   NON-RECOVERABLE.\r
10127                    Alternate map register sets are supported, but the\r
10128                    alternate map register set specified is either not\r
10129                    defined or not allocated.\r
10130 \r
10131                AH = A4h   NON-RECOVERABLE.\r
10132                    The operating system has denied access to this function. \r
10133                    The function cannot be used at this time.\r
10134 \r
10135 \r
10136           EXAMPLE\r
10137 \r
10138           alternate_map_reg_set               DB ?\r
10139 \r
10140           MOV   BL,alternate_map_reg_set      ; specify alternate map\r
10141                                               ; register set\r
10142           MOV   AX,5B04h                      ; load function code\r
10143           INT   67h                           ; call the memory manager\r
10144           OR    AH,AH                         ; check EMM status\r
10145           JNZ   emm_err_handler               ; jump to error handler\r
10146                                               ; on error\r
10147 \r
10148 \r
10149           EMM Functions                                                 167\r
10150 \f\r
10151 \r
10152 \r
10153 \r
10154 \r
10155           Function 28. Alternate Map Register Set\r
10156           Allocate DMA Register Set subfunction\r
10157 \r
10158 \r
10159 \r
10160           Note............................................................\r
10161                This function is for use by operating systems only.  The\r
10162                operating system can disable this function at any time. \r
10163                Refer to Function 30 for a description of how an operating\r
10164                system can enable or disable this function.\r
10165 \r
10166 \r
10167           PURPOSE\r
10168 \r
10169                The Allocate DMA Register Set subfunction gets the number of\r
10170                a DMA register set for an OS/E, if a DMA register set is\r
10171                currently available for use.  If the hardware does not\r
10172                support DMA register sets, a DMA register set number of zero\r
10173                will be returned.\r
10174 \r
10175                In a multitasking operating system, when one task is waiting\r
10176                for DMA to complete, it is useful to be able to switch to\r
10177                another task.  However, if the DMA is being mapped through\r
10178                the current register set, the switching cannot occur.  That\r
10179                is, all DMA action must be complete before any remapping of\r
10180                pages can be done.\r
10181 \r
10182                The operating system would initiate a DMA operation on a\r
10183                specific DMA channel using a specific alternate map register\r
10184                set.  This alternate map register set would not be used\r
10185                again, by the operating system or an application, until\r
10186                after the DMA operation is complete.  The operating system\r
10187                guarantees this by not changing the contents of the alter-\r
10188                nate map register set, or allowing an application to change\r
10189                the contents of the alternate map register set, for the\r
10190                duration of the DMA operation.\r
10191 \r
10192 \r
10193           CALLING PARAMETERS\r
10194 \r
10195                AX = 5B05h\r
10196                    Contains the Allocate DMA Register Set subfunction.\r
10197 \r
10198 \r
10199           RESULTS\r
10200 \r
10201                These results are valid only if the status returned is zero.\r
10202 \r
10203                BL = DMA register set number\r
10204                    Contains the number of a DMA register set.  If there are\r
10205                    no DMA register sets supported by the hardware, a zero\r
10206                    will be returned.\r
10207 \r
10208           EMM Functions                                                 168\r
10209 \f\r
10210 \r
10211 \r
10212 \r
10213 \r
10214           Function 28. Alternate Map Register Set\r
10215           Allocate DMA Register Set subfunction\r
10216 \r
10217 \r
10218 \r
10219           REGISTERS MODIFIED\r
10220 \r
10221                AX, BX\r
10222 \r
10223 \r
10224           STATUS\r
10225 \r
10226                AH = 0   SUCCESSFUL.\r
10227                    The manager has allocated the DMA register set.\r
10228 \r
10229                AH = 80h   NON-RECOVERABLE.\r
10230                    The manager detected a malfunction in the memory manager\r
10231                    software.\r
10232 \r
10233                AH = 81h   NON-RECOVERABLE.\r
10234                    The manager detected a malfunction in the expanded\r
10235                    memory hardware.\r
10236 \r
10237                AH = 84h   NON-RECOVERABLE.\r
10238                    The function code passed to the memory manager is not\r
10239                    defined.\r
10240 \r
10241                AH = 8Fh   NON-RECOVERABLE.\r
10242                    The subfunction parameter is invalid.\r
10243 \r
10244                AH = 9Bh   NON-RECOVERABLE.\r
10245                    DMA register sets are supported.  However, all DMA\r
10246                    register sets are currently allocated.\r
10247 \r
10248                AH = A4h   NON-RECOVERABLE.\r
10249                    Access to this function has been denied by the operating\r
10250                    system.  The function cannot be used at this time.\r
10251 \r
10252 \r
10253           EXAMPLE\r
10254 \r
10255           DMA_reg_set_number                  DB ?\r
10256 \r
10257           MOV   AX,5B05h                      ; load function code\r
10258           INT   67h                           ; call memory manager\r
10259           OR    AH,AH                         ; check EMM status\r
10260           JNZ   emm_err_handler               ; jump to error handler\r
10261                                               ; on error\r
10262           MOV   DMA_reg_set_number,BL         ; save number of DMA\r
10263                                               ; register set\r
10264 \r
10265 \r
10266 \r
10267           EMM Functions                                                 169\r
10268 \f\r
10269 \r
10270 \r
10271 \r
10272 \r
10273           Function 28. Alternate Map Register Set\r
10274           Enable DMA on Alternate Map Register Set subfunction\r
10275 \r
10276 \r
10277 \r
10278           Note............................................................\r
10279                This function is for use by operating systems only.  The\r
10280                operating system can disable this function at any time. \r
10281                Refer to Function 30 for a description of how an operating\r
10282                system can enable or disable this function.\r
10283 \r
10284 \r
10285           PURPOSE\r
10286 \r
10287                This subfunction allows DMA accesses on a specific DMA\r
10288                channel to be associated with a specific alternate map\r
10289                register set.  In a multitasking operating system, when a\r
10290                task is waiting for the completion of DMA, it is useful to\r
10291                be able to switch to another task until the DMA operation\r
10292                completes.\r
10293 \r
10294                Any DMA on the specified channel will go through the speci-\r
10295                fied DMA register set regardless of the current register\r
10296                set.  If a DMA channel is not assigned to a DMA register\r
10297                set, DMA for that channel will be mapped through the current\r
10298                register set.\r
10299 \r
10300 \r
10301           CALLING PARAMETERS\r
10302 \r
10303                AX = 5B06h\r
10304                    Contains the Enable DMA on Alternate Map Register Set\r
10305                    subfunction.\r
10306 \r
10307                BL = DMA register set number\r
10308                    Contains the number of the alternate map register set to\r
10309                    be used for DMA operations on the DMA channel specified\r
10310                    by DL.  If the alternate map register set specified is\r
10311                    zero, no special action will be taken on DMA accesses\r
10312                    for the DMA channel specified.\r
10313 \r
10314                DL = DMA channel number\r
10315                    Contains the DMA channel which is to be associated with\r
10316                    the DMA map register set specified in BL.\r
10317 \r
10318 \r
10319           REGISTERS MODIFIED\r
10320 \r
10321                AX\r
10322 \r
10323 \r
10324 \r
10325 \r
10326           EMM Functions                                                 170\r
10327 \f\r
10328 \r
10329 \r
10330 \r
10331 \r
10332           Function 28. Alternate Map Register Set\r
10333           Enable DMA on Alternate Map Register Set subfunction\r
10334 \r
10335 \r
10336 \r
10337           STATUS\r
10338 \r
10339                AH = 0   SUCCESSFUL.\r
10340                    The manager has enabled DMA on the DMA register set and\r
10341                    the DMA channel specified.\r
10342 \r
10343                AH = 80h   NON-RECOVERABLE.\r
10344                    The manager detected a malfunction in the memory manager\r
10345                    software.\r
10346 \r
10347                AH = 81h   NON-RECOVERABLE.\r
10348                    The manager detected a malfunction in the expanded\r
10349                    memory hardware.\r
10350 \r
10351                AH = 84h   NON-RECOVERABLE.\r
10352                    The function code passed to the memory manager is not\r
10353                    defined.\r
10354 \r
10355                AH = 8Fh   NON-RECOVERABLE.\r
10356                    The subfunction parameter is invalid.\r
10357 \r
10358                AH = 9Ah   NON-RECOVERABLE.\r
10359                    Alternate DMA register sets are supported, but the\r
10360                    alternate DMA register set specified is not supported.\r
10361 \r
10362                AH = 9Ch   NON-RECOVERABLE.\r
10363                    Alternate DMA register sets are not supported, and the\r
10364                    DMA register set specified is not zero.\r
10365 \r
10366                AH = 9Dh   NON-RECOVERABLE.\r
10367                    DMA register sets are supported, but the DMA register\r
10368                    set specified is either not defined or not allocated.\r
10369 \r
10370                AH = 9Eh   NON-RECOVERABLE.\r
10371                    Dedicated DMA channels are not supported.\r
10372 \r
10373                AH = 9Fh   NON-RECOVERABLE.\r
10374                    Dedicated DMA channels are supported, but the DMA\r
10375                    channel specified is not supported.\r
10376 \r
10377                AH = A4h   NON-RECOVERABLE.\r
10378                    The operating system has denied access to this function. \r
10379                    The function cannot be used at this time.\r
10380 \r
10381 \r
10382 \r
10383 \r
10384 \r
10385           EMM Functions                                                 171\r
10386 \f\r
10387 \r
10388 \r
10389 \r
10390 \r
10391           Function 28. Alternate Map Register Set\r
10392           Enable DMA on Alternate Map Register Set subfunction\r
10393 \r
10394 \r
10395 \r
10396           EXAMPLE\r
10397 \r
10398           alt_map_reg_set                DB ?\r
10399           DMA_channel_num                DB ?\r
10400 \r
10401           MOV   BL,alt_map_reg_set\r
10402           MOV   DL,DMA_channel_num\r
10403           MOV   AX,5B06h                 ; load function code\r
10404           INT   67h                      ; call the memory manager\r
10405           OR    AH,AH                    ; check EMM status\r
10406           JNZ   emm_err_handler          ; jump to error handler on error\r
10407 \r
10408 \r
10409 \r
10410 \r
10411 \r
10412 \r
10413 \r
10414 \r
10415 \r
10416 \r
10417 \r
10418 \r
10419 \r
10420 \r
10421 \r
10422 \r
10423 \r
10424 \r
10425 \r
10426 \r
10427 \r
10428 \r
10429 \r
10430 \r
10431 \r
10432 \r
10433 \r
10434 \r
10435 \r
10436 \r
10437 \r
10438 \r
10439 \r
10440 \r
10441 \r
10442 \r
10443 \r
10444           EMM Functions                                                 172\r
10445 \f\r
10446 \r
10447 \r
10448 \r
10449 \r
10450           Function 28. Alternate Map Register Set\r
10451           Disable DMA on Alternate Map Register Set subfunction\r
10452 \r
10453 \r
10454 \r
10455           Note............................................................\r
10456                This function is for use by operating systems only.  The\r
10457                operating system can disable this function at any time. \r
10458                Refer to Function 30 for a description of how an operating\r
10459                system can enable or disable this function.\r
10460 \r
10461 \r
10462           PURPOSE\r
10463 \r
10464                This subfunction disables DMA accesses for all DMA channels\r
10465                which were associated with a specific alternate map register\r
10466                set.\r
10467 \r
10468 \r
10469           CALLING PARAMETERS\r
10470 \r
10471                AX = 5B07h\r
10472                    Contains the Disable DMA on Alternate Map Register Set\r
10473                    subfunction.\r
10474 \r
10475                BL = alternate register set number\r
10476                    Contains the number of the DMA register set for which\r
10477                    all operations are to be disabled.  If the alternate map\r
10478                    register set specified is zero, no action will be taken.\r
10479 \r
10480 \r
10481           REGISTERS MODIFIED\r
10482 \r
10483                AX\r
10484 \r
10485 \r
10486           STATUS\r
10487 \r
10488                AH = 0   SUCCESSFUL.\r
10489                    The manager has disabled DMA operations on the alternate\r
10490                    DMA register set.\r
10491 \r
10492                AH = 80h   NON-RECOVERABLE.\r
10493                    The manager detected a malfunction in the memory manager\r
10494                    software.\r
10495 \r
10496                AH = 81h   NON-RECOVERABLE.\r
10497                    The manager detected a malfunction in the expanded\r
10498                    memory hardware.\r
10499 \r
10500 \r
10501 \r
10502 \r
10503           EMM Functions                                                 173\r
10504 \f\r
10505 \r
10506 \r
10507 \r
10508 \r
10509           Function 28. Alternate Map Register Set\r
10510           Disable DMA on Alternate Map Register Set subfunction\r
10511 \r
10512 \r
10513 \r
10514                AH = 84h   NON-RECOVERABLE.\r
10515                    The function code passed to the memory manager is not\r
10516                    defined.\r
10517 \r
10518                AH = 8Fh   NON-RECOVERABLE.\r
10519                    The subfunction parameter is invalid.\r
10520 \r
10521                AH = 9Ah   NON-RECOVERABLE.\r
10522                    Alternate DMA register sets are supported, but the\r
10523                    alternate DMA register set specified is not supported.\r
10524 \r
10525                AH = 9Ch   NON-RECOVERABLE.\r
10526                    Alternate DMA register sets are not supported, and the\r
10527                    DMA register set specified is not zero.\r
10528 \r
10529                AH = 9Dh   NON-RECOVERABLE.\r
10530                    DMA register sets are supported, but the DMA register\r
10531                    set specified is either not defined or not allocated.\r
10532 \r
10533                AH = 9Eh   NON-RECOVERABLE.\r
10534                    Dedicated DMA channels are not supported.\r
10535 \r
10536                AH = 9Fh   NON-RECOVERABLE.\r
10537                    Dedicated DMA channels are supported, but the DMA\r
10538                    channel specified is not supported.\r
10539 \r
10540                AH = A4h   NON-RECOVERABLE.\r
10541                    The operating system has denied access to this function. \r
10542                    The function cannot be used at this time.\r
10543 \r
10544 \r
10545           EXAMPLE\r
10546 \r
10547           DMA_reg_set                    DB ?\r
10548 \r
10549           MOV   BL,DMA_reg_set\r
10550           MOV   AX,5B07h                 ; load function code\r
10551           INT   67h                      ; call the memory manager\r
10552           OR    AH,AH                    ; check EMM status\r
10553           JNZ   emm_err_handler          ; jump to error handler on error\r
10554 \r
10555 \r
10556 \r
10557 \r
10558 \r
10559 \r
10560 \r
10561 \r
10562           EMM Functions                                                 174\r
10563 \f\r
10564 \r
10565 \r
10566 \r
10567 \r
10568           Function 28. Alternate Map Register Set\r
10569           Deallocate DMA Register Set subfunction\r
10570 \r
10571 \r
10572 \r
10573           Note............................................................\r
10574                This function is for use by operating systems only.  The\r
10575                operating system can disable this function at any time. \r
10576                Refer to Function 30 for a description of how an operating\r
10577                system can enable or disable this function.\r
10578 \r
10579 \r
10580           PURPOSE\r
10581 \r
10582                The Deallocate DMA Register Set subfunction deallocates the\r
10583                specified DMA register set.\r
10584 \r
10585 \r
10586           CALLING PARAMETERS\r
10587 \r
10588                AX = 5B08h\r
10589                    Contains the Deallocate DMA Register Set subfunction.\r
10590 \r
10591                BL = DMA register set number\r
10592                    Contains the number of the DMA register set which should\r
10593                    not be used for DMA operations any longer.  The DMA\r
10594                    register set would have been previously allocated and\r
10595                    enabled for DMA operations on a specific DMA channel. \r
10596                    If the DMA register set specified is zero, no action\r
10597                    will be taken.\r
10598 \r
10599 \r
10600           REGISTERS MODIFIED\r
10601 \r
10602                AX\r
10603 \r
10604 \r
10605           STATUS\r
10606 \r
10607                AH = 0   SUCCESSFUL.\r
10608                    The manager has deallocated the DMA register set.\r
10609 \r
10610                AH = 80h   NON-RECOVERABLE.\r
10611                    The manager detected a malfunction in the memory manager\r
10612                    software.\r
10613 \r
10614                AH = 81h   NON-RECOVERABLE.\r
10615                    The manager detected a malfunction in the expanded\r
10616                    memory hardware.\r
10617 \r
10618 \r
10619 \r
10620 \r
10621           EMM Functions                                                 175\r
10622 \f\r
10623 \r
10624 \r
10625 \r
10626 \r
10627           Function 28. Alternate Map Register Set\r
10628           Deallocate DMA on Alternate Map Register Set subfunction\r
10629 \r
10630 \r
10631 \r
10632                AH = 84h   NON-RECOVERABLE.\r
10633                    The function code passed to the memory manager is not\r
10634                    defined.\r
10635 \r
10636                AH = 8Fh   NON-RECOVERABLE.\r
10637                    The subfunction parameter is invalid.\r
10638 \r
10639                AH = 9Ch   NON-RECOVERABLE.\r
10640                    DMA register sets are not supported, and the DMA\r
10641                    register set specified is not zero.\r
10642 \r
10643                AH = 9Dh   NON-RECOVERABLE.\r
10644                    DMA register sets are supported, but the DMA register\r
10645                    set specified is either not defined or not allocated.\r
10646 \r
10647                AH = A4h   NON-RECOVERABLE.\r
10648                    The operating system has denied access to this function. \r
10649                    The function cannot be used at this time.\r
10650 \r
10651 \r
10652           EXAMPLE\r
10653 \r
10654           DMA_reg_set_num                DB ?\r
10655 \r
10656           MOV   BL,DMA_reg_set_num\r
10657           MOV   AX,5B08h                 ; load function code\r
10658           INT   67h                      ; call the memory manager\r
10659           OR    AH,AH                    ; check EMM status\r
10660           JNZ   emm_err_handler          ; jump to error handler on error\r
10661 \r
10662 \r
10663 \r
10664 \r
10665 \r
10666 \r
10667 \r
10668 \r
10669 \r
10670 \r
10671 \r
10672 \r
10673 \r
10674 \r
10675 \r
10676 \r
10677 \r
10678 \r
10679 \r
10680           EMM Functions                                                 176\r
10681 \f\r
10682 \r
10683 \r
10684 \r
10685 \r
10686           Function 29. Prepare Expanded Memory Hardware For Warm Boot\r
10687 \r
10688 \r
10689 \r
10690           PURPOSE\r
10691 \r
10692                This function prepares the expanded memory hardware for an\r
10693                impending warm boot.  This function assumes that the next\r
10694                operation that the operating system performs is a warm boot\r
10695                of the system.  In general, this function will effect the\r
10696                current mapping context, the alternate register set in use,\r
10697                and any other expanded memory hardware dependencies which\r
10698                need to be initialized at boot time.  If an application\r
10699                decides to map memory below 640K, the application must trap\r
10700                all possible conditions leading to a warm boot and invoke\r
10701                this function before performing the warm boot itself.\r
10702 \r
10703 \r
10704           CALLING PARAMETERS\r
10705 \r
10706                AH = 5Ch\r
10707                    Contains the Prepare Expanded Memory Hardware for Warm\r
10708                    Boot function.\r
10709 \r
10710 \r
10711           REGISTERS MODIFIED\r
10712 \r
10713                AX\r
10714 \r
10715 \r
10716           STATUS\r
10717 \r
10718                AH = 0   SUCCESSFUL.\r
10719                    The manager has prepared the expanded memory hardware\r
10720                    for a warm boot.\r
10721 \r
10722                AH = 80h   NON-RECOVERABLE.\r
10723                    The manager detected a malfunction in the memory manager\r
10724                    software.\r
10725 \r
10726                AH = 81h   NON-RECOVERABLE.\r
10727                    The manager detected a malfunction in the expanded\r
10728                    memory hardware.\r
10729 \r
10730                AH = 84h   NON-RECOVERABLE.\r
10731                    The function code passed to the memory manager is not\r
10732                    defined.\r
10733 \r
10734 \r
10735 \r
10736 \r
10737 \r
10738 \r
10739           EMM Functions                                                 177\r
10740 \f\r
10741 \r
10742 \r
10743 \r
10744 \r
10745           Function 29. Prepare Expanded Memory Hardware for Warm Boot\r
10746 \r
10747 \r
10748 \r
10749           EXAMPLE\r
10750 \r
10751           MOV   AH,5Ch                   ; load function code\r
10752           INT   67h                      ; call the memory manager\r
10753           OR    AH,AH                    ; check EMM status\r
10754           JNZ   emm_err_handler          ; jump to error handler on error\r
10755 \r
10756 \r
10757 \r
10758 \r
10759 \r
10760 \r
10761 \r
10762 \r
10763 \r
10764 \r
10765 \r
10766 \r
10767 \r
10768 \r
10769 \r
10770 \r
10771 \r
10772 \r
10773 \r
10774 \r
10775 \r
10776 \r
10777 \r
10778 \r
10779 \r
10780 \r
10781 \r
10782 \r
10783 \r
10784 \r
10785 \r
10786 \r
10787 \r
10788 \r
10789 \r
10790 \r
10791 \r
10792 \r
10793 \r
10794 \r
10795 \r
10796 \r
10797 \r
10798           EMM Functions                                                 178\r
10799 \f\r
10800 \r
10801 \r
10802 \r
10803 \r
10804           Function 30. Enable/Disable OS/E Function Set Functions\r
10805           Enable OS/E Function Set subfunction\r
10806 \r
10807 \r
10808 \r
10809           Note............................................................\r
10810                This function is for use by operating systems only.  The\r
10811                operating system can disable this function at any time.\r
10812 \r
10813 \r
10814           PURPOSE\r
10815 \r
10816                This subfunction provides an OS/E with the ability to enable\r
10817                all programs or device drivers to use the OS/E specific\r
10818                functions.  The capability is provided only for an OS/E\r
10819                which manages regions of mappable conventional memory and\r
10820                cannot permit programs to use any of the functions which\r
10821                affect mappable conventional memory regions, but must be\r
10822                able to use these functions itself.  When an OS/E disables\r
10823                these functions and a program attempts to use them, the\r
10824                memory manager returns a status to the program indicating\r
10825                that the OS/E has denied the program access to the function. \r
10826                In other words, the functions will not work when disabled. \r
10827                However, all programs may use them when enabled.\r
10828 \r
10829                The OS/E (Operating System/Environment) functions this\r
10830                subfunction enables are:\r
10831 \r
10832                Function 26.  Get Expanded Memory Hardware Information.\r
10833                Function 28.  Alternate Map Register Sets.\r
10834                Function 30.  Enable/Disable Operating System Functions.\r
10835 \r
10836                It appears contradictory that the OS/E can re-enable these\r
10837                functions when the function which re-enables them is itself\r
10838                disabled.  An overview of the process follows.\r
10839 \r
10840                The memory manager enables all the OS/E specific functions,\r
10841                including this one, when it is loaded.  The OS/E gets\r
10842                exclusive access to these functions by invoking either of\r
10843                the Enable/Disable OS/E Function Set subfunctions before any\r
10844                other software does.\r
10845 \r
10846                On the first invocation of either of these subfunctions, the\r
10847                memory manager returns an access_key which the OS/E must use\r
10848                in all future invocations of either of these subfunctions. \r
10849                The memory manager does not require the access_key on the\r
10850                first invocation of the Enable/Disable OS/E Function Set\r
10851                subfunctions.\r
10852 \r
10853 \r
10854 \r
10855 \r
10856 \r
10857           EMM Functions                                                 179\r
10858 \f\r
10859 \r
10860 \r
10861 \r
10862 \r
10863           Function 30. Enable/Disable OS/E Function Set Functions\r
10864           Enable OS/E Function Set subfunction\r
10865 \r
10866 \r
10867 \r
10868                On all subsequent invocations, the access_key is required\r
10869                for either the Enable or Disable OS/E Function Set subfunc-\r
10870                tions.  Since the access_key is returned only on the first\r
10871                invocation of the Enable/Disable OS/E Function Set subfunc-\r
10872                tions, and presumably the OS/E is the first software to\r
10873                invoke this function, only the OS/E obtains a copy of this\r
10874                key.  The memory manager must return an access key with a\r
10875                random value, a fixed value key defeats the purpose of\r
10876                providing this level of security for an OS/E.\r
10877 \r
10878 \r
10879           CALLING PARAMETERS\r
10880 \r
10881                AX = 5D00h\r
10882                    Contains the Enable OS/E Function Set subfunction.\r
10883 \r
10884                BX,CX = access_key\r
10885                    Required on all function invocations after the first. \r
10886                    The access_key value returned by the first function\r
10887                    invocation is required.\r
10888 \r
10889 \r
10890           RESULTS\r
10891 \r
10892                These results are valid only if the status returned is zero.\r
10893 \r
10894                BX,CX = access_key\r
10895                    Returned only on the first function invocation, the\r
10896                    memory manager returns a random valued key which will be\r
10897                    required thereafter for the execution of this function. \r
10898                    On all invocations after the first, this key is not\r
10899                    returned.  Neither BX nor CX is affected after the first\r
10900                    time this function is invoked.\r
10901 \r
10902 \r
10903           REGISTERS MODIFIED\r
10904 \r
10905                AX, BX, CX\r
10906 \r
10907 \r
10908           STATUS\r
10909 \r
10910                AH = 0   SUCCESSFUL.\r
10911                    The operating system function set has been enabled.\r
10912 \r
10913 \r
10914 \r
10915 \r
10916           EMM Functions                                                 180\r
10917 \f\r
10918 \r
10919 \r
10920 \r
10921 \r
10922           Function 30. Enable/Disable OS/E Function Set Functions\r
10923           Enable OS/E Function Set subfunction\r
10924 \r
10925 \r
10926 \r
10927                AH = 80h   NON-RECOVERABLE.\r
10928                    The manager detected a malfunction in the memory manager\r
10929                    software.\r
10930 \r
10931                AH = 81h   NON-RECOVERABLE.\r
10932                    The manager detected a malfunction in the expanded\r
10933                    memory hardware.\r
10934 \r
10935                AH = 84h   NON-RECOVERABLE.\r
10936                    The function code passed to the memory manager is not\r
10937                    defined.\r
10938 \r
10939                AH = 8Fh   NON-RECOVERABLE.\r
10940                    The subfunction parameter is invalid.\r
10941 \r
10942                AH = A4h   NON-RECOVERABLE.\r
10943                    The operating system has denied access to this function. \r
10944                    The function cannot be used at this time.  The value of\r
10945                    the key which was passed to this function does not\r
10946                    entitle the program to execute this function.\r
10947 \r
10948 \r
10949           EXAMPLE\r
10950 \r
10951           First invocation\r
10952 \r
10953           access_key                     DW 2 DUP (?)\r
10954 \r
10955           MOV   AX,5D00h                 ; load function code\r
10956           INT   67h                      ; call the memory manager\r
10957           OR    AH,AH                    ; check EMM status\r
10958           JNZ   emm_err_handler          ; jump to error handler on error\r
10959           MOV   access_key[0],BX\r
10960           MOV   access_key[2],CX\r
10961 \r
10962 \r
10963           All invocations after the first\r
10964 \r
10965           access_key                     DW 2 DUP (?)\r
10966 \r
10967           MOV   BX,access_key[0]\r
10968           MOV   CX,access_key[2]\r
10969           MOV   AX,5D00h                 ; load function code\r
10970           INT   67h                      ; call the memory manager\r
10971           OR    AH,AH                    ; check EMM status\r
10972           JNZ   emm_err_handler          ; jump to error handler on error\r
10973 \r
10974 \r
10975           EMM Functions                                                 181\r
10976 \f\r
10977 \r
10978 \r
10979 \r
10980 \r
10981           Function 30. Enable/Disable OS/E Function Set Functions\r
10982           Disable OS/E Function Set subfunction\r
10983 \r
10984 \r
10985 \r
10986           Note............................................................\r
10987                This function is for use by operating systems only.  The\r
10988                operating system can disable this function at any time.\r
10989 \r
10990 \r
10991           PURPOSE\r
10992 \r
10993                This subfunction provides an OS/E with the ability to\r
10994                disable all programs or device drivers from using the OS/E\r
10995                specific functions.  The capability is provided only for an\r
10996                OS/E which manages regions of mappable conventional memory\r
10997                and cannot permit programs to use any of the functions which\r
10998                would affect mappable conventional memory regions.  When an\r
10999                OS/E disables these functions and a program attempts to use\r
11000                them, the memory manager returns a status to the program\r
11001                indicating that the OS/E has denied the program access to\r
11002                the function.  In other words, the functions will not work\r
11003                when disabled.\r
11004 \r
11005                The OS/E (Operating System) functions which are disabled by\r
11006                this subfunction are:\r
11007 \r
11008                Function 26.  Get Expanded Memory Hardware Information.\r
11009                Function 28.  Alternate Map Register Sets.\r
11010                Function 30.  Enable/Disable Operating System Functions.\r
11011 \r
11012 \r
11013           CALLING PARAMETERS\r
11014 \r
11015                AX = 5D01h\r
11016                    Contains the Disable OS/E Function Set subfunction.\r
11017 \r
11018                BX,CX = access_key\r
11019                    Required on all function invocations after the first. \r
11020                    The access_key value returned by the first function\r
11021                    invocation is required.\r
11022 \r
11023 \r
11024 \r
11025 \r
11026 \r
11027 \r
11028 \r
11029 \r
11030 \r
11031 \r
11032 \r
11033 \r
11034           EMM Functions                                                 182\r
11035 \f\r
11036 \r
11037 \r
11038 \r
11039 \r
11040           Function 30. Enable/Disable OS/E Function Set Functions\r
11041           Disable OS/E Function Set subfunction\r
11042 \r
11043 \r
11044 \r
11045           RESULTS\r
11046 \r
11047                These results are valid only if the status returned is zero.\r
11048 \r
11049                BX,CX = access_key\r
11050                    Returned only on the first function invocation, the\r
11051                    memory manager returns a random valued key which will be\r
11052                    required thereafter for the execution of this function. \r
11053                    On all invocations after the first, this key is not\r
11054                    returned.  Neither BX nor CX is affected after the first\r
11055                    time this function is invoked.\r
11056 \r
11057 \r
11058           REGISTERS MODIFIED\r
11059 \r
11060                AX, BX, CX\r
11061 \r
11062 \r
11063           STATUS\r
11064 \r
11065                AH = 0   SUCCESSFUL.\r
11066                    The operating system function set has been disabled.\r
11067 \r
11068                AH = 80h   NON-RECOVERABLE.\r
11069                    The manager detected a malfunction in the memory manager\r
11070                    software.\r
11071 \r
11072                AH = 81h   NON-RECOVERABLE.\r
11073                    The manager detected a malfunction in the expanded\r
11074                    memory hardware.\r
11075 \r
11076                AH = 84h   NON-RECOVERABLE.\r
11077                    The function code passed to the memory manager is not\r
11078                    defined.\r
11079 \r
11080                AH = 8Fh   NON-RECOVERABLE.\r
11081                    The subfunction parameter is invalid.\r
11082 \r
11083                AH = A4h   NON-RECOVERABLE.\r
11084                    The operating system has denied access to this function. \r
11085                    The function cannot be used at this time.  The value of\r
11086                    the key which was passed to this function does not\r
11087                    entitle the program to execute this function.\r
11088 \r
11089 \r
11090 \r
11091 \r
11092 \r
11093           EMM Functions                                                 183\r
11094 \f\r
11095 \r
11096 \r
11097 \r
11098 \r
11099           Function 30. Enable/Disable OS/E Function Set Functions\r
11100           Disable OS/E Function Set subfunction\r
11101 \r
11102 \r
11103 \r
11104           EXAMPLE\r
11105 \r
11106           First Function invocation\r
11107 \r
11108           access_key                     DW 2 DUP (?)\r
11109 \r
11110           MOV   AX,5D01h                 ; load function code\r
11111           INT   67h                      ; call the memory manager\r
11112           OR    AH,AH                    ; check EMM status\r
11113           JNZ   emm_err_handler          ; jump to error handler on error\r
11114           MOV   access_key[0],BX\r
11115           MOV   access_key[2],CX\r
11116 \r
11117 \r
11118           All invocations after the first\r
11119 \r
11120           access_key                     DW 2 DUP (?)\r
11121 \r
11122           MOV   BX,access_key[0]\r
11123           MOV   CX,access_key[2]\r
11124           MOV   AX,5D01h                 ; load function code\r
11125           INT   67h                      ; call the memory manager\r
11126           OR    AH,AH                    ; check EMM status\r
11127           JNZ   emm_err_handler          ; jump to error handler on error\r
11128 \r
11129 \r
11130 \r
11131 \r
11132 \r
11133 \r
11134 \r
11135 \r
11136 \r
11137 \r
11138 \r
11139 \r
11140 \r
11141 \r
11142 \r
11143 \r
11144 \r
11145 \r
11146 \r
11147 \r
11148 \r
11149 \r
11150 \r
11151 \r
11152           EMM Functions                                                 184\r
11153 \f\r
11154 \r
11155 \r
11156 \r
11157  \r
11158           Function 30. Enable/Disable OS/E Function Set Functions\r
11159           Return Access Key subfunction\r
11160 \r
11161 \r
11162 \r
11163           Note............................................................\r
11164                This function is for use by operating systems only.  The\r
11165                operating system can disable this function at any time.\r
11166 \r
11167 \r
11168           PURPOSE\r
11169 \r
11170                This subfunction provides an OS/E with the ability to return\r
11171                the access key to the memory manager.  Returning the access\r
11172                key to the memory manager places the memory manager in the\r
11173                state it is in at installation time (regarding the use of\r
11174                the OS/E function set and the access key).  That is, access\r
11175                to the OS/E function set is enabled.  Upon execution of the\r
11176                next enable/disable OS/E function set subfunction, the\r
11177                access key will once again be returned.\r
11178 \r
11179 \r
11180           CALLING PARAMETERS\r
11181 \r
11182                AX = 5D02h\r
11183                    Contains the Return Access Key subfunction.\r
11184 \r
11185                BX,CX = access_key\r
11186                    Required on all function invocations.  The access_key\r
11187                    value returned by the first function invocation of the\r
11188                    enable or disable subfunctions is required.\r
11189 \r
11190 \r
11191           REGISTERS MODIFIED\r
11192 \r
11193                AX\r
11194 \r
11195 \r
11196           STATUS\r
11197 \r
11198                AH = 0   SUCCESSFUL.\r
11199                    The access key has been returned to the memory manager.\r
11200 \r
11201                AH = 80h   NON-RECOVERABLE.\r
11202                    The manager detected a malfunction in the memory manager\r
11203                    software.\r
11204 \r
11205                AH = 81h   NON-RECOVERABLE.\r
11206                    The manager detected a malfunction in the expanded\r
11207                    memory hardware.\r
11208 \r
11209 \r
11210 \r
11211           EMM Functions                                                 185\r
11212 \f\r
11213 \r
11214 \r
11215 \r
11216 \r
11217           Function 30. Enable/Disable OS/E Function Set Functions\r
11218           Return Access Key subfunction\r
11219 \r
11220 \r
11221 \r
11222                AH = 84h   NON-RECOVERABLE.\r
11223                    The function code passed to the memory manager is not\r
11224                    defined.\r
11225 \r
11226                AH = 8Fh   NON-RECOVERABLE.\r
11227                    The subfunction parameter is invalid.\r
11228 \r
11229                AH = A4h   NON-RECOVERABLE.\r
11230                    The operating system has denied access to this function. \r
11231                    The function cannot be used at this time.  The value of\r
11232                    the key which was passed to this function does not\r
11233                    entitle the program to execute this function.\r
11234 \r
11235 \r
11236           EXAMPLE\r
11237 \r
11238           access_key                     DW 2 DUP (?)\r
11239 \r
11240           MOV   BX,access_key[0]\r
11241           MOV   CX,access_key[2]\r
11242           MOV   AX,5D02h                 ; load function code\r
11243           INT   67h                      ; call the memory manager\r
11244           OR    AH,AH                    ; check EMM status\r
11245           JNZ   emm_err_handler          ; jump to error handler on error\r
11246 \r
11247 \r
11248 \r
11249 \r
11250 \r
11251 \r
11252 \r
11253 \r
11254 \r
11255 \r
11256 \r
11257 \r
11258 \r
11259 \r
11260 \r
11261 \r
11262 \r
11263 \r
11264 \r
11265 \r
11266 \r
11267 \r
11268 \r
11269 \r
11270           EMM Functions                                                 186\r
11271 \f\r
11272 \r
11273 \r
11274 \r
11275 \r
11276           Appendix A\r
11277           FUNCTION AND STATUS CODE CROSS REFERENCE TABLES\r
11278 \r
11279 \r
11280 \r
11281                This appendix contains two cross reference tables:  one\r
11282                lists the function codes and the status codes they return;\r
11283                the other lists the status codes and the functions that\r
11284                return them.\r
11285 \r
11286 \r
11287           Table A-1.  Function and Status Code Cross Reference\r
11288           ----------------------------------------------------------------\r
11289 \r
11290           Function        Status                 Description\r
11291 \r
11292           ----------------------------------------------------------------\r
11293 \r
11294              40h    00h, 80h, 81h, 84h   Get Memory Manager Status\r
11295 \r
11296              41h    00h, 80h, 81h, 84h   Get Page Frame Segment Address\r
11297 \r
11298              42h    00h, 80h, 81h, 84h   Get Unallocated Page Count\r
11299 \r
11300              43h    00h, 80h, 81h, 84h   Allocate Pages\r
11301                     85h, 87h, 88h, 89h\r
11302 \r
11303              44h    00h, 80h, 81h, 83h   Map/Unmap Handle Page\r
11304                     84h, 8Ah, 8Bh\r
11305 \r
11306              45h    00h, 80h, 81h, 83h   Deallocate Pages\r
11307                     84h, 86h\r
11308 \r
11309              46h    00h, 80h, 81h, 84h   Get EMM Version\r
11310 \r
11311              47h    00h, 80h, 81h, 83h   Save Page Map\r
11312                     84h, 8Ch, 8Dh\r
11313 \r
11314              48h    00h, 80h, 81h, 83h   Restore Page Map\r
11315                     84h, 8Eh\r
11316 \r
11317              49h                         Reserved\r
11318 \r
11319              4Ah                         Reserved\r
11320 \r
11321              4Bh    00h, 80h, 81h, 84h   Get EMM Handle Count\r
11322 \r
11323              4Ch    00h, 80h, 81h, 83h   Get EMM Handle Pages\r
11324                     84h\r
11325 \r
11326              4Dh    00h, 80h, 81h, 84h   Get All EMM Handle Pages\r
11327 \r
11328 \r
11329           Cross Reference Tables                                        187\r
11330 \f\r
11331 \r
11332 \r
11333 \r
11334 \r
11335           Table A-1.  Function and Status Code Cross Reference (continued)\r
11336           ----------------------------------------------------------------\r
11337 \r
11338           Function        Status                 Description\r
11339 \r
11340           ----------------------------------------------------------------\r
11341 \r
11342            4E00h    00h, 80h, 81h, 84h   Get Page Map\r
11343                     8Fh\r
11344 \r
11345            4E01h    00h, 80h, 81h, 84h   Set Page Map\r
11346                     8Fh, A3h\r
11347 \r
11348            4E02h    00h, 80h, 81h, 84h   Get & Set Page Map\r
11349                     8Fh, A3h\r
11350 \r
11351            4E03h    00h, 80h, 81h, 84h   Get Size of Page Map Save Array\r
11352                     8Fh\r
11353 \r
11354            4F00h    00h, 80h, 81h, 84h   Get Partial Page Map\r
11355                     8Bh, 8Fh, A3h\r
11356 \r
11357            4F01h    00h, 80h, 81h, 84h   Set Partial Page Map\r
11358                     8Fh, A3h\r
11359 \r
11360            4F02h    00h, 80h, 81h, 84h   Get Size of Partial Page Map Array\r
11361                     8Bh, 8Fh\r
11362 \r
11363            5000h    00h, 80h, 81h, 83h   Map/Unmap Multiple Handle Pages\r
11364                     84h, 8Ah, 8Bh, 8Fh   (physical page number mode)\r
11365 \r
11366            5001h    00h, 80h, 81h, 83h   Map/Unmap Multiple Handle Pages\r
11367                     84h, 8Ah, 8Bh, 8Fh   (segment address mode)\r
11368 \r
11369              51h    00h, 80h, 81h, 83h   Reallocate Pages\r
11370                     84h, 87h, 88h\r
11371 \r
11372            5200h    00h, 80h, 81h, 83h   Get Handle Attribute\r
11373                     84h, 8Fh, 91h\r
11374 \r
11375            5201h    00h, 80h, 81h, 83h   Set Handle Attribute\r
11376                     84h, 8Fh, 90h, 91h\r
11377 \r
11378            5202h    00h, 80h, 81h, 84h   Get Handle Attribute Capability\r
11379                     8Fh\r
11380 \r
11381            5300h    00h, 80h, 81h, 83h   Get Handle Name\r
11382                     84h, 8Fh\r
11383 \r
11384            5301h    00h, 80h, 81h, 83h   Set Handle Name\r
11385                     84h, 8Fh, A1h\r
11386 \r
11387 \r
11388           Cross Reference Tables                                        188\r
11389 \f\r
11390 \r
11391 \r
11392 \r
11393 \r
11394           Table A-1.  Function and Status Code Cross Reference (continued)\r
11395           ----------------------------------------------------------------\r
11396 \r
11397           Function        Status                 Description\r
11398 \r
11399           ----------------------------------------------------------------\r
11400 \r
11401            5400h    00h, 80h, 81h, 84h   Get Handle Directory\r
11402                     8Fh\r
11403 \r
11404            5401h    00h, 80h, 81h, 84h   Search for Named Handle\r
11405                     8Fh, A0h, A1h\r
11406 \r
11407            5402h    00h, 80h, 81h, 84h   Get Total Handles\r
11408                     8Fh\r
11409 \r
11410            5500h    00h, 80h, 81h, 83h   Alter Page Map & Jump (Physical   \r
11411                     84h, 8Ah, 8Bh, 8Fh   page mode)\r
11412 \r
11413            5501h    00h, 80h, 81h, 83h   Alter Page Map & Jump (Segment    \r
11414                     84h, 8Ah, 8Bh, 8Fh   address mode)\r
11415 \r
11416            5600h    00h, 80h, 81h, 83h   Alter Page Map & Call (Physical   \r
11417                     84h, 8Ah, 8Bh, 8Fh   page mode)\r
11418 \r
11419            5601h    00h, 80h, 81h, 83h   Alter Page Map & Call (Segment    \r
11420                     84h, 8Ah, 8Bh, 8Fh   address mode)\r
11421 \r
11422            5602h    00h, 80h, 81h, 84h   Get Alter Page Map & Call Stack   \r
11423                     8Fh                  Space Size\r
11424 \r
11425            5700h    00h, 80h, 81h, 83h   Move Memory Region\r
11426                     84h, 8Ah, 8Fh, 92h\r
11427                     93h, 94h, 95h, 96h\r
11428                     98h, A2h\r
11429 \r
11430            5701h    00h, 80h, 81h, 83h   Exchange Memory Region\r
11431                     84h, 8Ah, 8Fh, 93h\r
11432                     94h, 95h, 96h, 97h\r
11433                     98h, A2h\r
11434 \r
11435            5800h    00h, 80h, 81h, 84h   Get Mappable Physical Address     \r
11436                     8Fh                  Array\r
11437 \r
11438            5801h    00h, 80h, 81h, 84h   Get Mappable Physical Address     \r
11439                     8Fh                  Array Entries\r
11440 \r
11441            5900h    00h, 80h, 81h, 84h   Get Expanded Memory Hardware      \r
11442                     8Fh, A4h             Information\r
11443 \r
11444            5901h    00h, 80h, 81h, 84h   Get Unallocated Raw Page Count\r
11445                     8Fh\r
11446 \r
11447           Cross Reference Tables                                        189\r
11448 \f\r
11449 \r
11450 \r
11451 \r
11452 \r
11453           Table A-1.  Function and Status Code Cross Reference (continued)\r
11454           ----------------------------------------------------------------\r
11455 \r
11456           Function        Status                 Description\r
11457 \r
11458           ----------------------------------------------------------------\r
11459 \r
11460            5A00h    00h, 80h, 81h, 84h   Allocate Standard Pages\r
11461                     85h, 87h, 88h, 8Fh\r
11462 \r
11463            5A01h    00h, 80h, 81h, 84h   Allocate Raw Pages\r
11464                     85h, 87h, 88h, 8Fh\r
11465 \r
11466            5B00h    00h, 80h, 81h, 84h   Get Alternate Map Register Set\r
11467                     8Fh, A4h\r
11468 \r
11469            5B01h    00h, 80h, 81h, 84h   Set Alternate Map Register Set\r
11470                     8Fh, 9Ah, 9Ch, 9Dh\r
11471                     A3h, A4h\r
11472 \r
11473            5B02h    00h, 80h, 81h, 84h   Get Alternate Map Save Array Size\r
11474                     8Fh, A4h\r
11475 \r
11476            5B03h    00h, 80h, 81h, 84h   Allocate Alternate Map Register   \r
11477                     8Fh, 9Bh, A4h        Set\r
11478 \r
11479            5B04h    00h, 80h, 81h, 84h   Deallocate Alternate Map Register \r
11480                     8Fh, 9Ch, 9Dh, A4h   Set\r
11481 \r
11482            5B05h    00h, 80h, 81h, 84h   Allocate DMA Register Set\r
11483                     8Fh, 9Bh, A4h\r
11484 \r
11485            5B06h    00h, 80h, 81h, 84h   Enable DMA on Alternate Map       \r
11486                     8Fh, 9Ah, 9Ch, 9Dh   Register Set\r
11487                     9Eh, 9Fh, A4h\r
11488 \r
11489            5B07h    00h, 80h, 81h, 84h   Disable DMA on Alternate Map      \r
11490                     8Fh, 9Ah, 9Ch, 9Dh   Register Set\r
11491                     9Eh, 9Fh, A4h\r
11492 \r
11493            5B08h    00h, 80h, 81h, 84h   Deallocate DMA Register Set\r
11494                     8Fh, 9Ch, 9Dh, A4h\r
11495 \r
11496              5Ch    00h, 80h, 81h, 84h   Prepare Expanded Memory Hardware\r
11497                                          for Warmboot\r
11498 \r
11499            5D00h    00h, 80h, 81h, 84h   Enable Operating System Function  \r
11500                     8Fh, A4h             Set\r
11501 \r
11502            5D01h    00h, 80h, 81h, 84h   Disable Operating System Function \r
11503                     8Fh, A4h             Set\r
11504 \r
11505 \r
11506           Cross Reference Tables                                        190\r
11507 \f\r
11508 \r
11509 \r
11510 \r
11511 \r
11512           Table A-1.  Function and Status Code Cross Reference (continued)\r
11513           ----------------------------------------------------------------\r
11514 \r
11515           Function        Status                 Description\r
11516 \r
11517           ----------------------------------------------------------------\r
11518 \r
11519            5D02h    00h, 80h, 81h, 84h   Return Operating System Access Key\r
11520                     8Fh, A4h\r
11521           ----------------------------------------------------------------\r
11522 \r
11523 \r
11524 \r
11525 \r
11526 \r
11527 \r
11528 \r
11529 \r
11530 \r
11531 \r
11532 \r
11533 \r
11534 \r
11535 \r
11536 \r
11537 \r
11538 \r
11539 \r
11540 \r
11541 \r
11542 \r
11543 \r
11544 \r
11545 \r
11546 \r
11547 \r
11548 \r
11549 \r
11550 \r
11551 \r
11552 \r
11553 \r
11554 \r
11555 \r
11556 \r
11557 \r
11558 \r
11559 \r
11560 \r
11561 \r
11562 \r
11563 \r
11564 \r
11565           Cross Reference Tables                                        191\r
11566 \f\r
11567 \r
11568 \r
11569 \r
11570 \r
11571           Table A-2.  Status and Function Code Cross Reference\r
11572           ----------------------------------------------------------------\r
11573 \r
11574           Status      Function                   Description\r
11575 \r
11576           ----------------------------------------------------------------\r
11577 \r
11578            00h   All                  The function completed normally.\r
11579 \r
11580            80h   All                  The memory manager has detected a\r
11581                                       malfunction in the expanded memory\r
11582                                       software.  A condition has been\r
11583                                       detected which would not have\r
11584                                       occurred if the memory manager had\r
11585                                       been operating correctly.\r
11586 \r
11587            81h   All                  The memory manager has detected a\r
11588                                       malfunction in the expanded memory\r
11589                                       hardware.  A condition has been\r
11590                                       detected which would not occur if the\r
11591                                       memory hardware were working correct-\r
11592                                       ly.  Diagnostics should be run on the\r
11593                                       expanded memory system to determine\r
11594                                       the source of the problem.\r
11595 \r
11596            82h   None                 This error code is not returned in\r
11597                                       version 3.2 of the memory manager or\r
11598                                       above.  In earlier versions of the\r
11599                                       memory manager this code meant a\r
11600                                       "busy" status.  This status indicated\r
11601                                       that the memory manager was already\r
11602                                       processing an expanded memory request\r
11603                                       when the current request was made and\r
11604                                       is unable to process another request. \r
11605                                       In versions 3.2 of the memory manager\r
11606                                       and above, the memory manager is\r
11607                                       never "busy" and can always honor\r
11608                                       requests.\r
11609 \r
11610            83h   44h, 45h, 47h, 48h   The memory manager can not find the\r
11611                  4Ch, 5000h, 5001h    handle specified.  The program has\r
11612                  51h, 5200h, 5201h    probably corrupted its specified\r
11613                  5300h, 5301h         handle.  The memory manager does not\r
11614                  5500h, 5501h         have any information pertaining to\r
11615                  5600h, 5601h         the  specified handle.  The program\r
11616                  5700h, 5701h         has probably corrupted its handle.\r
11617 \r
11618            84h   All                  The function code passed to the\r
11619                                       manager is not currently defined. \r
11620                                       Function codes in the range 40h\r
11621                                       through 5Dh are currently defined.\r
11622 \r
11623 \r
11624           Cross Reference Tables                                        192\r
11625 \f\r
11626 \r
11627 \r
11628 \r
11629 \r
11630           Table A-2.  Status and Function Code Cross Reference (continued)\r
11631           ----------------------------------------------------------------\r
11632 \r
11633           Status      Function                   Description\r
11634 \r
11635           ----------------------------------------------------------------\r
11636 \r
11637            85h   43h, 5A00h, 5A01h    No handles are currently available. \r
11638                                       All assignable handles are currently\r
11639                                       in use.  The program may re-request\r
11640                                       the assignment of a handle in the\r
11641                                       hope that another program has\r
11642                                       released a handle.  The maximum\r
11643                                       number of handles that may be\r
11644                                       supported is 255.\r
11645 \r
11646            86h   45h                  A mapping context restoration error\r
11647                                       has been detected.  This error occurs\r
11648                                       when a program attempts to return a\r
11649                                       handle and there is still a "mapping\r
11650                                       context" on the context stack for the\r
11651                                       indicated handle.  A program can\r
11652                                       recover from this error by restoring\r
11653                                       the mapping context before returning\r
11654                                       the handle.\r
11655 \r
11656            87h   43h, 51h, 5A00h,     The number of total pages that are\r
11657                  5A01h                available in the system is insuffi-\r
11658                                       cient to honor the request.  The\r
11659                                       program can recover from this\r
11660                                       condition by requesting fewer pages.\r
11661 \r
11662            88h   43h, 51h, 5A00h,     The number of unallocated pages\r
11663                  5A01h                currently available is insufficient\r
11664                                       to honor the allocation request.  The\r
11665                                       program can recover from this\r
11666                                       condition by re-posting the request\r
11667                                       or by requesting fewer pages.\r
11668 \r
11669            89h   43h                  A Function 4 (Allocate Pages) request\r
11670                                       has been made specifying zero pages. \r
11671                                       Zero pages cannot be assigned to a\r
11672                                       handle with Function 4 (Allocate\r
11673                                       Pages).  If it is necessary to assign\r
11674                                       zero pages to a handle, Function 27\r
11675                                       (Allocate Standard Pages and Allocate\r
11676                                       Raw Pages subfunctions) may be used.\r
11677 \r
11678 \r
11679 \r
11680 \r
11681 \r
11682 \r
11683           Cross Reference Tables                                        193\r
11684 \f\r
11685 \r
11686 \r
11687 \r
11688 \r
11689           Table A-2.  Status and Function Code Cross Reference (continued)\r
11690           ----------------------------------------------------------------\r
11691 \r
11692           Status      Function                   Description\r
11693 \r
11694           ----------------------------------------------------------------\r
11695 \r
11696            8Ah   44h, 5000h, 5001h    The logical page to map into memory\r
11697                  5500h, 5501h         is out of the range of logical pages\r
11698                  5600h, 5601h         which are allocated to the handle. \r
11699                  5700h, 5701h         The program can recover from this\r
11700                                       condition by attempting to map a\r
11701                                       logical page which is within the\r
11702                                       bounds for the handle.\r
11703 \r
11704            8Bh   44h, 4F00h, 4F02h    One or more of the physical pages is\r
11705                  5000h, 5001h         out of the range of allowable\r
11706                  5600h, 5601h         physical pages.  Physical page\r
11707                  5500h, 5501          numbers are numbered zero-relative. \r
11708                                       The program can recover from this\r
11709                                       condition by mapping at a physical\r
11710                                       page which is in the range from zero\r
11711                                       to three.\r
11712 \r
11713            8Ch   47h                  The mapping register context save\r
11714                                       area is full.  The program can\r
11715                                       recover from this condition by\r
11716                                       attempting to save the mapping\r
11717                                       registers again.\r
11718 \r
11719            8Dh   47h                  The mapping register context stack\r
11720                                       already has a context associated with\r
11721                                       the handle.  The program has at-\r
11722                                       tempted to save the mapping register\r
11723                                       context when there was already a\r
11724                                       context for the handle on the stack. \r
11725                                       The program can recover from this\r
11726                                       condition by not attempting to save\r
11727                                       the context again (this assumes the\r
11728                                       mapping register context on the stack\r
11729                                       for the handle is correct).\r
11730 \r
11731 \r
11732 \r
11733 \r
11734 \r
11735 \r
11736 \r
11737 \r
11738 \r
11739 \r
11740 \r
11741 \r
11742           Cross Reference Tables                                        194\r
11743 \f\r
11744 \r
11745 \r
11746 \r
11747 \r
11748           Table A-2.  Status and Function Code Cross Reference (continued)\r
11749           ----------------------------------------------------------------\r
11750 \r
11751           Status      Function                   Description\r
11752 \r
11753           ----------------------------------------------------------------\r
11754 \r
11755            8Eh   48h                  The mapping register context stack\r
11756                                       does not have a context associated\r
11757                                       with the handle.  The program has\r
11758                                       attempted to restore the mapping\r
11759                                       register context when there was no\r
11760                                       context for the handle on the stack. \r
11761                                       The program can recover from this\r
11762                                       condition by not attempting to\r
11763                                       restore the context again (this\r
11764                                       assumes the current mapping register\r
11765                                       context is correct).\r
11766 \r
11767            8Fh   All functions        The subfunction parameter passed to\r
11768                  requiring            the function is not defined.\r
11769                  subfunction codes\r
11770 \r
11771            90h   5201h                The attribute type is undefined.\r
11772 \r
11773            91h   5200h, 5201h         The system configuration does not\r
11774                                       support non-volatility.\r
11775 \r
11776            92h   5700h                The source and destination expanded\r
11777                                       memory regions have the same handle\r
11778                                       and overlap.  This is valid for a\r
11779                                       move.  The move has been completed\r
11780                                       and the destination region has a full\r
11781                                       copy of the source region.  However,\r
11782                                       at least a portion of the source\r
11783                                       region has been overwritten by the\r
11784                                       move.  Note that the source and\r
11785                                       destination expanded memory regions\r
11786                                       with different handles will never\r
11787                                       physically overlap because the\r
11788                                       different handles specify totally\r
11789                                       different regions of expanded memory.\r
11790 \r
11791 \r
11792 \r
11793 \r
11794 \r
11795 \r
11796 \r
11797 \r
11798 \r
11799 \r
11800 \r
11801           Cross Reference Tables                                        195\r
11802 \f\r
11803 \r
11804 \r
11805 \r
11806 \r
11807           Table A-2.  Status and Function Code Cross Reference (continued)\r
11808           ----------------------------------------------------------------\r
11809 \r
11810           Status      Function                   Description\r
11811 \r
11812           ----------------------------------------------------------------\r
11813 \r
11814            93h   5700h, 5701h         The length of the specified source or\r
11815                                       destination expanded memory region\r
11816                                       exceeds the length of the expanded\r
11817                                       memory region allocated to the\r
11818                                       specified source or destination\r
11819                                       handle.  There are insufficient pages\r
11820                                       allocated to this handle to move/ex-\r
11821                                       change a region of the size speci-\r
11822                                       fied.  The program can recover from\r
11823                                       this condition by attempting to\r
11824                                       allocate additional pages to the\r
11825                                       destination or source handle or by\r
11826                                       reducing the specified length. \r
11827                                       However, if the application program\r
11828                                       has allocated as much expanded memory\r
11829                                       as it thought it needed, this may be\r
11830                                       a program error and is therefore not\r
11831                                       recoverable.\r
11832 \r
11833            94h   5700h, 5701h         The conventional memory region and\r
11834                                       expanded memory region overlap.  This\r
11835                                       is invalid, the conventional memory\r
11836                                       region cannot overlap the expanded\r
11837                                       memory region.\r
11838 \r
11839            95h   5700h, 5701h         The offset within the logical page\r
11840                                       exceeds the length of the logical\r
11841                                       page.  The initial source or destina-\r
11842                                       tion offsets within an expanded\r
11843                                       memory region must be between 0 and\r
11844                                       the (length of a logical page - 1) or\r
11845                                       16383 (3FFFh).\r
11846 \r
11847            96h   5700h, 5701h         Region length exceeds 1M-byte limit.\r
11848 \r
11849 \r
11850 \r
11851 \r
11852 \r
11853 \r
11854 \r
11855 \r
11856 \r
11857 \r
11858 \r
11859 \r
11860           Cross Reference Tables                                        196\r
11861 \f\r
11862 \r
11863 \r
11864 \r
11865 \r
11866           Table A-2.  Status and Function Code Cross Reference (continued)\r
11867           ----------------------------------------------------------------\r
11868 \r
11869           Status      Function                   Description\r
11870 \r
11871           ----------------------------------------------------------------\r
11872 \r
11873            97h   5701h                The source and destination expanded\r
11874                                       memory regions have the SAME handle\r
11875                                       AND overlap.  This is invalid; the\r
11876                                       source and destination expanded\r
11877                                       memory regions cannot have the same\r
11878                                       handle and overlap when they are\r
11879                                       being exchanged.  Note that the\r
11880                                       source and destination expanded\r
11881                                       memory regions with different handles\r
11882                                       will never physically overlap because\r
11883                                       the different handles specify totally\r
11884                                       different regions of expanded memory.\r
11885 \r
11886            98h   5700h, 5701h         The memory source and destination\r
11887                                       types are undefined/not supported.\r
11888 \r
11889            9Ah   5B01h, 5B06h         Alternate map register sets are\r
11890                  5B07h                supported, but the alternate map\r
11891                                       register set specified is not\r
11892                                       supported.\r
11893 \r
11894            9Bh   5B03h, 5B05h         Alternate map/DMA register sets are\r
11895                                       supported.  However, all alternate\r
11896                                       map/DMA register sets are currently\r
11897                                       allocated.\r
11898 \r
11899            9Ch   5B01h, 5B04h         Alternate map/DMA register sets are\r
11900                  5B06h, 5B07h         not supported, and the alternate\r
11901                  5B08h                map/DMA register set specified is not\r
11902                                       zero.\r
11903 \r
11904            9Dh   5B01h, 5B04h         Alternate map/DMA register sets are\r
11905                  5B06h, 5B07h         supported, but the alternate map\r
11906                  5B08h                register set specified is not\r
11907                                       defined, not allocated, or is the\r
11908                                       currently allocated map register set.\r
11909 \r
11910            9Eh   5B06h, 5B07h         Dedicated DMA channels are not\r
11911                                       supported.\r
11912 \r
11913            9Fh   5B06h, 5B07h         Dedicated DMA channels are supported. \r
11914                                       But the DMA channel specified is not\r
11915                                       supported.\r
11916 \r
11917 \r
11918 \r
11919           Cross Reference Tables                                        197\r
11920 \f\r
11921 \r
11922 \r
11923 \r
11924 \r
11925           Table A-2.  Status and Function Code Cross Reference (continued)\r
11926           ----------------------------------------------------------------\r
11927 \r
11928           Status      Function                   Description\r
11929 \r
11930           ----------------------------------------------------------------\r
11931 \r
11932            A0h   5401h                No corresponding handle value could\r
11933                                       be found for the handle name speci-\r
11934                                       fied.\r
11935 \r
11936            A1h   5301h, 5401h         A handle with this name already\r
11937                                       exists.  The specified handle was not\r
11938                                       assigned a name.\r
11939 \r
11940            A2h   5700h, 5701h         An attempt was made to "wrap around"\r
11941                                       the 1M-byte address space during the\r
11942                                       move/exchange.  The source starting\r
11943                                       address together with the length of\r
11944                                       the region to be moved/exchanged\r
11945                                       exceeds 1M bytes.  No data was\r
11946                                       moved/exchanged.\r
11947 \r
11948            A3h   4E01h, 4E02h         The contents of the data structure\r
11949                  4F00h, 4F01h         passed to the function have either\r
11950                  5B01h                been corrupted or are meaningless.\r
11951 \r
11952            A4h   5900h, 5B00h         The operating system has denied\r
11953                  5B01h, 5B02h         access to this function.  The \r
11954                  5B03h, 5B04h         function cannot be used at this time.\r
11955                  5B05h, 5B06h\r
11956                  5B07h, 5B08h\r
11957                  5D00h, 5D01h\r
11958                  5D02h\r
11959 \r
11960           ----------------------------------------------------------------\r
11961 \r
11962 \r
11963 \r
11964 \r
11965 \r
11966 \r
11967 \r
11968 \r
11969 \r
11970 \r
11971 \r
11972 \r
11973 \r
11974 \r
11975 \r
11976 \r
11977 \r
11978           Cross Reference Tables                                        198\r
11979 \f\r
11980 \r
11981 \r
11982 \r
11983 \r
11984           Appendix B\r
11985           TESTING FOR THE PRESENCE OF THE EXPANDED MEMORY MANAGER\r
11986 \r
11987 \r
11988 \r
11989                Before an application program can use the Expanded Memory\r
11990                Manager, it must determine whether DOS has loaded the\r
11991                manager.  This appendix describes two methods your program\r
11992                can use to test for the presence of the memory manager and\r
11993                how to choose the correct one for your situation.\r
11994 \r
11995                The first method uses the DOS "open handle" technique; the\r
11996                second method uses the DOS "get interrupt vector" technique.\r
11997 \r
11998 \r
11999           Which method should your program use?\r
12000 \r
12001                The majority of application programs can use either the\r
12002                "open handle" or the "get interrupt vector" method. \r
12003                However, if your program is a device driver or if it\r
12004                interrupts DOS during file system operations, you must use\r
12005                only the "get interrupt vector" method.\r
12006 \r
12007                Device drivers execute from within DOS and can't access the\r
12008                DOS file system; programs that interrupt DOS during file\r
12009                system operations have a similar restriction.  During their\r
12010                interrupt processing procedures, they can't access the DOS\r
12011                file system because another program may be using the system. \r
12012                Since the "get interrupt vector" method doesn't require the\r
12013                DOS file system, you must use it for these types of pro-\r
12014                grams.\r
12015 \r
12016 \r
12017           The "open handle" technique\r
12018 \r
12019                Most application programs can use the DOS "open handle"\r
12020                technique to test for the presence of the memory manager. \r
12021                This section describes how to use the technique and gives an\r
12022                example.\r
12023 \r
12024           Caution.........................................................\r
12025                Don't use this technique if your program is a device driver\r
12026                or if it interrupts DOS during file system operations.  Use\r
12027                the "get interrupt vector" technique described later in this\r
12028                appendix.\r
12029 \r
12030 \r
12031           Using the "open handle" technique\r
12032 \r
12033                This section describes how to use the DOS "open handle"\r
12034                technique to test for the presence of the memory manager. \r
12035                Follow these steps in order:\r
12036 \r
12037           Testing For The Presence Of The EMM                           199\r
12038 \f\r
12039 \r
12040 \r
12041 \r
12042 \r
12043                1.  Issue an "open handle" command (DOS function 3Dh) in\r
12044                    "read only" access mode (register AL = 0).  This\r
12045                    function requires your program to point to an ASCII\r
12046                    string which contains the path name of the file or\r
12047                    device in which you're interested (register set DS:DX\r
12048                    contains the pointer).  In this case the file is\r
12049                    actually the name of the memory manager.\r
12050 \r
12051                    You should format the ASCII string as follows:\r
12052 \r
12053                    ASCII_device_name  DB  'EMMXXXX0', 0\r
12054 \r
12055                    The ASCII codes for the capital letters EMMXXXX0 are\r
12056                    terminated by a byte containing a value of zero.\r
12057 \r
12058                2.  If DOS returns no error status code, skip Steps 3 and 4\r
12059                    and go to Step 5.  If DOS returns a "Too many open\r
12060                    files" error status code, go to Step 3.  If DOS returns\r
12061                    a "File/Path not found" error status code, skip Step 3\r
12062                    and go to Step 4.\r
12063 \r
12064                3.  If DOS returns a "Too many open files" (not enough\r
12065                    handles) status code, your program should invoke the\r
12066                    "open file" command before it opens any other files. \r
12067                    This will guarantee that at least one file handle will\r
12068                    be available to perform the function without causing\r
12069                    this error.\r
12070 \r
12071                    After the program performs the "open file" command, it\r
12072                    should perform the test described in Step 6 and close\r
12073                    the "file handle" (DOS function 3Eh).  Don't keep the\r
12074                    manager "open" after this status test is performed since\r
12075                    "manager" functions are not available through DOS.  Go\r
12076                    to Step 6.\r
12077 \r
12078                4.  If DOS returns a "File/Path not found," the memory\r
12079                    manager is not installed.  If your application requires\r
12080                    the memory manager, the user will have to reboot the\r
12081                    system with a disk containing the memory manager and the\r
12082                    appropriate CONFIG.SYS file before proceeding.\r
12083 \r
12084                5.  If DOS doesn't return an error status code you can\r
12085                    assume that either a device with the name EMMXXXX0 is\r
12086                    resident in the system, or a file with this name is on\r
12087                    disk in the current disk drive.  Go to Step 6.\r
12088 \r
12089                6.  Issue an "I/O Control for Devices" command (DOS function\r
12090                    44h) with a "get device information" command (register\r
12091                    AL = 0).  DOS function 44h determines whether EMMXXXX0\r
12092                    is a device or a file.\r
12093 \r
12094 \r
12095 \r
12096           Testing For The Presence Of The EMM                           200\r
12097 \f\r
12098 \r
12099 \r
12100 \r
12101 \r
12102                    You must use the file handle (register BX) which you\r
12103                    obtained in Step 1 to access the "EMM" device.\r
12104 \r
12105                    This function returns the "device information" in a word\r
12106                    (register DX).  Go to Step 7.\r
12107 \r
12108                7.  If DOS returns any error status code, you should assume\r
12109                    that the memory manager device driver is not installed. \r
12110                    If your application requires the memory manager, the\r
12111                    user will have to reboot the system with a disk contain-\r
12112                    ing the memory manager and the appropriate CONFIG.SYS\r
12113                    file before proceeding.\r
12114 \r
12115                8.  If DOS didn't return an error status, test the contents\r
12116                    of bit 7 (counting from 0) of the "device information"\r
12117                    word (register DX) the function returned.  Go to Step 9.\r
12118 \r
12119                9.  If bit 7 of the "device information" word contains a\r
12120                    zero, then EMMXXXX0 is a file, and the memory manager\r
12121                    device driver is not present.  If your application\r
12122                    requires the memory manager, the user will have to\r
12123                    reboot the system with a disk containing the memory\r
12124                    manager and the appropriate CONFIG.SYS file before\r
12125                    proceeding.\r
12126 \r
12127                    If bit 7 contains a one, then EMMXXXX0 is a device.  Go\r
12128                    to Step 10.\r
12129 \r
12130                10. Issue an "I/O Control for Devices" command (DOS function\r
12131                    44h) with a "get output status" command (register AL =\r
12132                    7).\r
12133 \r
12134                    You must use the file handle you obtained in Step 1 to\r
12135                    access the "EMM" device (register BX).  Go to Step 11.\r
12136 \r
12137                11. If the expanded memory device driver is "ready," the\r
12138                    memory manager passes a status value of "FFh" in\r
12139                    register AL.  The status value is "00h" if the device\r
12140                    driver is "not ready."\r
12141 \r
12142                    If the memory manager device driver is "not ready" and\r
12143                    your application requires its presence, the user will\r
12144                    have to reboot the system with a disk containing the\r
12145                    memory manager and the appropriate CONFIG.SYS file\r
12146                    before proceeding.\r
12147 \r
12148                    If the memory manager device driver is "ready," go to\r
12149                    Step 12.\r
12150 \r
12151 \r
12152 \r
12153 \r
12154 \r
12155           Testing For The Presence Of The EMM                           201\r
12156 \f\r
12157 \r
12158 \r
12159 \r
12160 \r
12161                12. Issue a "Close File Handle" command (DOS function 3Eh)\r
12162                    to close the expanded memory device driver.  You must\r
12163                    use the file handle you obtained in Step 1 to close the\r
12164                    "EMM" device (register BX).\r
12165 \r
12166 \r
12167 \r
12168 \r
12169 \r
12170 \r
12171 \r
12172 \r
12173 \r
12174 \r
12175 \r
12176 \r
12177 \r
12178 \r
12179 \r
12180 \r
12181 \r
12182 \r
12183 \r
12184 \r
12185 \r
12186 \r
12187 \r
12188 \r
12189 \r
12190 \r
12191 \r
12192 \r
12193 \r
12194 \r
12195 \r
12196 \r
12197 \r
12198 \r
12199 \r
12200 \r
12201 \r
12202 \r
12203 \r
12204 \r
12205 \r
12206 \r
12207 \r
12208 \r
12209 \r
12210 \r
12211 \r
12212 \r
12213 \r
12214           Testing For The Presence Of The EMM                           202\r
12215 \f\r
12216 \r
12217 \r
12218 \r
12219 \r
12220           An example of the "open handle" technique\r
12221 \r
12222                The following procedure is an example of the "open handle"\r
12223                technique outlined in the previous section.\r
12224 \r
12225           ;--------------------------------------------------------------;\r
12226           ;    The following procedure tests for the presence of the     ;\r
12227           ;    EMM in the system.  It returns the CARRY FLAG SET if      ;\r
12228           ;    the EMM is present.  If the EMM is not present, this      ;\r
12229           ;    procedure returns the CARRY FLAG CLEAR.                   ;\r
12230           ;--------------------------------------------------------------;\r
12231 \r
12232           first_test_for_EMM  PROC  NEAR\r
12233           PUSH  DS\r
12234           PUSH  CS\r
12235           POP   DS\r
12236           MOV   AX,3D00h                       ; issue "device open" in\r
12237           LEA   DX,ASCII_device_name           ; "read only" mode\r
12238           INT   21h\r
12239           JC    first_test_for_EMM_error_exit  ; test for error\r
12240                                                ; during "device open"\r
12241           MOV   BX,AX                          ; get the "file\r
12242                                                ; handle" returned by DOS\r
12243           MOV   AX,4400h                       ; issue "IOCTL\r
12244           INT   21h                            ; get device info"\r
12245           JC    first_test_for_EMM_error_exit  ; test for error\r
12246                                                ; during "get device info"\r
12247           TEST  DX,0080h                       ; test to determine\r
12248           JZ    first_test_for_EMM_error_exit  ; ASCII_device_name\r
12249                                                ; is a device or a file\r
12250           MOV   AX,4407h                       ; issue "IOCTL"\r
12251           INT   21h\r
12252           JC    first_test_for_EMM_error_exit  ; test for error\r
12253                                                ; during "IOCTL"\r
12254           PUSH  AX                             ; save "IOCTL" status\r
12255           MOV   AH,3Eh                         ; issue "close\r
12256           INT   21h                            ; file handle"\r
12257           POP   AX                             ; restore "IOCTL" status\r
12258           CMP   AL,0FFh                        ; test for "device\r
12259           JNE   first_test_for_EMM_error_exit  ; ready" status\r
12260                                                ; returned by the driver\r
12261           first_test_for_EMM_exit:\r
12262           POP   DS                             ; EMM is present\r
12263           STC                                  ; in the system\r
12264           RET\r
12265 \r
12266           first_test_for_EMM_error_exit:\r
12267           POP   DS                             ; EMM is NOT present\r
12268           CLC                                  ; in the system\r
12269           RET\r
12270           ASCII_device_name   DB  'EMMXXXX0', 0\r
12271           first_test_for_EMM  ENDP\r
12272 \r
12273           Testing For The Presence Of The EMM                           203\r
12274 \f\r
12275 \r
12276 \r
12277 \r
12278 \r
12279           The "get interrupt vector" technique\r
12280 \r
12281                Any type of program can use the DOS "get interrupt vector"\r
12282                technique to test for the presence of the memory manager. \r
12283                This section describes how to use the technique and gives an\r
12284                example.\r
12285 \r
12286           Caution.........................................................\r
12287                Be sure to use this technique (and not the "open handle"\r
12288                technique) if your program is a device driver or if it\r
12289                interrupts DOS during file system operations.\r
12290 \r
12291 \r
12292           Using the "get interrupt vector" technique\r
12293 \r
12294                This section describes how to use the DOS "get interrupt\r
12295                vector" technique to test for the presence of the memory\r
12296                manager.  Follow these steps in order:\r
12297 \r
12298                1.  Issue a "get vector" command (DOS function 35h) to\r
12299                    obtain the contents of interrupt vector array entry\r
12300                    number 67h (addresses 0000:019Ch thru 0000:019Fh).\r
12301 \r
12302                    The memory manager uses this interrupt vector to perform\r
12303                    all manager functions.  The offset portion of this\r
12304                    interrupt service routine address is stored in the word\r
12305                    located at address 0000:019Ch; the segment portion is\r
12306                    stored in the word located at address 0000:019Eh.\r
12307 \r
12308                2.  Compare the "device name field" with the contents of the\r
12309                    ASCII string which starts at the address specified by\r
12310                    the segment portion of the contents of interrupt vector\r
12311                    address 67h and a fixed offset of 000Ah.  If DOS loaded\r
12312                    the memory manager at boot time this name field will\r
12313                    have the name of the device in it.\r
12314 \r
12315                    Since the memory manager is implemented as a character\r
12316                    device driver, its program origin is 0000h.  Device\r
12317                    drivers are required to have a "device header" located\r
12318                    at the program origin.  Within the "device header" is an\r
12319                    8 byte "device name field."  For a character mode device\r
12320                    driver this name field is always located at offset 000Ah\r
12321                    within the device header.  The device name field\r
12322                    contains the name of the device which DOS uses when it\r
12323                    references the device.\r
12324 \r
12325                    If the result of the "string compare" in this technique\r
12326                    is positive, the memory manager is present.\r
12327 \r
12328 \r
12329 \r
12330 \r
12331 \r
12332           Testing For The Presence Of The EMM                           204\r
12333 \f\r
12334 \r
12335 \r
12336 \r
12337 \r
12338           An example of the "get interrupt vector" technique\r
12339 \r
12340                The following procedure is an example of the "get interrupt\r
12341                vector" technique outlined in the previous section.\r
12342 \r
12343 \r
12344           ;--------------------------------------------------------------;\r
12345           ;    The following procedure tests for the presence of the     ;\r
12346           ;    EMM in the system.  It returns the CARRY FLAG SET if      ;\r
12347           ;    the EMM is present.  If the EMM is not present, this      ;\r
12348           ;    procedure returns the CARRY FLAG CLEAR.                   ;\r
12349           ;--------------------------------------------------------------;\r
12350 \r
12351 \r
12352           second_test_for_EMM  PROC  NEAR\r
12353           PUSH  DS\r
12354           PUSH  CS\r
12355           POP   DS\r
12356           MOV   AX,3567h                       ; issue "get interrupt\r
12357                                                ; vector"\r
12358           INT   21h\r
12359           MOV   DI,000Ah                       ; use the segment in ES\r
12360                                                ; returned by DOS, place\r
12361                                                ; the "device name field"\r
12362                                                ; OFFSET in DI\r
12363           LEA   SI,ASCII_device_name           ; place the OFFSET of the\r
12364                                                ; device name string in SI,\r
12365                                                ; the SEGMENT is already\r
12366                                                ; in DS\r
12367           MOV   CX,8                           ; compare the name strings\r
12368           CLD\r
12369           REPE  CMPSB\r
12370           JNE   second_test_for_EMM_error_exit\r
12371 \r
12372           second_test_for_EMM_exit:\r
12373           POP   DS                             ; EMM is present in\r
12374           STC                                  ; the system\r
12375           RET\r
12376 \r
12377           second_test_for_EMM_error_exit:\r
12378           POP   DS                             ; EMM is NOT present\r
12379           CLC                                  ; in the system\r
12380           RET\r
12381 \r
12382           ASCII_device_name   DB  'EMMXXXX0'\r
12383           second_test_for_EMM ENDP\r
12384 \r
12385 \r
12386 \r
12387 \r
12388 \r
12389 \r
12390 \r
12391           Testing For The Presence Of The EMM                           205\r
12392 \f\r
12393 \r
12394 \r
12395 \r
12396 \r
12397           Appendix C\r
12398           EXPANDED MEMORY MANAGER IMPLEMENTATION GUIDELINES\r
12399 \r
12400 \r
12401 \r
12402                In addition to the functional specification, the expanded\r
12403                memory manager should provide certain resources.  The\r
12404                following guidelines are provided so required resources are\r
12405                present in expanded memory managers which comply with this\r
12406                version of the LIM specification.\r
12407 \r
12408                o   The amount of expanded memory supported:\r
12409                    Up to a maximum of 32M bytes of expanded memory should\r
12410                    be supported.\r
12411 \r
12412                o   The number of handles supported:\r
12413                    The maximum number of expanded memory handles provided\r
12414                    should be 255, the minimum should be 64.\r
12415 \r
12416                o   Handle Numbering:\r
12417                    Although a handle is a word quantity, there is a maximum\r
12418                    of 255 handles, including the operating system handle. \r
12419                    This specification defines the handle word as follows: \r
12420                    the low byte of the word is the actual handle value, the\r
12421                    high byte of the handle is set to 00h by the memory\r
12422                    manager.  Previous versions of this specification did\r
12423                    not specify the value of handles.\r
12424 \r
12425                o   New handle type:  Handles versus Raw Handles:\r
12426                    The difference between a raw handle and a regular handle\r
12427                    is slight.  If you use Function 27 to "Allocate raw\r
12428                    pages to a handle," what is returned in DX is termed a\r
12429                    raw handle.  The raw handle does not necessarily refer\r
12430                    to 16K-byte pages.  Instead it refers to the "raw" page\r
12431                    size, which depends on the expanded memory hardware.\r
12432 \r
12433                    An application program can use Function 26 to find the\r
12434                    raw page size, and by using the raw handle Function 27\r
12435                    returns, it can access them with the finer resolution\r
12436                    that a particular expanded memory board may allow.\r
12437 \r
12438                    On the other hand, applications which use Function 4 to\r
12439                    "allocate pages to handle" receive a handle which always\r
12440                    refers to 16K-byte pages.  On expanded memory boards\r
12441                    with smaller raw pages, the EMM driver will allocate and\r
12442                    maintain the number of raw pages it takes to create a\r
12443                    single composite 16K-byte page.  The difference between\r
12444                    the expanded memory boards' raw page size and the 16K-\r
12445                    byte LIM page size is transparent to the application\r
12446                    when it is using a handle obtained with Function 4.\r
12447 \r
12448 \r
12449 \r
12450           EMM Implementation Guidelines                                 206\r
12451 \f\r
12452 \r
12453 \r
12454 \r
12455 \r
12456                    The memory manager must differentiate between pages\r
12457                    allocated to handles and pages allocated to raw handles. \r
12458                    The meaning of a call to the driver changes depending on\r
12459                    whether a handle or a raw handle is passed to the memory\r
12460                    manager.  If, for example, a handle is passed to\r
12461                    Function 18 (Reallocate), the memory manager will\r
12462                    increase or decrease the number of 16K-byte pages\r
12463                    allocated to the handle.  If Function 18 is passed a raw\r
12464                    handle, the memory manager will increase or decrease the\r
12465                    number of raw (non-16K-byte) pages allocated to the raw\r
12466                    handle.  For LIM standard boards, there is no difference\r
12467                    between pages and raw pages.\r
12468 \r
12469                o   The system Raw Handle (Raw Handle = 0000h):\r
12470                    For expanded memory boards that can remap the memory in\r
12471                    the lower 640K-byte address space, managing the pages of\r
12472                    memory which are used to fill in the lower 640K can be a\r
12473                    problem.  To solve this problem, the memory manager will\r
12474                    create a raw handle with a value of 0000h when DOS loads\r
12475                    the manager.  This raw handle is called the system\r
12476                    handle.\r
12477 \r
12478                    At power up, the memory manager will allocate all of the\r
12479                    pages that are mapped into the lower 640K bytes to the\r
12480                    system handle.  These pages should be mapped in their\r
12481                    logical order.  For example, if the system board\r
12482                    supplies 256K bytes of RAM, and the 384K bytes above it\r
12483                    is mappable, the system handle should have its logical\r
12484                    page zero mapped into the first physical page at 256K,\r
12485                    its logical page one mapped into the next physical page,\r
12486                    and so on.\r
12487 \r
12488                    The system handle should deal with raw pages.  To\r
12489                    release some of these pages so application programs can\r
12490                    use them, an operating system could decrease the number\r
12491                    of pages allocated to the system handle with the\r
12492                    "Reallocate" function.  Invoking the "Deallocate"\r
12493                    function would decrease the system handle to zero size,\r
12494                    but it must not deallocate the raw handle itself.  The\r
12495                    "Deallocate" function treats the system handle dif-\r
12496                    ferently than it treats other raw handles.  If the\r
12497                    operating system can ever be "exited" (for example, the\r
12498                    way Windows can be exited), it must increase the size of\r
12499                    the system handle back to what is needed to fill 640K\r
12500                    and map these logical pages back into physical memory\r
12501                    before returning to DOS.\r
12502 \r
12503 \r
12504 \r
12505 \r
12506 \r
12507 \r
12508 \r
12509           EMM Implementation Guidelines                                 207\r
12510 \f\r
12511 \r
12512 \r
12513 \r
12514 \r
12515                    There are two functional special cases for this handle:\r
12516 \r
12517                    -   The first special case deals with Function 4\r
12518                        (Allocate Pages).  This function must never return\r
12519                        zero as a handle value.  Applications must always\r
12520                        invoke Function 4 to allocate pages and obtain a\r
12521                        handle which identifies its pages.  Since Function 4\r
12522                        will never return a handle value of zero, an\r
12523                        application will never gain access to this special\r
12524                        handle.\r
12525 \r
12526                    -   The second special case deals with Function 6\r
12527                        (Deallocate Pages).  If the operating system uses\r
12528                        Function 6 to deallocate the pages which are\r
12529                        allocated to the system handle, the pages will be\r
12530                        returned to the manager for use, but the handle will\r
12531                        not be available for reassignment.  The manager\r
12532                        should treat a "deallocate pages" function request\r
12533                        for this handle the same as a "reallocate pages"\r
12534                        function request, where the number of pages to\r
12535                        reallocate to this handle is zero.\r
12536 \r
12537                o   Terminate and Stay Resident (TSR) Program Cooperation:\r
12538                    In order for TSR's to cooperate with each other and with\r
12539                    other applications, TSR's must follow this rule:  a\r
12540                    program may only remap the DOS partition it lives in. \r
12541                    This rule applies at all times, even when no expanded\r
12542                    memory is present.\r
12543 \r
12544                o   Accelerator Cards:\r
12545                    To support generic accelerator cards, the support of\r
12546                    Function 34, as defined by AST, is encouraged.\r
12547 \r
12548 \r
12549 \r
12550 \r
12551 \r
12552 \r
12553 \r
12554 \r
12555 \r
12556 \r
12557 \r
12558 \r
12559 \r
12560 \r
12561 \r
12562 \r
12563 \r
12564 \r
12565 \r
12566 \r
12567 \r
12568           EMM Implementation Guidelines                                 208\r
12569 \f\r
12570 \r
12571 \r
12572 \r
12573 \r
12574           Appendix D\r
12575           OPERATING SYSTEM/ENVIRONMENT USE OF FUNCTION 28\r
12576 \r
12577 \r
12578 \r
12579                All expanded memory boards have a set of registers that\r
12580                "remember" the logical to physical page mappings.  Some\r
12581                boards have extra (or alternate) sets of these mapping\r
12582                registers.  Because no expanded memory board can supply an\r
12583                infinite number of alternate map register sets, this\r
12584                specification provides a way to simulate them using Function\r
12585                28 (Alternate Map Register Set).\r
12586 \r
12587 \r
12588           Examples\r
12589 \r
12590                For the examples in this section, assume the hardware\r
12591                supports alternate map register sets.  First Windows is\r
12592                brought up, then "Reversi" is started.  Then control is\r
12593                switched back to the MS-DOS Executive.  For this procedure,\r
12594                here are the calls to the expanded memory manager:\r
12595 \r
12596                                       Example 1\r
12597 \r
12598           Allocate alt reg set           ; Start up the MS-DOS\r
12599           (for MS-DOS Executive)         ; Executive\r
12600 \r
12601           Set alt reg set\r
12602           (for MS-DOS Executive)\r
12603 \r
12604           Allocate alt reg set           ; Start up Reversi\r
12605           (for Reversi)\r
12606 \r
12607           Set alt reg set\r
12608           (for Reversi)\r
12609 \r
12610           Map pages\r
12611           (for Reversi)\r
12612 \r
12613           Set alt ret set                ; Switch back to MS-DOS\r
12614           (for MS-DOS Executive)         ; Executive\r
12615 \r
12616 \r
12617 \r
12618 \r
12619 \r
12620 \r
12621 \r
12622 \r
12623 \r
12624 \r
12625 \r
12626 \r
12627           Operating System Use Of Function 28                           209\r
12628 \f\r
12629 \r
12630 \r
12631 \r
12632 \r
12633                Notice this procedure needed no "get" calls because the\r
12634                register set contained all the information needed to save a\r
12635                context.  However, using "Get" calls would have no ill\r
12636                effects.\r
12637 \r
12638                                       Example 2\r
12639 \r
12640           Allocate alt reg set           ; Start up MS-DOS\r
12641           (for MS-DOS Executive)         ; Executive\r
12642 \r
12643           Set alt reg set\r
12644           (for MS-DOS Executive)\r
12645 \r
12646           Get alt reg set\r
12647           (for MS-DOS Executive)\r
12648 \r
12649           Allocate alt reg set           ; Start up Reversi\r
12650           (for Reversi)\r
12651 \r
12652           Set alt reg set\r
12653           (for Reversi)\r
12654 \r
12655           Map pages\r
12656           (for Reversi)\r
12657 \r
12658           Get alt reg set\r
12659           (for Reversi)\r
12660 \r
12661           Set alt reg set                ; Switch back to MS-DOS\r
12662           (for MS-DOS Executive)         ; Executive\r
12663 \r
12664                The important point to follow is that a Set must always\r
12665                precede a Get.  The model of Set then Get is the inverse of\r
12666                what interrupt handlers use, which is Get then Set (Get the\r
12667                old map context and Set the new one).  Another crucial point\r
12668                is that an alternate map register set must have the current\r
12669                mapping when allocated; otherwise, the Set will create\r
12670                chaos.\r
12671 \r
12672                What happens if this is simulated in software?  The same Set\r
12673                and Get model applies.  The main difference is where the\r
12674                context is saved.\r
12675 \r
12676 \r
12677 \r
12678 \r
12679 \r
12680 \r
12681 \r
12682 \r
12683 \r
12684 \r
12685 \r
12686           Operating System Use Of Function 28                           210\r
12687 \f\r
12688 \r
12689 \r
12690 \r
12691 \r
12692                Since the allocate call is dynamic and there is no limit on\r
12693                the number of sets allocated, the OS/E must supply the space\r
12694                required.  Device drivers cannot allocate space dynamically,\r
12695                since the request would fail.  If the Allocate register set\r
12696                call returns a status indicating the alternate map register\r
12697                sets aren't supported, the OS/E must allocate space for the\r
12698                context.  It must also initialize the context using Function\r
12699                15.  At that point it can do the Set, passing a pointer to\r
12700                the map context space.  On the Get call, the EMM driver is\r
12701                to return a pointer to the same context space.\r
12702 \r
12703                                       Example 3\r
12704 \r
12705           Allocate alt reg set           ; Start up MS-DOS\r
12706           (for MS-DOS Executive)         ; Executive\r
12707 \r
12708           Get Page Map\r
12709           (for MS-DOS Executive)\r
12710 \r
12711           Set alt reg set\r
12712           (for MS-DOS Executive)\r
12713 \r
12714           Allocate alt reg set           ; Start up Reversi\r
12715           (for Reversi)\r
12716 \r
12717           Set alt reg set\r
12718           (for Reversi)\r
12719 \r
12720           Map pages\r
12721           (for Reversi)\r
12722 \r
12723           Get Page Map\r
12724           (for Reversi)\r
12725 \r
12726           Set alt ret set                ; Switch back to MS-DOS\r
12727           (for MS-DOS Executive)         ; Executive\r
12728 \r
12729 \r
12730 \r
12731 \r
12732 \r
12733 \r
12734 \r
12735 \r
12736 \r
12737 \r
12738 \r
12739 \r
12740 \r
12741 \r
12742 \r
12743 \r
12744 \r
12745           Operating System Use Of Function 28                           211\r
12746 \f\r
12747 \r
12748 \r
12749 \r
12750 \r
12751           GLOSSARY\r
12752 \r
12753 \r
12754 \r
12755                The following terms are used frequently in this specifica-\r
12756                tion:\r
12757 \r
12758 \r
12759           Allocate                 To reserve a specified amount of\r
12760                                    expanded memory pages.\r
12761 \r
12762           Application Program      An application program is the program\r
12763                                    you write and your customer uses.  Some\r
12764                                    categories of application software are\r
12765                                    word processors, database managers,\r
12766                                    spreadsheet managers, and project\r
12767                                    managers.\r
12768 \r
12769           Conventional memory      The memory between 0 and 640K bytes,\r
12770                                    address range 00000h thru 9FFFFh.\r
12771 \r
12772           Deallocate               To return previously allocated expanded\r
12773                                    memory to the memory manager.\r
12774 \r
12775           EMM                      See Expanded Memory Manager.\r
12776 \r
12777           Expanded memory          Expanded memory is memory outside DOS's\r
12778                                    640K-byte limit (usually in the range of\r
12779                                    C0000h thru EFFFFh).\r
12780 \r
12781           Expanded Memory          A device driver that controls the\r
12782             Manager (EMM)          interface between DOS application\r
12783                                    programs and expanded memory.\r
12784 \r
12785           Extended memory          The 15M-byte address range between\r
12786                                    100000h thru FFFFFFh available on an\r
12787                                    80286 processor when it is operating in\r
12788                                    protected virtual address mode.\r
12789 \r
12790           Handle                   A value that the EMM assigns and uses to\r
12791                                    identify a block of memory requested by\r
12792                                    an application program.  All allocated\r
12793                                    logical pages are associated with a\r
12794                                    particular handle.\r
12795 \r
12796           Logical Page             The EMM allocates expanded memory in\r
12797                                    units (typically 16K bytes) called\r
12798                                    logical pages.\r
12799 \r
12800           Mappable Segment         A 16K-byte region of memory which can\r
12801                                    have a logical page mapped at it.\r
12802 \r
12803 \r
12804           Glossary                                                      212\r
12805 \f\r
12806 \r
12807 \r
12808 \r
12809 \r
12810           Map Registers            The set of registers containing the\r
12811                                    current mapping context of the EMM\r
12812                                    hardware.\r
12813 \r
12814           Mapping                  The process of making a logical page of\r
12815                                    memory appear at a physical page.\r
12816 \r
12817           Mapping Context          The contents of the mapping registers at\r
12818                                    a specific instant.  This context\r
12819                                    represents a map state.\r
12820 \r
12821           Page Frame               A collection of 16K-byte contiguous\r
12822                                    physical pages from which an application\r
12823                                    program accesses expanded memory.\r
12824 \r
12825           Page Frame               A page frame base address is the\r
12826             Base Address           location (in segment format) of the\r
12827                                    first byte of the page frame.\r
12828 \r
12829           Physical Page            A physical page is the range of memory\r
12830                                    addresses occupied by a single 16K-byte\r
12831                                    page.\r
12832 \r
12833           Raw Page                 The smallest unit of mappable memory\r
12834                                    that an expanded memory board can\r
12835                                    supply.\r
12836 \r
12837           Resident Application     A resident application program is loaded\r
12838             Program                by DOS, executes, and remains resident\r
12839                                    in the system after it returns control\r
12840                                    to DOS.  This type of program occupies\r
12841                                    memory and is usually invoked by the\r
12842                                    operating system, an application\r
12843                                    program, or the hardware.  Some example\r
12844                                    of resident application programs are RAM\r
12845                                    disks, print spoolers, and "pop-up"\r
12846                                    desktop programs.\r
12847 \r
12848           Status code              A code that an EMM function returns\r
12849                                    which indicates something about the\r
12850                                    result of running the function.  Some\r
12851                                    status codes indicate whether the\r
12852                                    function worked correctly and others may\r
12853                                    tell you something about the expanded\r
12854                                    memory hardware or software.\r
12855 \r
12856 \r
12857 \r
12858 \r
12859 \r
12860 \r
12861 \r
12862 \r
12863           Glossary                                                      213\r
12864 \f\r
12865 \r
12866 \r
12867 \r
12868 \r
12869           Transient Application    A transient application program is\r
12870             Program                loaded by DOS, executes, and doesn't\r
12871                                    remain in the system after it returns\r
12872                                    control to DOS.  After a transient\r
12873                                    application program returns control to\r
12874                                    DOS, the memory it used is available for\r
12875                                    other programs.\r
12876 \r
12877           Unmap                    To make a logical page inaccessible for\r
12878                                    reading or writing.\r
12879 \r
12880 \r
12881 \r
12882 \r
12883 \r
12884 \r
12885 \r
12886 \r
12887 \r
12888 \r
12889 \r
12890 \r
12891 \r
12892 \r
12893 \r
12894 \r
12895 \r
12896 \r
12897 \r
12898 \r
12899 \r
12900 \r
12901 \r
12902 \r
12903 \r
12904 \r
12905 \r
12906 \r
12907 \r
12908 \r
12909 \r
12910 \r
12911 \r
12912 \r
12913 \r
12914 \r
12915 \r
12916 \r
12917 \r
12918 \r
12919 \r
12920 \r
12921 \r
12922           Glossary                                                      214\r
12923 \f\r
12924 \r
12925 \r
12926 \r
12927 \r
12928           INDEX\r
12929 \r
12930 \r
12931 \r
12932                Allocate Alternate Map Register Set  36, 163\r
12933                Allocate DMA Register Set  36, 168, 190\r
12934                Allocate Pages  5, 14, 23, 30, 34, 42, 43, 47, 49, 144,\r
12935                    147, 148, 193, 206, 208\r
12936                Allocate Raw Pages  36, 46, 80, 89, 147-149, 190, 193,\r
12937                    206\r
12938                Allocate Standard Pages  36, 42, 46, 80, 89, 144, 145,\r
12939                    147, 190, 193\r
12940                Alter Page Map & Call  7, 10, 35, 113, 118, 189\r
12941                Alter Page Map & Jump  7, 10, 35, 109, 189\r
12942                Alternate Map  10, 36, 151, 153-155, 157-159, 161, 163,\r
12943                    164, 165-168, 170, 173, 175, 179, 182, 190, 197,\r
12944                    209, 210, 211\r
12945                Alternate Map Register Set  10, 36, 151, 153-155, 157,\r
12946                    158, 159, 161, 163-168, 170, 173, 175, 190, 197,\r
12947                    209, 210\r
12948                Alternate Mapping and Unmapping Methods  81\r
12949                Alternate Register  139, 166, 173, 177\r
12950                Data Aliasing  12\r
12951                Deallocate Alternate Map Register Set  36, 166\r
12952                Deallocate DMA Register Set  36, 175, 190\r
12953                Deallocate Pages  5, 14, 25, 31, 34, 43, 49, 88, 145,\r
12954                    148, 208\r
12955                Design Considerations  91, 151\r
12956                Device Driver  1, 15, 43, 53, 55, 144, 148, 199, 201,\r
12957                    202, 204, 212\r
12958                Disable DMA on Alternate Map Register Set  173\r
12959                Disable OS/E Function Set  36, 179, 180, 182, 185\r
12960                DMA  36, 138-140, 151, 152, 168-176, 190, 197\r
12961                DMA Channels  139, 171, 173, 174, 197\r
12962                DMA Register  36, 139, 140, 151, 152, 168-171, 173-176,\r
12963                    190, 197\r
12964                DOS  1, 12, 14, 15, 19, 21, 30, 31, 49, 53, 88, 199-205,\r
12965                    207-214\r
12966                Enable DMA on Alternate Map Register Set  170\r
12967                Enable OS/E Function Set  36, 179, 180\r
12968                Enable/Disable OS/E Function Set  179, 180, 182, 185\r
12969                Exchange Memory Region  7, 10, 35, 120, 126, 127, 189\r
12970                Expanded Memory Support of DMA  151\r
12971                Expanded Memory Support of DMA Register Sets  151\r
12972                Extended Memory  91\r
12973                Function 1  37\r
12974                Function 10  57\r
12975                Function 11  58\r
12976                Function 12  59\r
12977                Function 13  61\r
12978                Function 14  7, 63\r
12979 \r
12980 \r
12981           Index                                                         215\r
12982 \f\r
12983 \r
12984 \r
12985 \r
12986 \r
12987                Function 15  13, 53, 55, 65, 67, 69, 71, 73, 76, 139,\r
12988                    153, 154, 155, 158, 211\r
12989                Function 16  13, 73, 76, 78\r
12990                Function 17  6, 80, 82, 85\r
12991                Function 18  6, 43, 88, 144, 148, 207\r
12992                Function 19  7, 91, 92, 94, 96\r
12993                Function 2  4, 38\r
12994                Function 20  7, 98, 100\r
12995                Function 21  7, 42, 102, 105, 107\r
12996                Function 22  109\r
12997                Function 23  113, 118\r
12998                Function 24  7, 120, 126\r
12999                Function 25  6, 8, 46, 74, 85, 132, 136\r
13000                Function 26  138, 142, 179, 182, 206\r
13001                Function 27  42, 46, 80, 89, 144, 145, 147-149, 193, 206\r
13002                Function 28  140, 151, 153, 157, 161, 163, 164, 166,\r
13003                    168, 170, 173, 175, 179, 182, 209\r
13004                Function 29  177\r
13005                Function 3  4, 40, 142\r
13006                Function 30  138, 151, 153, 157, 161, 163, 166, 168,\r
13007                    170, 173, 175, 179, 182, 185\r
13008                Function 4  4, 42, 43, 46, 47, 49, 80, 89, 144, 145,\r
13009                    147, 149, 193, 206, 208\r
13010                Function 5  4, 46, 81\r
13011                Function 6  4, 43, 49, 88, 145, 148, 208\r
13012                Function 7  5, 51\r
13013                Function 8  46, 50, 53, 55\r
13014                Function 9  46, 50, 53, 55\r
13015                Get & Set Page Map  35, 69\r
13016                Get All Handle Pages  9, 34, 63\r
13017                Get Alternate Map Register Set  36, 153, 154, 157, 190\r
13018                Get Alternate Map Save Array Size  36, 161, 190\r
13019                Get Attribute Capability  7, 96\r
13020                Get Expanded Memory Hardware Information  10, 138, 142,\r
13021                    179, 182\r
13022                Get Handle Attribute  35, 92\r
13023                Get Handle Count  9, 34, 59\r
13024                Get Handle Directory  10, 35, 102, 105, 107\r
13025                Get Handle Name  35, 98\r
13026                Get Handle Pages  7, 9, 34, 61\r
13027                Get Hardware Configuration Array  36, 138\r
13028                Get Interrupt Vector  15, 21, 30, 199, 204, 205\r
13029                Get Mappable Physical Address Array  6, 8, 10, 35, 46,\r
13030                    85, 132, 136\r
13031                Get Mappable Physical Address Array Entries  8, 136\r
13032                Get Page Frame Address  5, 34, 38\r
13033                Get Page Map  35, 65, 118, 153-155, 158, 211\r
13034                Get Page Map Stack Space Size  35, 118\r
13035                Get Partial Page Map  35, 73, 78\r
13036                Get Size of Page Map Save Array  35, 65, 67, 71, 139\r
13037                Get Size of Partial Page Map Save Array  74, 76, 78\r
13038                Get Status  5, 34, 37\r
13039 \r
13040           Index                                                         216\r
13041 \f\r
13042 \r
13043 \r
13044 \r
13045 \r
13046                Get Total Handles  35, 107\r
13047                Get Unallocated Page Count  5, 22, 34, 40, 142\r
13048                Get Unallocated Raw Page Count  36, 142, 189\r
13049                Get Version  5, 34, 51\r
13050                Get/Set Handle Attribute  9, 91, 92, 94, 96\r
13051                Get/Set Handle Name  10, 98, 100\r
13052                Get/Set Page Map  9, 13, 65, 67, 69, 71\r
13053                Get/Set Partial Page Map  9, 13, 73, 76, 78\r
13054                Handle Attribute  9, 35, 91-94, 96, 188\r
13055                Handle Name  6, 7, 10, 35, 98, 100, 105, 106, 188, 198\r
13056                Intel  i, ii, 1, 5, 57, 58\r
13057                Interrupt Vector  12, 15, 21, 30, 199, 204, 205\r
13058                LIM  1, 7, 13, 19, 27, 53, 55, 138, 140, 206, 207\r
13059                Logical Page  1, 5, 12, 16, 19, 23, 28, 31, 32, 46-48,\r
13060                    80-83, 85, 86, 88, 110, 111, 115, 116, 120, 122,\r
13061                    123, 125, 126, 128, 129, 131, 147, 194, 196, 207,\r
13062                    212-214\r
13063                Logical Page/Physical Page Method  82\r
13064                Logical Page/Segment Address Method  85\r
13065                Lotus  i, ii, 1, 5, 57, 58\r
13066                Map Register  10, 13, 36, 53, 55, 151, 153-155, 157-159,\r
13067                    161, 163-168, 170, 173, 175, 179, 182, 190, 197,\r
13068                    209-211\r
13069                Map/Unmap Handle Pages  46\r
13070                Map/Unmap Multiple Handle Pages  9, 35, 80, 82, 85\r
13071                Mapping and Unmapping Multiple Pages Simultaneously  80\r
13072                Mapping Multiple Pages  6, 80\r
13073                Microsoft  i, ii, 1, 5, 14, 30, 42, 57, 58, 144, 148\r
13074                Move Memory Region  35, 120, 121, 189\r
13075                Move/Exchange Memory Region  7, 10, 120, 126\r
13076                Open Handle  64, 102, 199, 200, 203, 204\r
13077                Operating System  3, 8, 10-12, 42, 43, 59, 63, 107, 138,\r
13078                    139, 141, 142, 144-151, 153-159, 161-163, 165-171,\r
13079                    173-177, 179-183, 185, 186, 190, 191, 198, 206,\r
13080                    207-209, 213\r
13081                Page Frame  1-6, 14, 17-19, 24, 28, 31, 34, 38, 39, 47,\r
13082                    53, 55, 121, 128, 133, 187, 213\r
13083                Page Map  7, 9, 10, 13, 34, 35, 50, 53, 55, 65, 67, 69,\r
13084                    71, 73-76, 78, 109, 113, 118, 139, 153-155, 158,\r
13085                    187, 188, 189, 211\r
13086                Page Mapping Register I/O Array  57\r
13087                Page Translation Array  58\r
13088                Physical Page  1, 5, 6, 8, 10, 12, 16, 23, 28, 31, 35,\r
13089                    46, 47, 48, 80-83, 85, 109-112, 114-117, 132-134,\r
13090                    136, 138, 139, 142, 147, 188, 194, 207, 209, 213\r
13091                Prepare Expanded Memory Hardware For Warm Boot  10, 177\r
13092                Raw Handle  147, 149, 150, 206, 207\r
13093                Raw Page  36, 142, 143, 147, 189, 206\r
13094                Reallocate Pages  9, 35, 43, 88, 144, 145, 148, 208\r
13095                Restore Page Map  9, 13, 34, 50, 53, 55\r
13096                Return Access Key  185\r
13097                Save Page Map  9, 13, 34, 50, 53, 55\r
13098 \r
13099           Index                                                         217\r
13100 \f\r
13101 \r
13102 \r
13103 \r
13104 \r
13105                Search For Named Handle  7, 35, 105\r
13106                Set Alternate Map Register Set  36, 153-155, 157, 158,\r
13107                    163, 190\r
13108                Set Handle Attribute  9, 35, 91, 92, 94, 96\r
13109                Set Handle Name  7, 10, 35, 98, 100\r
13110                Set Page Map  9, 13, 35, 65, 67, 69, 71, 188\r
13111                Set Partial Page Map  9, 13, 35, 73, 76, 78\r
13112                Standard Handle  146\r
13113                Standard Page  147\r
13114                System DMA Capabilities  151\r
13115                TSR  12, 13, 208\r
13116                Unmapping Multiple Pages  6, 80\r
13117 \r
13118 \r
13119 \r
13120 \r
13121 \r
13122 \r
13123 \r
13124 \r
13125 \r
13126 \r
13127 \r
13128 \r
13129 \r
13130 \r
13131 \r
13132 \r
13133 \r
13134 \r
13135 \r
13136 \r
13137 \r
13138 \r
13139 \r
13140 \r
13141 \r
13142 \r
13143 \r
13144 \r
13145 \r
13146 \r
13147 \r
13148 \r
13149 \r
13150 \r
13151 \r
13152 \r
13153 \r
13154 \r
13155 \r
13156 \r
13157 \r
13158           Index                                                         218\r
13159 \f\r
13160 \1a \15\14\ ep\0\0ALLINFO.TXT\0\0\r
13161 Following are BBSes that are members of DV-NET.  DV-Net is an informal\r
13162 network of BBS's that carry files that would be useful to DESQview users. \r
13163 Not all BBSes that carry the DESQview conference are members of DV-Net.\r
13164 \r
13165 All address are NetMail addresses.\r
13166 \r
13167             ----------------------------------------------\r
13168                  DVNet DESQview Support File Network\r
13169             ----------------------------------------------\r
13170          DESQview is a trademark of Quarterdeck Office Systems\r
13171        -----------------------------------------------------------\r
13172          DVNet is not affiliated with Quarterdeck Office Systems\r
13173    ----------------------------------------------------------------\r
13174 \r
13175    Name, City and State             NetAddress  Telephone     Maxbaud\r
13176    -------------------------------  ---------- ------------  -------\r
13177  *65'North, Fairbanks, AK         1:17/38    907-452-1460  9600HSTV32\r
13178   Opus 386, Davis, CA             1:203/910  916-753-6321  2400\r
13179   Carl's Corner, San Jose, CA     1:10/1     408-248-9704  9600HSTV32\r
13180   Carl's Corner, San Jose, CA     1:10/2     408-248-0198  2400\r
13181   SeaHunt BBS, Burlingame, CA     1:125/20   415-344-4348  9600HST\r
13182   Stingray!, Clovis CA            1:205/12   209-298-9461  9600HST\r
13183   SF PCUG BBS, San Francisco CA   1:1/310    415-621-2609  9600HSTV32RE\r
13184   Bink of an Aye, Portland, OR    1:105/42   503-297-9043  9600PEPV32MO\r
13185   P C Support, Portland, OR       1:105/66   503-297-9078  2400\r
13186   Atarian BBS, Portland, OR       1:105/10   503-245-9730  9600HSTV32\r
13187   Busker's BoneYard, Portland,OR  1:105/14   503-771-4773  9600PEP\r
13188   Busker's Boneyard, Portland,OR  1:105/41   503-775-7926  9600HSTV32\r
13189   Pacifier BBS, Vancouver, WA     1:105/103  206-253-9770  9600HSTV32\r
13190   Puget Sound Gtwy., Puyallup, WA 1:138/3    206-566-8854  9600HST\r
13191   Rampart General,Kansas City,MO  1:280/6    816-761-4039  9600HST\r
13192   Oregon Trail XRoads, Casper WY  1:303/5    307-472-3615  9600H96\r
13193   Dawg Byte, Nashville, TN        1:116/29   615-385-4268  9600HST\r
13194   Dickson County, Dickson, TN     1:116/25   615-446-4475  2400\r
13195   Programmers' Attic, Will., MI   1:159/850  517-655-3347  2400\r
13196   Dark Side Of the Moon,Savoy IL  1:233/493  217-356-6922  9600HSTV32\r
13197   Ecclesia Place, Monroeville, PA 1:129/75   412-373-8612  9600HST\r
13198   The Other BBS, Harrisburg PA    1:270/101  717-657-2223  9600HST\r
13199   IBM Tech Fido, Pepperell, MA    1:322/1    508-433-8452  9600HSTV32\r
13200   Waystar BBS, Marlborough, MA    1:322/14   508-481-7147  9600HST\r
13201   Andromeda Galaxy, Troy NY       1:267/167  518-273-8313  9600HST\r
13202   Treasure Island, Danbury, CT    1:141/730  203-791-8532, 9600HST\r
13203   Addict's Attic,Germantown MD    1:109/423  301-428-8998  9600HST\r
13204   Maple Shade Opus,Maple Shade NJ 1:266/12   609-482-8604  9600HSTV32\r
13205   Capital City , Burlington NJ   99:9230/1   609-386-1989  9600HSTV32\r
13206   Capital City , Burlington NJ    8:950/10   609-386-1989  9600HSTV32\r
13207   Southern Cross BBS, Miami FL    1:135/69   305-220-8752  9600HST\r
13208   Software Designer, Albany, GA   1:3617/1   912-432-2440  9600HSTV32\r
13209   Software Designer, Albany, GA   8:928/1    912-432-2440  9600HSTV32\r
13210   Dragon's Lair, Galveston, TX    1:386/451  409-762-2761  9600HST\r
13211   Dragon's Lair, Galveston, TX    1:386/1451 409-762-7456  2400MNP\r
13212   Conch Opus, Houston, TX         1:106/357  713-667-7213  2400PCP\r
13213   Inns of Court, Dallas, TX       1:124/6101 214-458-2620  9600HSTV32\r
13214   Dallas Email, Dallas, TX        8:930/101  214-358-1205  9600HSTV32MO\r
13215   Spare Parts, Bedford, TX        1:130/38   817-540-3527  9600HST\r
13216   QE2, Austin TX                  1:382/58   512-328-1229  2400\r
13217   Ned's Opus HST Ottawa,ON Canada 1:163/211  613-523-8965  9600HST\r
13218   Ned's Opus, Ottawa ON Canada    1:163/210  613-731-8132  2400\r
13219   Imperial Terran, St Cath,ON     1:247/102  416-646-7105  9600HST\r
13220   Arcane BBS, Laval PQ Canada     1:167/116  514-687-9586  9600HST\r
13221   Zone 2 & Zone 3\r
13222   ------------------------------  ---------  ------------- -------\r
13223   The HEKOM Board (Netherlands)   2:286/3    31-3483-4072  2400MNP5\r
13224   BBS_D.C.V.V., Maaseik (Belgium) 2:295/26   32-11-568620