File: gripfnc.asm

package info (click to toggle)
snes9x 1.26-1
  • links: PTS
  • area: non-free
  • in suites: potato
  • size: 2,712 kB
  • ctags: 9,605
  • sloc: cpp: 40,776; asm: 27,081; ansic: 6,572; makefile: 314
file content (364 lines) | stat: -rw-r--r-- 5,656 bytes parent folder | download | duplicates (3)
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
[GLOBAL _GrInitialize]
[GLOBAL _GrShutdown]
[GLOBAL _GrRefresh]
[GLOBAL _GrGetSlotMap]
[GLOBAL _GrGetClassMap]
[GLOBAL _GrGetOEMClassMap]
[GLOBAL _GrGetMaxIndex]
[GLOBAL _GrGetMaxValue]
[GLOBAL _GrGetValue]
[GLOBAL _GrGetPackedValues]
[GLOBAL _GrSetValue]
[GLOBAL _GrGetVendorName]
[GLOBAL _GrGetProductName]
[GLOBAL _GrGetControlName]
[GLOBAL _GrGetCaps]
[GLOBAL _Gr__Link]
[GLOBAL _Gr__Unlink]
[GLOBAL _GrGetSWVer]
[GLOBAL _GrGetHWVer]
[GLOBAL _GrGetDiagCnt]
[GLOBAL _GrGetDiagReg]
[GLOBAL _DPMI_SetCodeAR]
[GLOBAL _DPMI_SetDataAR]

[EXTERN _GRIP_Thunk]

[SEGMENT .text]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Since I don't know which registers DJGPP wants preserved, I've decided to ;;
;; save all registers that get modified, except for EAX when the function    ;;
;; returns a value. Better safe than sorry, says me.                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

_GrInitialize:
   mov ax, 84A1h
   call far [_GRIP_Thunk+8]
RET

_GrShutdown:
   push eax
	mov ax, 84A2h
   call far [_GRIP_Thunk+8]
	pop eax
RET

_GrRefresh:
   push ebp
   mov ebp, esp
   push edx

   mov edx, dword [ebp+8]

   mov ax, 84A0h
   call far [_GRIP_Thunk+8]

   pop edx
   pop ebp
RET

_GrGetSlotMap:
   mov ax, 84B0h
   call far [_GRIP_Thunk+8]
RET

_GrGetClassMap:
   push ebp
   mov ebp, esp
   push ebx

   mov bh, byte [ebp+8]

   mov ax, 84B1h
   call far [_GRIP_Thunk+8]

   pop ebx
   pop ebp
RET

_GrGetOEMClassMap:
   push ebp
   mov ebp, esp
   push ebx

   mov bh, byte [ebp+8]

   mov ax, 84B2h
   call far [_GRIP_Thunk+8]

   pop ebx
   pop ebp
RET

_GrGetMaxIndex:
   push ebp
   mov ebp, esp
   push ebx

   mov bh, byte [ebp+8]
   mov bl, byte [ebp+12]

   mov ax, 84B3h
   call far [_GRIP_Thunk+8]

   pop ebx
   pop ebp
RET

_GrGetMaxValue
   push ebp
   mov ebp, esp

   mov bh, byte [ebp+8]
   mov bl, byte [ebp+12]

   mov ax, 84B4h
   call far [_GRIP_Thunk+8]

   pop ebp
RET

_GrGetValue
   push ebp
   mov ebp, esp
   push ebx
   push ecx

   mov bh, byte [ebp+8]
   mov bl, byte [ebp+12]
   mov ch, byte [ebp+16]

   mov ax, 84C0h
   call far [_GRIP_Thunk+8]

   pop ecx
   pop ebx
   pop ebp
RET

_GrGetPackedValues
   push ebp
   mov ebp, esp
   push ebx
   push ecx

   mov bh, byte [ebp+8]
   mov bl, byte [ebp+12]
   mov ch, byte [ebp+16]
   mov cl, byte [ebp+20]

   mov ax, 84C1h
   call far [_GRIP_Thunk+8]

   pop ecx
   pop ebx
   pop ebp
