Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
3.3 KiB

  1. PAGE ,132
  2. TITLE DXEMM2.ASM -- Dos Extender MEMM Enable Code
  3. ; Copyright (c) Microsoft Corporation 1989-1991. All Rights Reserved.
  4. ;***********************************************************************
  5. ;
  6. ; DXEMM2.ASM -- Dos Extender MEMM Enable Code
  7. ;
  8. ;-----------------------------------------------------------------------
  9. ;
  10. ; This module provides routines that attempt to enable MEMM/CEMM/EMM386
  11. ; drivers. DOSX tries to disable MEMM when starting up, and enables MEMM
  12. ; when terminating.
  13. ;
  14. ; NOTE: This code is in a seperate file from the disable logic because
  15. ; the disable code is discarded after initialization.
  16. ;
  17. ;-----------------------------------------------------------------------
  18. ;
  19. ; 12/08/89 jimmat Finally got around to implementing this.
  20. ;
  21. ;***********************************************************************
  22. .286p
  23. ; -------------------------------------------------------
  24. ; INCLUDE FILE DEFINITIONS
  25. ; -------------------------------------------------------
  26. .xlist
  27. .sall
  28. include segdefs.inc
  29. include gendefs.inc
  30. .list
  31. if NOT VCPI
  32. ; -------------------------------------------------------
  33. ; GENERAL SYMBOL DEFINITIONS
  34. ; -------------------------------------------------------
  35. ; -------------------------------------------------------
  36. ; EXTERNAL SYMBOL DEFINITIONS
  37. ; -------------------------------------------------------
  38. ; -------------------------------------------------------
  39. ; DATA SEGMENT DEFINITIONS
  40. ; -------------------------------------------------------
  41. DXDATA segment
  42. public fMEMM_Disabled, MEMM_State, MEMM_Call
  43. fMEMM_Disabled db 0 ; NZ if MEMM disabled
  44. MEMM_state db 0 ; Initial MEMM state
  45. MEMM_Call dd 0 ; far call address into EMM driver
  46. DXDATA ends
  47. ; -------------------------------------------------------
  48. ; CODE SEGMENT VARIABLES
  49. ; -------------------------------------------------------
  50. DXCODE segment
  51. DXCODE ends
  52. DXPMCODE segment
  53. DXPMCODE ends
  54. ; -------------------------------------------------------
  55. subttl MEMM/CEMM/EMM386 Enable Routines
  56. page
  57. ; -------------------------------------------------------
  58. ; MEMM/CEMM/EMM386 ENABLE ROUTINES
  59. ; -------------------------------------------------------
  60. DXCODE segment
  61. assume cs:DXCODE
  62. ; -------------------------------------------------------
  63. ; EMMEnable -- This routine attempts to re-enable any installed
  64. ; MEMM/CEMM/EMM386 driver.
  65. ;
  66. ; Input: none
  67. ; Output: CY off - EMM driver enabled (or never disabled)
  68. ; CY set - EMM installed, and can't disable
  69. ; Errors:
  70. ; Uses: All registers preserved
  71. assume ds:DGROUP,es:NOTHING,ss:NOTHING
  72. public EMMEnable
  73. EMMEnable proc near
  74. push ax
  75. cmp fMEMM_Disabled,0 ; Did we disable MEMM before?
  76. jz enable_exit ; no, don't need to enable then
  77. mov ah,01 ; Set state command
  78. mov al,MEMM_state ; Get initial state
  79. cmp al,2 ; They return 0 (on), 1 (off),
  80. jbe @f ; 2 (auto on), 3 (auto off) -- but
  81. mov al,2 ; we can only set 1 - 2
  82. @@:
  83. call [MEMM_Call] ; and restore it
  84. jc not_enabled
  85. mov fMEMM_Disabled,0 ; no longer disabled
  86. clc
  87. jmp short enable_exit
  88. not_enabled:
  89. stc
  90. enable_exit:
  91. pop ax
  92. ret
  93. EMMEnable endp
  94. ; -------------------------------------------------------
  95. DXCODE ends
  96. ;****************************************************************
  97. endif ; NOT VCPI
  98. end