home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / doc / ems / disk2 / emm08_a.asm < prev    next >
Assembly Source File  |  1989-11-29  |  6KB  |  104 lines

  1. ;-----------------------------------------------------------------------------;
  2. ;      MODULE NAME:   EMM08_A.ASM                                             ;
  3. ;                                                                             ;
  4. ;    FUNCTION NAME:   save_context                                            ;
  5. ;                                                                             ;
  6. ;      DESCRIPTION:   This function saves the contents of the page mapping    ;
  7. ;                     hardware on all expanded memory boards.  (The contents  ;
  8. ;                     are saved in a memory manager internal save area.)      ;
  9. ;                     The function is typically used to save the memory       ;
  10. ;                     mapping context of the EMM handle that was active when  ;
  11. ;                     a software or hardware interrupt occurred.  (See        ;
  12. ;                     restore_context for the restore operation.)             ;
  13. ;                                                                             ;
  14. ;                     If you're writing a resident program, an interrupt      ;
  15. ;                     service routine, or a device driver that uses expanded  ;
  16. ;                     memory, you must save the state of the mapping          ;
  17. ;                     hardware.  You must save this state because application ;
  18. ;                     software using expanded memory may be running when your ;
  19. ;                     program is invoked by a hardware interrupt, a software  ;
  20. ;                     interrupt, or DOS.                                      ;
  21. ;                                                                             ;
  22. ;                     The save_context function requires the EMM handle that  ;
  23. ;                     was assigned to your resident program, interrupt        ;
  24. ;                     service routine, or device driver at the time it was    ;
  25. ;                     initialized.  This is not the EMM handle that the       ;
  26. ;                     application software was using when your software       ;
  27. ;                     interrupted it.                                         ;
  28. ;                                                                             ;
  29. ;                     The save_context function saves the state of the map    ;
  30. ;                     hardware for only the 64K-byte page frame defined in    ;
  31. ;                     versions 3.x of this specification.  Since all          ;
  32. ;                     applications written to LIM versions 3.x require saving ;
  33. ;                     the map hardware state of only this 64K-byte page       ;
  34. ;                     frame, saving the entire mapping state for a large      ;
  35. ;                     number of mappable pages would be inefficient use of    ;
  36. ;                     memory.  Applications that use a mappable memory region ;
  37. ;                     outside the LIM 3.x page frame should use the           ;
  38. ;                     get_context, set_context, get_set_context,              ;
  39. ;                     get_partial_context, set_partial_context functions to   ;
  40. ;                     save and restore the state of the map hardware.         ;
  41. ;                                                                             ;
  42. ;           PASSED:   handle:                                                 ;
  43. ;                        is the EMM handle assigned to the interrupt service  ;
  44. ;                        routine that's servicing the software or hardware    ;
  45. ;                        interrupt.  The interrupt service routine needs to   ;
  46. ;                        save the state of the page mapping hardware before   ;
  47. ;                        mapping any pages.                                   ;
  48. ;                                                                             ;
  49. ;         RETURNED:   status:                                                 ;
  50. ;                        is the status EMM returns from the call.  All other  ;
  51. ;                        returned results are valid only if the status        ;
  52. ;                        returned is zero.  Otherwise they are undefined.     ;
  53. ;                                                                             ;
  54. ; C USE CONVENTION:   unsigned int status;                                    ;
  55. ;                     unsigned int handle;                                    ;
  56. ;                                                                             ;
  57. ;                     status = save_context (handle);                         ;
  58. ;-----------------------------------------------------------------------------;
  59. .XLIST
  60. PAGE    60,132
  61.  
  62. IFDEF SMALL
  63.    .MODEL SMALL, C
  64. ENDIF
  65. IFDEF MEDIUM
  66.    .MODEL MEDIUM, C
  67. ENDIF
  68. IFDEF LARGE
  69.    .MODEL LARGE, C
  70. ENDIF
  71. IFDEF COMPACT
  72.    .MODEL COMPACT, C
  73. ENDIF
  74. IFDEF HUGE
  75.    .MODEL HUGE, C
  76. ENDIF
  77.  
  78. INCLUDE emmlib.equ
  79. INCLUDE emmlib.str
  80. INCLUDE emmlib.mac
  81. .LIST
  82. .CODE
  83.  
  84. save_context        PROC                                                  \
  85.             handle:WORD
  86.  
  87.     ;---------------------------------------------------------------------;
  88.     ;   do;                                                               ;
  89.     ;   .   save the LIM 3.X mapping context within EMM;                  ;
  90.     ;---------------------------------------------------------------------;
  91.     MOVE        AH, save_page_map_fcn
  92.     MOVE        DX, handle
  93.     INT         EMM_int
  94.  
  95.     ;---------------------------------------------------------------------;
  96.     ;   .   return (EMM status);                                          ;
  97.     ;   end;                                                              ;
  98.     ;---------------------------------------------------------------------;
  99.     RET_EMM_STAT    AH
  100.  
  101. save_context        ENDP
  102.  
  103. END
  104.