RET

_GrSetValue
   push ebp
   mov ebp, esp
   push eax
   push ebx
   push ecx
   push edx

   mov bh, byte [ebp+8]
   mov bl, byte [ebp+12]
   mov ch, byte [ebp+16]
   mov dx, word [ebp+20]

   mov ax, 84C2h
   call far [_GRIP_Thunk+8]

   pop edx
   pop ecx
   pop ebx
   pop eax
   pop ebp
RET

_GrGetVendorName
   push ebp
   mov ebp, esp
   push esi
   push edi
   push eax
   push ebx
   push ecx
   push edx

   mov bh, byte [ebp+8]
   mov edi, dword [ebp+12]

   mov ax, 84D0h
   call dword far [_GRIP_Thunk+8]

   mov dword [edi+00h], ebx
   mov dword [edi+04h], ecx
   mov dword [edi+08h], edx
   mov dword [edi+0Ch], esi

   pop edx
   pop ecx
   pop ebx
   pop eax
   pop edi
   pop esi
   pop ebp
RET

_GrGetProductName
   push ebp
   mov ebp, esp
   push esi
   push edi
   push ebx
   push ecx
   push edx

   mov bh, byte [ebp+8]
   mov edi, dword [ebp+12]

   mov ax, 84D1h
   call far [_GRIP_Thunk+8]

   mov dword [edi+00h], ebx
   mov dword [edi+04h], ecx
   mov dword [edi+08h], edx
   mov dword [edi+0Ch], esi

   pop edx
   pop ecx
   pop ebx
   pop edi
   pop esi
   pop ebp
RET

_GrGetControlName
   push ebp
   mov ebp, esp
   push esi
   push edi
   push eax
   push ebx
   push ecx
   push edx

   mov bh, byte [ebp+8]
   mov bl, byte [ebp+12]
   mov ch, byte [ebp+16]
   mov edi, dword [ebp+20]

   mov ax, 84D2h
   call far [_GRIP_Thunk+8]

   mov dword [edi+00h], ebx
   mov dword [edi+04h], ecx
   mov dword [edi+08h], edx
   mov dword [edi+0Ch], esi

   pop edx
   pop ecx
   pop ebx
   pop eax
   pop edi
   pop esi
   pop ebp
RET

_GrGetCaps
   xor eax, eax
RET

_Gr__Link
   mov ax, 8490h
   call far [_GRIP_Thunk+8]
RET

_Gr__Unlink
	push eax
   mov ax, 8491h
   call far [_GRIP_Thunk+8]
	pop eax
RET

_GrGetSWVer
   mov ax, 84F0h
   call far [_GRIP_Thunk+8]
RET

_GrGetHWVer
   mov ax, 84F1h
   call far [_GRIP_Thunk+8]
RET

_GrGetDiagCnt
   mov ax, 84F2h
   call far [_GRIP_Thunk+8]
RET

_GrGetDiagReg
   push ebp
   mov ebp, esp
   push ebx

   mov bh, byte [ebp+8]

   mov ax, 84F3h
   call far [_GRIP_Thunk+8]

   pop ebx
   pop ebp
RET

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; These functions call the DPMI host to set access rights for the ;;
;; descriptor whose selector is sent as a parameter.               ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
_DPMI_SetCodeAR:
   push ebp
   mov ebp, esp
   push ebx
   push ecx
   pushf

   mov bx, word [ebp + 8]

   mov cx, cs
   lar ecx, ecx
   shr cx, 8
   mov eax, 09h
   int 31h
   setc al

   popf
	pop ecx
   pop ebx
   pop ebp
RET

_DPMI_SetDataAR:
   push ebp
   mov ebp, esp
   push ebx
   push ecx
   pushf

   mov bx, word [ebp + 8]

   mov cx, ds
   lar ecx, ecx
   shr cx, 8
   mov eax, 09h
   int 31h
   setc al

   popf
   pop ecx
   pop ebx
   pop ebp
RET