]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/MEMM/MEMM/ELIMFUNC.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / MEMM / MEMM / ELIMFUNC.ASM
1
2
3 page 58,132
4 ;******************************************************************************
5 title ELIMFUNC - MEMM functions module
6 ;******************************************************************************
7 ;
8 ; (C) Copyright MICROSOFT Corp. 1986
9 ;
10 ; Title: MEMM.EXE - MICROSOFT Expanded Memory Manager 386 Driver
11 ;
12 ; Module: ELIMFUNC - entry point for VDM functions
13 ;
14 ; Version: 0.05
15 ;
16 ; Date: May 24,1986
17 ;
18 ; Author:
19 ;
20 ;******************************************************************************
21 ;
22 ; Change Log:
23 ;
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"
31 ;
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
36 ; R_CODE segment.
37 ;
38 ;******************************************************************************
39 .lfcond
40 .386p
41 page
42 ;******************************************************************************
43 ; P U B L I C D E C L A R A T I O N S
44 ;******************************************************************************
45 ;
46 public ELIM_Entry
47 public EFunTab
48 public EFUN_CNT
49 ;
50 page
51 ;******************************************************************************
52 ; L O C A L C O N S T A N T S
53 ;******************************************************************************
54 ;
55 include vdmseg.inc
56
57 FALSE equ 0
58 TRUE equ not FALSE
59
60 ;******************************************************************************
61 ; E X T E R N A L R E F E R E N C E S
62 ;******************************************************************************
63 ;
64 _DATA segment
65 extrn Active_Status:byte
66 extrn Auto_Mode:byte
67 _DATA ends
68
69 _TEXT segment
70 extrn _AutoUpdate:near ; update auto mode status
71 extrn GoVirtual:near
72 extrn RRProc:near ; Return processor to real mode(RRTrap)
73 _TEXT ends
74
75 page
76 ;******************************************************************************
77 ; S E G M E N T D E F I N I T I O N
78 ;******************************************************************************
79 ;
80 ;******************************************************************************
81 ;
82 ; Code Segment R_CODE
83 ;
84 ;******************************************************************************
85 ;
86 R_CODE segment
87 assume cs:R_CODE, ds:DGROUP, es:DGROUP
88 ;
89 ; ELIM functions table - far calls
90 ;
91 EFunTab label dword
92 dw offset E_GetStatus
93 dw seg _TEXT
94
95 dw offset E_ONOFF
96 dw seg _TEXT
97
98 EFUN_CNT equ ($-EFunTab)/4
99
100 page
101 ;******************************************************************************
102 ; ELIM_Entry - entry point for general ELIM functions
103 ;
104 ; THIS IS A FAR CALL ROUTINE
105 ;
106 ; ENTRY: REAL or VIRTUAL mode only
107 ; AH = 0 => get current status of VDM/EMM386
108 ; AH = 1 => ON/OFF/AUTO
109 ;
110 ; EXIT: EMM386 is activated/deactivated if possible
111 ; NC => no errors.
112 ; CY => ERROR occured.
113 ; AH = error number
114 ; AH= 01 =>invalid function.
115 ;
116 ; USED: none
117 ;
118 ;******************************************************************************
119 ELIM_Entry proc far
120 ;
121 push bx
122 push ds
123 ;
124 mov bx,seg DGROUP
125 mov ds,bx
126 ;
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
133 ;
134 EE_exit:
135 pop ds
136 pop bx
137 ret
138 ;
139 EE_inv_func:
140 mov ah,01
141 stc
142 jmp short EE_exit
143 ;
144 ELIM_Entry endp
145
146 R_CODE ends
147
148 page
149 ;******************************************************************************
150 ;
151 ; Code Segment _TEXT
152 ;
153 ;******************************************************************************
154 _TEXT segment
155 assume cs:_TEXT, ds:DGROUP, es:DGROUP
156
157 ;******************************************************************************
158 ; E_GetStatus - get ELIM/VDM status
159 ;
160 ; ENTRY: AH = 0
161 ; DS = DGROUP
162 ;
163 ; EXIT: AH = 0 => ELIM ON
164 ; = 1 => ELIM OFF
165 ; = 2 => ELIM in AUTO mode (ON)
166 ; = 3 => ELIM in AUTO mode (OFF)
167 ;
168 ; USED: none
169 ;
170 ;******************************************************************************
171 E_GetStatus proc far
172 ;
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
177 not_auto:
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
181 EGS_exit:
182 ret
183 ;
184 E_GetStatus endp
185
186 ;******************************************************************************
187 ; E_ONOFF - general ON/OFF code for ELIM
188 ;
189 ; ENTRY: AH = 1
190 ; AL = 0 => ON
191 ; AL = 1 => OFF
192 ; AL = 2 => AUTO
193 ; DS = DGROUP
194 ;
195 ; EXIT: Virtual mode and ELIM ON
196 ; OR Real mode and ELIM OFF
197 ;
198 ; USED: none
199 ;
200 ;******************************************************************************
201 E_ONOFF proc far
202 ;
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
209 call GoVirtual
210 jmp short EOO_OK
211 EOO_OFF:
212 cmp al,1 ;Q: turn it off ?
213 jne EOO_AUTO ; N: check for AUTO mode
214
215 ;
216 ; we are not providing the ability to turn emm off.
217 ;
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
223 ; jmp short EOO_OK
224
225 jmp short EOO_inv
226
227
228 EOO_AUTO_OFF:
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
233
234 jmp short EOO_inv
235
236
237 EOO_AUTO:
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
243 ; call _AutoUpdate ;
244
245 jmp short EOO_inv
246 ;
247 ; leave with no errors
248 ;
249 EOO_OK:
250 clc
251
252 EOO_exit:
253 ret
254 ;
255 ; invalide ON/OFF/AUTO function call
256 ;
257 EOO_inv:
258 mov ah,1
259 stc
260 jmp short EOO_exit
261 ;
262 E_ONOFF endp
263
264 ;
265 _TEXT ends
266
267 end
268 \1a