]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MEMM/MEMM/ELIMFUNC.ASM
4 ;******************************************************************************
5 title ELIMFUNC
- MEMM functions module
6 ;******************************************************************************
8 ; (C) Copyright MICROSOFT Corp. 1986
10 ; Title: MEMM.EXE - MICROSOFT Expanded Memory Manager 386 Driver
12 ; Module: ELIMFUNC - entry point for VDM functions
20 ;******************************************************************************
24 ; DATE REVISION Description
25 ; -------- -------- --------------------------------------------
26 ; 04/24/86 Original From EMML LIM driver.
27 ; 06/28/86 0.02 Name change from MEMM386 to MEMM
28 ; 07/05/86 0.04 Added segment R_CODE
29 ; 07/06/86 0.04 Changed assume to DGROUP
30 ; 07/10/86 0.05 jmp $+2 before "POPF"
32 ;******************************************************************************
33 ; Functional Description:
34 ; This module contains the ON/OFF functionality code for activating/
35 ; deactivating EMM386 from DOS. Functions in _TEXT to reduce code in
38 ;******************************************************************************
42 ;******************************************************************************
43 ; P U B L I C D E C L A R A T I O N S
44 ;******************************************************************************
51 ;******************************************************************************
52 ; L O C A L C O N S T A N T S
53 ;******************************************************************************
60 ;******************************************************************************
61 ; E X T E R N A L R E F E R E N C E S
62 ;******************************************************************************
65 extrn Active_Status
:byte
70 extrn _AutoUpdate
:near ; update auto mode status
72 extrn RRProc
:near ; Return processor to real mode(RRTrap)
76 ;******************************************************************************
77 ; S E G M E N T D E F I N I T I O N
78 ;******************************************************************************
80 ;******************************************************************************
84 ;******************************************************************************
87 assume
cs:R_CODE
, ds:DGROUP
, es:DGROUP
89 ; ELIM functions table - far calls
98 EFUN_CNT equ
($-EFunTab
)/4
101 ;******************************************************************************
102 ; ELIM_Entry - entry point for general ELIM functions
104 ; THIS IS A FAR CALL ROUTINE
106 ; ENTRY: REAL or VIRTUAL mode only
107 ; AH = 0 => get current status of VDM/EMM386
108 ; AH = 1 => ON/OFF/AUTO
110 ; EXIT: EMM386 is activated/deactivated if possible
112 ; CY => ERROR occured.
114 ; AH= 01 =>invalid function.
118 ;******************************************************************************
127 cmp ah,EFUN_CNT
;Q: valid function #
128 jae EE_inv_func
; N: return error
129 xor bx,bx ; Y: exec function
130 mov bl,ah ; bx = function #
131 shl bx,2 ; dword index
132 call CS:EFunTab
[bx] ; call the function
149 ;******************************************************************************
153 ;******************************************************************************
155 assume
cs:_TEXT
, ds:DGROUP
, es:DGROUP
157 ;******************************************************************************
158 ; E_GetStatus - get ELIM/VDM status
163 ; EXIT: AH = 0 => ELIM ON
165 ; = 2 => ELIM in AUTO mode (ON)
166 ; = 3 => ELIM in AUTO mode (OFF)
170 ;******************************************************************************
173 xor ah,ah ; init to on
174 cmp [Auto_Mode
],0 ; Q: auto mode ?
175 je not_auto
; N: try on/off
176 mov ah,2 ; Y: indicate as such
178 cmp [Active_Status
],0 ;Q: is ELIM active ?
179 jne EGS_exit
; Y: exit with status = 0/2
180 inc ah ; N: exit with status = 1/3
186 ;******************************************************************************
187 ; E_ONOFF - general ON/OFF code for ELIM
195 ; EXIT: Virtual mode and ELIM ON
196 ; OR Real mode and ELIM OFF
200 ;******************************************************************************
203 cmp al,0 ;Q: turn it on ?
204 jne EOO_OFF
; N: check for OFF/AUTO
205 cmp [Active_Status
],0 ; Y: Q: is it already active ?
206 jne EOO_AUTO_OFF
; Y: then just leave
207 mov [Active_Status
],1 ; N: then go to virtual mode
208 mov [Auto_Mode
],0 ; and clear auto mode
212 cmp al,1 ;Q: turn it off ?
213 jne EOO_AUTO
; N: check for AUTO mode
216 ; we are not providing the ability to turn emm off.
218 ; cmp [Active_Status],0 ; Y: Q: is it already OFF ?
219 ; je EOO_AUTO_OFF ; Y: then just leave
220 ; mov [Active_Status],0 ; N: then go to real mode
221 ; mov [Auto_Mode],0 ; and clear auto mode
222 ; call RRProc ; put processor in real mode
229 ; cmp [Auto_Mode],0 ; q: auto mode already off?
230 ; jz EOO_OK ; y: forget it
231 ; mov [Auto_Mode],0 ; n: clear it
232 ; jmp short EOO_OK ; and update status
238 cmp al,2 ;Q: go to auto mode ?
239 jne EOO_inv
; N: invalid function
240 ; cmp [Auto_Mode],0 ; Y: Q: is it already in auto mode
241 ; jne EOO_OK ; Y: then just leave
242 ; mov [Auto_Mode],1 ; N: then go to auto mode
247 ; leave with no errors
255 ; invalide ON/OFF/AUTO function call