-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathENABLE.ASM
executable file
·233 lines (198 loc) · 6.6 KB
/
ENABLE.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
page ,132
;-----------------------------Module-Header-----------------------------;
; Module Name: ENABLE.ASM
;
; This module contains the routine which is called when the device
; is to either enable itself or return it's GDIINFO.
;
; Created: 16-Jan-1987
; Author: **** ***** [*****]
;
; Copyright (c) 1983-1987 Microsoft Corporation
;
; Exported Functions: Enable
;
; Public Functions: none
;
; Public Data: _cstods
;
; General Description:
;
; The Display is called to enable itself on one of two occasions.
;
; The first situation where the Disable routine is called is
; when Windows is starting the session. For this situation,
; the driver will also be asked to return information about
; the device hardware (e.g. resolution, etc).
;
; The second is when an old application was run (e.g. WORD).
; In this instance, Enable will be called to enable the display
; hardware after the old application ran.
;
; Unfortunately, there is no way to distinguish these two modes.
;
; Restrictions:
;
;-----------------------------------------------------------------------;
incDevice = 1
.xlist
include cmacros.inc
include gdidefs.inc
.list
externNP hook_int_2Fh ;Hook into multiplexed interrupt
externA PHYS_DEVICE_SIZE ;Size of physical device
sBegin Data
externW ssb_mask ;Mask for save save screen bitmap bit
sEnd Data
createSeg _INIT,InitSeg,word,public,CODE
sBegin InitSeg
assumes cs,InitSeg
externNP physical_enable ;Enable routine
externB physical_device ;Device physical data
externB info_table_base ;GDIInfo table
page
;--------------------------Exported-Routine-----------------------------;
; INT Enable(lpDevice,style,lpDeviceType,lpOutputFile,lpStuff)
; DEVICE lpDevice; //device block or GDIInfo destination
; INT style; //Style of initialization
; LPSTR lpDeviceType; //Device type (i.e FX80, HP7470, ...)
; LPSTR lpOutputFile; //DOS output file name (if applicable)
; LPSTR lpStuff; //Device specific information
;
; Enable - Enable Device
;
; The given device is either initialized or the GDI information
; for the given device is returned.
;
; If style=InquireInfo, then GDI is asking that the parameters
; passed be interpreted and the appropriate GDI information
; for the device be returned in lpDevice.
;
; If style=EnableDevice, then GDI is requesting that the device
; be initialized and lpDevice be initialized with whatever
; data is needed by the device.
;
; The three other pointers passed in will be the same for both
; calls, allowing for the device to request only the minimum
; required for a device that is supported. These will be
; ASCIIZ strings or NULL pointers if no parameter was given.
; These strings are ignored by the display drvier.
;
; For the inquire function, the number of bytes of GDIINFO placed
; into lpDevice is returned. For the enable function, non-zero is
; returned for success. In both cases, zero is returned for an error.
;
;
; Warnings:
; Destroys AX,BX,CX,DX,ES,FLAGS
; Effects:
; none
; Calls:
; PhysicalEnable
; History:
; Mon 21-Sep-1987 00:20:57 -by- **** ***** [*****]
; Added call to hook_int_2Fh
;
; Wed 12-Aug-1987 17:16:37 -by- **** ***** [*****]
; Made non-resident.
;
; Tue 19-May-1987 22:01:34 -by- *** ****** [******]
; Added code to modify GDI info table if EGA doesn't have enough
; memory to make use of save_screen_bitmap
;
; Fri 26-Jun-1987 15:00:00 -by- *** ****** [******]
; Removed code mentioned above and put it in EGAINIT.ASM, in an INIT
; segment. This restores the integrity of the device-dependence levels
; within the Mondo Tree Structure of Death.
;
; Fri 16-Jan-1987 17:52:12 -by- **** ***** [*****]
; Initial version
;-----------------------------------------------------------------------;
;------------------------------Pseudo-Code------------------------------;
; INT Enable(lpDevice,style,lpDeviceType,lpOutputFile,lpStuff)
; DEVICE lpDevice; //device block or GDIInfo destination
; INT style; //Style of initialization
; LPSTR lpDeviceType; //Device type (i.e FX80, HP7470, ...)
; LPSTR lpOutputFile; //DOS output file name (if applicable)
; LPSTR lpStuff; //Device specific information
; {
; if (style == inquire)
; {
; *(GDIINFO)lpDevice = (GDIINFO)info_table_base; //copy GDIINFO
; return (sizeof(GDIINFO));
; }
;
; *lpDevice = (DEVICE)physical_device; //Initialize Physical device
; hook_int_2Fh();
; return(physical_enable(lpDevice)); //Initialize hardware
; }
;-----------------------------------------------------------------------;
assumes ds,Data
assumes es,nothing
cProc Enable,<FAR,PUBLIC,WIN,PASCAL>,<si,di>
parmD lp_device ;Physical device or GDIinfo destination
parmW style ;Style, Enable Device, or Inquire Info
parmD lp_device_type ;Device type (i.e FX80, HP7470, ...)
parmD lp_output_file ;DOS output file name (if applicable)
parmD lp_stuff ;Device specific information
cBegin
push ds
mov ax,cs ;Set up ds=cs
mov ds,ax
assumes ds,InitSeg
cld
les di,lp_device ;--> device structure or GDIinfo dest.
assumes es,nothing
and style,InquireInfo ;Is this the inquire function?
jnz inquire_gdi_info ; Yes, return GDIinfo
errnz InquireInfo-00000001b
errnz EnableDevice-00000000b
errnz InfoContext-8000h ;Ignore infomation context flag
; Initialize passed device block
lea si,physical_device ;DS:SI --> physical device to copy
mov cx,PHYS_DEVICE_SIZE ;Set move count
rep movsb
pop ds
assumes ds,Data
;call hook_int_2Fh ;Hook into multiplexed interrupt
call physical_enable ;Enable device
mov ah, 0ah
mov al, "E"
mov bh, 0
mov cx, 5
int 10h
mov ax, 1
jmp short exit_enable
page
; inquire_gdi_info - Inquire Device Specific Information
;
; The GDI device specific information is returned to the caller
;
; The information is based on the three pointers passed in.
; Normally this data would be interpreted and the correct
; GDINFO returned. This allows for dynamically returning
; the info based on the specifics of the device actually
; being used (i.e. a driver supporting two similar plotters
; could return the extents of the actual plotter in use).
;
; These parameters are ignored for display drivers.
;
; Currently:
; ES:DI --> where GDIINFO goes
; DS = CS
inquire_gdi_info:
mov si,InitSegOFFSET info_table_base
mov cx,size GDIINFO
mov ax,cx ;return size of GDIInfo
rep movsb
pop ds
;assumes ds,Data
;mov bx,ssb_mask
;and es:[di].dpRaster[-size GDIINFO],bx
exit_enable:
cEnd
sEnd InitSeg
ifdef PUBDEFS
include enable.pub
endif
end