Rev 983 | Rev 1322 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 983 | Rev 1300 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;; VESA12.INC ;; |
6 | ;; VESA12.INC ;; |
7 | ;; ;; |
7 | ;; ;; |
8 | ;; Vesa 1.2 functions for MenuetOS ;; |
8 | ;; Vesa 1.2 functions for MenuetOS ;; |
9 | ;; ;; |
9 | ;; ;; |
10 | ;; Copyright 2002 Ville Turjanmaa ;; |
10 | ;; Copyright 2002 Ville Turjanmaa ;; |
11 | ;; ;; |
11 | ;; ;; |
12 | ;; quickcode@mail.ru - bankswitch for S3 cards ;; |
12 | ;; quickcode@mail.ru - bankswitch for S3 cards ;; |
13 | ;; ;; |
13 | ;; ;; |
14 | ;; See file COPYING for details ;; |
14 | ;; See file COPYING for details ;; |
15 | ;; ;; |
15 | ;; ;; |
16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
16 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
17 | 17 | ||
18 | $Revision: 983 $ |
18 | $Revision: 1300 $ |
19 | 19 | ||
20 | 20 | ||
21 | TRIDENT equ 0 |
21 | TRIDENT equ 0 |
22 | S3_VIDEO equ 0 |
22 | S3_VIDEO equ 0 |
23 | INTEL_VIDEO equ 0 |
23 | INTEL_VIDEO equ 0 |
24 | 24 | ||
25 | if TRIDENT |
25 | if TRIDENT |
26 | if S3_VIDEO or INTEL_VIDEO |
26 | if S3_VIDEO or INTEL_VIDEO |
27 | stop |
27 | stop |
28 | end if |
28 | end if |
29 | end if |
29 | end if |
30 | 30 | ||
31 | if S3_VIDEO |
31 | if S3_VIDEO |
32 | if TRIDENT or INTEL_VIDEO |
32 | if TRIDENT or INTEL_VIDEO |
33 | stop |
33 | stop |
34 | end if |
34 | end if |
35 | end if |
35 | end if |
36 | 36 | ||
37 | if INTEL_VIDEO |
37 | if INTEL_VIDEO |
38 | if S3_VIDEO or TRIDENT |
38 | if S3_VIDEO or TRIDENT |
39 | stop |
39 | stop |
40 | end if |
40 | end if |
41 | end if |
41 | end if |
42 | 42 | ||
43 | 43 | ||
44 | ; A complete video driver should include the following types of function |
44 | ; A complete video driver should include the following types of function |
45 | ; |
45 | ; |
46 | ; Putpixel |
46 | ; Putpixel |
47 | ; Getpixel |
47 | ; Getpixel |
48 | ; |
48 | ; |
49 | ; Drawimage |
49 | ; Drawimage |
50 | ; Drawbar |
50 | ; Drawbar |
51 | ; |
51 | ; |
52 | ; Drawbackground |
52 | ; Drawbackground |
53 | ; |
53 | ; |
54 | ; |
54 | ; |
55 | ; Modifying the set_bank -function is mostly enough |
55 | ; Modifying the set_bank -function is mostly enough |
56 | ; for different Vesa 1.2 setups. |
56 | ; for different Vesa 1.2 setups. |
57 | 57 | ||
58 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
58 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
59 | ; set_bank for Trident videocards, work on Trident 9440 |
59 | ; set_bank for Trident videocards, work on Trident 9440 |
60 | ; modified by Mario79 |
60 | ; modified by Mario79 |
61 | 61 | ||
62 | if TRIDENT |
62 | if TRIDENT |
63 | set_bank: |
63 | set_bank: |
64 | pushfd |
64 | pushfd |
65 | cli |
65 | cli |
66 | cmp al,[BANK_RW] |
66 | cmp al,[BANK_RW] |
67 | je .retsb |
67 | je .retsb |
68 | 68 | ||
69 | mov [BANK_RW],al |
69 | mov [BANK_RW],al |
70 | push dx |
70 | push dx |
71 | mov dx,3D8h |
71 | mov dx,3D8h |
72 | out dx,al |
72 | out dx,al |
73 | pop dx |
73 | pop dx |
74 | .retsb: |
74 | .retsb: |
75 | popfd |
75 | popfd |
76 | ret |
76 | ret |
77 | end if |
77 | end if |
78 | 78 | ||
79 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
79 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
80 | ; set_bank for S3 videocards, work on S3 ViRGE PCI (325) |
80 | ; set_bank for S3 videocards, work on S3 ViRGE PCI (325) |
81 | ; modified by kmeaw |
81 | ; modified by kmeaw |
82 | 82 | ||
83 | if S3_VIDEO |
83 | if S3_VIDEO |
84 | set_bank: |
84 | set_bank: |
85 | pushfd |
85 | pushfd |
86 | cli |
86 | cli |
87 | cmp al,[BANK_RW] |
87 | cmp al,[BANK_RW] |
88 | je .retsb |
88 | je .retsb |
89 | 89 | ||
90 | mov [BANK_RW],al |
90 | mov [BANK_RW],al |
91 | push ax |
91 | push ax |
92 | push dx |
92 | push dx |
93 | push cx |
93 | push cx |
94 | mov cl, al |
94 | mov cl, al |
95 | mov dx, 0x3D4 |
95 | mov dx, 0x3D4 |
96 | mov al, 0x38 |
96 | mov al, 0x38 |
97 | out dx, al ;CR38 Register Lock 1 ;Note: Traditionally 48h is used to |
97 | out dx, al ;CR38 Register Lock 1 ;Note: Traditionally 48h is used to |
98 | ;unlock and 00h to lock |
98 | ;unlock and 00h to lock |
99 | inc dx |
99 | inc dx |
100 | mov al, 0x48 |
100 | mov al, 0x48 |
101 | out dx, al ;3d5 -? |
101 | out dx, al ;3d5 -? |
102 | dec dx |
102 | dec dx |
103 | mov al, 0x31 |
103 | mov al, 0x31 |
104 | out dx, al ;CR31 Memory Configuration Register |
104 | out dx, al ;CR31 Memory Configuration Register |
105 | ;0 Enable Base Address Offset (CPUA BASE). Enables bank operation if set, ;disables if clear. |
105 | ;0 Enable Base Address Offset (CPUA BASE). Enables bank operation if set, ;disables if clear. |
106 | ;4-5 Bit 16-17 of the Display Start Address. For the 801/5,928 see index 51h, |
106 | ;4-5 Bit 16-17 of the Display Start Address. For the 801/5,928 see index 51h, |
107 | ;for the 864/964 see index 69h. |
107 | ;for the 864/964 see index 69h. |
108 | 108 | ||
109 | inc dx |
109 | inc dx |
110 | in al, dx |
110 | in al, dx |
111 | dec dx |
111 | dec dx |
112 | mov ah, al |
112 | mov ah, al |
113 | mov al, 0x31 |
113 | mov al, 0x31 |
114 | out dx, ax |
114 | out dx, ax |
115 | mov al, ah |
115 | mov al, ah |
116 | or al, 9 |
116 | or al, 9 |
117 | inc dx |
117 | inc dx |
118 | out dx, al |
118 | out dx, al |
119 | dec dx |
119 | dec dx |
120 | mov al, 0x35 |
120 | mov al, 0x35 |
121 | out dx, al ;CR35 CRT Register Lock |
121 | out dx, al ;CR35 CRT Register Lock |
122 | inc dx |
122 | inc dx |
123 | in al, dx |
123 | in al, dx |
124 | dec dx |
124 | dec dx |
125 | and al, 0xF0 |
125 | and al, 0xF0 |
126 | mov ch, cl |
126 | mov ch, cl |
127 | and ch, 0x0F |
127 | and ch, 0x0F |
128 | or ch, al |
128 | or ch, al |
129 | mov al, 0x35 |
129 | mov al, 0x35 |
130 | out dx, al |
130 | out dx, al |
131 | inc dx |
131 | inc dx |
132 | mov al, ch |
132 | mov al, ch |
133 | out dx, ax |
133 | out dx, ax |
134 | dec dx |
134 | dec dx |
135 | mov al, 0x51 ;Extended System Control 2 Register |
135 | mov al, 0x51 ;Extended System Control 2 Register |
136 | out dx, al |
136 | out dx, al |
137 | inc dx |
137 | inc dx |
138 | in al, dx |
138 | in al, dx |
139 | dec dx |
139 | dec dx |
140 | and al, 0xF3 |
140 | and al, 0xF3 |
141 | shr cl, 2 |
141 | shr cl, 2 |
142 | and cl, 0x0C |
142 | and cl, 0x0C |
143 | or cl, al |
143 | or cl, al |
144 | mov al, 0x51 |
144 | mov al, 0x51 |
145 | out dx, al |
145 | out dx, al |
146 | inc dx |
146 | inc dx |
147 | mov al, cl |
147 | mov al, cl |
148 | out dx, al |
148 | out dx, al |
149 | dec dx |
149 | dec dx |
150 | mov al, 0x38 |
150 | mov al, 0x38 |
151 | out dx, al |
151 | out dx, al |
152 | inc dx |
152 | inc dx |
153 | xor al, al |
153 | xor al, al |
154 | out dx, al |
154 | out dx, al |
155 | dec dx |
155 | dec dx |
156 | pop cx |
156 | pop cx |
157 | pop dx |
157 | pop dx |
158 | pop ax |
158 | pop ax |
159 | .retsb: |
159 | .retsb: |
160 | popfd |
160 | popfd |
161 | ret |
161 | ret |
162 | end if |
162 | end if |
163 | 163 | ||
164 | ;Set bank function for Intel 810/815 chipsets |
164 | ;Set bank function for Intel 810/815 chipsets |
165 | ; *****Modified by Protopopius, Russia.***** |
165 | ; *****Modified by Protopopius, Russia.***** |
166 | ; ********* http://menuetos.hut.ru ************** |
166 | ; ********* http://menuetos.hut.ru ************** |
167 | ; ************************************************ |
167 | ; ************************************************ |
168 | 168 | ||
169 | if INTEL_VIDEO |
169 | if INTEL_VIDEO |
170 | 170 | ||
171 | set_bank: |
171 | set_bank: |
172 | pushfd |
172 | pushfd |
173 | cli |
173 | cli |
174 | 174 | ||
175 | cmp al,[BANK_RW] |
175 | cmp al,[BANK_RW] |
176 | je .retsb |
176 | je .retsb |
177 | 177 | ||
178 | mov [BANK_RW],al |
178 | mov [BANK_RW],al |
179 | push ax |
179 | push ax |
180 | push dx |
180 | push dx |
181 | mov dx,3CEh |
181 | mov dx,3CEh |
182 | mov ah,al ; Save value for later use |
182 | mov ah,al ; Save value for later use |
183 | mov al,10h ; Index GR10 (Address Mapping) |
183 | mov al,10h ; Index GR10 (Address Mapping) |
184 | out dx,al ; Select GR10 |
184 | out dx,al ; Select GR10 |
185 | inc dl |
185 | inc dl |
186 | mov al,3 ; Set bits 0 and 1 (Enable linear page mapping) |
186 | mov al,3 ; Set bits 0 and 1 (Enable linear page mapping) |
187 | out dx,al ; Write value |
187 | out dx,al ; Write value |
188 | dec dl |
188 | dec dl |
189 | mov al,11h ; Index GR11 (Page Selector) |
189 | mov al,11h ; Index GR11 (Page Selector) |
190 | out dx,al ; Select GR11 |
190 | out dx,al ; Select GR11 |
191 | inc dl |
191 | inc dl |
192 | mov al,ah ; Write address |
192 | mov al,ah ; Write address |
193 | out dx,al ; Write the value |
193 | out dx,al ; Write the value |
194 | pop dx |
194 | pop dx |
195 | pop ax |
195 | pop ax |
196 | .retsb: |
196 | .retsb: |
197 | popfd |
197 | popfd |
198 | ret |
198 | ret |
199 | end if |
199 | end if |
200 | 200 | ||
201 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!} |
201 | ;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!} |
202 | 202 | ||
203 | if (TRIDENT or S3_VIDEO or INTEL_VIDEO) |
203 | if (TRIDENT or S3_VIDEO or INTEL_VIDEO) |
204 | else |
204 | else |
205 | set_bank: |
205 | set_bank: |
206 | pushfd |
206 | pushfd |
207 | cli |
207 | cli |
208 | 208 | ||
209 | cmp al,[BANK_RW] |
209 | cmp al,[BANK_RW] |
210 | je .retsb |
210 | je .retsb |
211 | 211 | ||
212 | mov [BANK_RW],al |
212 | mov [BANK_RW],al |
213 | push ax |
213 | push ax |
214 | push dx |
214 | push dx |
215 | mov ah,al |
215 | mov ah,al |
216 | mov dx,0x03D4 |
216 | mov dx,0x03D4 |
217 | mov al,0x39 |
217 | mov al,0x39 |
218 | out dx,al |
218 | out dx,al |
219 | inc dl |
219 | inc dl |
220 | mov al,0xA5 |
220 | mov al,0xA5 |
221 | out dx,al |
221 | out dx,al |
222 | dec dl |
222 | dec dl |
223 | mov al,6Ah |
223 | mov al,6Ah |
224 | out dx,al |
224 | out dx,al |
225 | inc dl |
225 | inc dl |
226 | mov al,ah |
226 | mov al,ah |
227 | out dx,al |
227 | out dx,al |
228 | dec dl |
228 | dec dl |
229 | mov al,0x39 |
229 | mov al,0x39 |
230 | out dx,al |
230 | out dx,al |
231 | inc dl |
231 | inc dl |
232 | mov al,0x5A |
232 | mov al,0x5A |
233 | out dx,al |
233 | out dx,al |
234 | dec dl |
234 | dec dl |
235 | pop dx |
235 | pop dx |
236 | pop ax |
236 | pop ax |
237 | 237 | ||
238 | .retsb: |
238 | .retsb: |
239 | popfd |
239 | popfd |
240 | ret |
240 | ret |
241 | end if |
241 | end if |
242 | 242 | ||
243 | vesa12_drawbackground: |
243 | vesa12_drawbackground: |
244 | 244 | ||
245 | call [disable_mouse] |
245 | call [_display.disable_mouse] |
246 | 246 | ||
247 | push eax |
247 | push eax |
248 | push ebx |
248 | push ebx |
249 | push ecx |
249 | push ecx |
250 | push edx |
250 | push edx |
251 | 251 | ||
252 | xor edx,edx |
252 | xor edx,edx |
253 | mov eax,dword[BgrDataWidth] |
253 | mov eax,dword[BgrDataWidth] |
254 | mov ebx,dword[BgrDataHeight] |
254 | mov ebx,dword[BgrDataHeight] |
255 | mul ebx |
255 | mul ebx |
256 | mov ebx,3 |
256 | mov ebx,3 |
257 | mul ebx |
257 | mul ebx |
258 | mov [imax],eax |
258 | mov [imax],eax |
259 | mov eax,[draw_data+32+RECT.left] |
259 | mov eax,[draw_data+32+RECT.left] |
260 | mov ebx,[draw_data+32+RECT.top] |
260 | mov ebx,[draw_data+32+RECT.top] |
261 | mov edi,0 ;no force |
261 | mov edi,0 ;no force |
262 | 262 | ||
263 | v12dp3: |
263 | v12dp3: |
264 | 264 | ||
265 | push eax |
265 | push eax |
266 | push ebx |
266 | push ebx |
267 | 267 | ||
268 | cmp [BgrDrawMode],dword 1 ; tiled background |
268 | cmp [BgrDrawMode],dword 1 ; tiled background |
269 | jne no_vesa12_tiled_bgr |
269 | jne no_vesa12_tiled_bgr |
270 | 270 | ||
271 | push edx |
271 | push edx |
272 | 272 | ||
273 | xor edx,edx |
273 | xor edx,edx |
274 | div dword [BgrDataWidth] |
274 | div dword [BgrDataWidth] |
275 | 275 | ||
276 | push edx |
276 | push edx |
277 | mov eax,ebx |
277 | mov eax,ebx |
278 | xor edx,edx |
278 | xor edx,edx |
279 | div dword [BgrDataHeight] |
279 | div dword [BgrDataHeight] |
280 | mov ebx,edx |
280 | mov ebx,edx |
281 | pop eax |
281 | pop eax |
282 | 282 | ||
283 | pop edx |
283 | pop edx |
284 | 284 | ||
285 | no_vesa12_tiled_bgr: |
285 | no_vesa12_tiled_bgr: |
286 | 286 | ||
287 | cmp [BgrDrawMode],dword 2 ; stretched background |
287 | cmp [BgrDrawMode],dword 2 ; stretched background |
288 | jne no_vesa12_stretched_bgr |
288 | jne no_vesa12_stretched_bgr |
289 | 289 | ||
290 | push edx |
290 | push edx |
291 | 291 | ||
292 | mul dword [BgrDataWidth] |
292 | mul dword [BgrDataWidth] |
293 | mov ecx,[Screen_Max_X] |
293 | mov ecx,[Screen_Max_X] |
294 | inc ecx |
294 | inc ecx |
295 | div ecx |
295 | div ecx |
296 | 296 | ||
297 | push eax |
297 | push eax |
298 | mov eax,ebx |
298 | mov eax,ebx |
299 | mul dword [BgrDataHeight] |
299 | mul dword [BgrDataHeight] |
300 | mov ecx,[Screen_Max_Y] |
300 | mov ecx,[Screen_Max_Y] |
301 | inc ecx |
301 | inc ecx |
302 | div ecx |
302 | div ecx |
303 | mov ebx,eax |
303 | mov ebx,eax |
304 | pop eax |
304 | pop eax |
305 | 305 | ||
306 | pop edx |
306 | pop edx |
307 | 307 | ||
308 | no_vesa12_stretched_bgr: |
308 | no_vesa12_stretched_bgr: |
309 | 309 | ||
310 | 310 | ||
311 | mov esi,ebx |
311 | mov esi,ebx |
312 | imul esi, dword [BgrDataWidth] |
312 | imul esi, dword [BgrDataWidth] |
313 | add esi,eax |
313 | add esi,eax |
314 | lea esi,[esi*3] |
314 | lea esi,[esi*3] |
315 | add esi,[img_background] ;IMG_BACKGROUND |
315 | add esi,[img_background] ;IMG_BACKGROUND |
316 | pop ebx |
316 | pop ebx |
317 | pop eax |
317 | pop eax |
318 | 318 | ||
319 | v12di4: |
319 | v12di4: |
320 | 320 | ||
321 | mov cl,[esi+2] |
321 | mov cl,[esi+2] |
322 | shl ecx,16 |
322 | shl ecx,16 |
323 | mov cx,[esi] |
323 | mov cx,[esi] |
324 | pusha |
324 | pusha |
325 | mov esi,eax |
325 | mov esi,eax |
326 | mov edi,ebx |
326 | mov edi,ebx |
327 | mov eax,[Screen_Max_X] |
327 | mov eax,[Screen_Max_X] |
328 | add eax,1 |
328 | add eax,1 |
329 | mul ebx |
329 | mul ebx |
- | 330 | add eax, [_WinMapAddress] |
|
330 | cmp [eax+esi+WinMapAddress],byte 1 |
331 | cmp [eax+esi],byte 1 |
331 | jnz v12nbgp |
332 | jnz v12nbgp |
332 | mov eax,[BytesPerScanLine] |
333 | mov eax,[BytesPerScanLine] |
333 | mov ebx,edi |
334 | mov ebx,edi |
334 | mul ebx |
335 | mul ebx |
335 | add eax, esi |
336 | add eax, esi |
336 | lea eax, [VGABasePtr+eax+esi*2] |
337 | lea eax, [VGABasePtr+eax+esi*2] |
337 | cmp [ScreenBPP],byte 24 |
338 | cmp [ScreenBPP],byte 24 |
338 | jz v12bgl3 |
339 | jz v12bgl3 |
339 | add eax,esi |
340 | add eax,esi |
340 | 341 | ||
341 | v12bgl3: |
342 | v12bgl3: |
342 | 343 | ||
343 | push ebx |
344 | push ebx |
344 | push eax |
345 | push eax |
345 | 346 | ||
346 | sub eax,VGABasePtr |
347 | sub eax,VGABasePtr |
347 | 348 | ||
348 | shr eax,16 |
349 | shr eax,16 |
349 | call set_bank |
350 | call set_bank |
350 | pop eax |
351 | pop eax |
351 | and eax,65535 |
352 | and eax,65535 |
352 | add eax,VGABasePtr |
353 | add eax,VGABasePtr |
353 | pop ebx |
354 | pop ebx |
354 | 355 | ||
355 | mov [eax],cx |
356 | mov [eax],cx |
356 | add eax,2 |
357 | add eax,2 |
357 | shr ecx,16 |
358 | shr ecx,16 |
358 | mov [eax],cl |
359 | mov [eax],cl |
359 | sti |
360 | sti |
360 | 361 | ||
361 | v12nbgp: |
362 | v12nbgp: |
362 | 363 | ||
363 | popa |
364 | popa |
364 | add esi,3 |
365 | add esi,3 |
365 | inc eax |
366 | inc eax |
366 | cmp eax,[draw_data+32+RECT.right] |
367 | cmp eax,[draw_data+32+RECT.right] |
367 | jg v12nodp31 |
368 | jg v12nodp31 |
368 | jmp v12dp3 |
369 | jmp v12dp3 |
369 | 370 | ||
370 | v12nodp31: |
371 | v12nodp31: |
371 | 372 | ||
372 | mov eax,[draw_data+32+RECT.left] |
373 | mov eax,[draw_data+32+RECT.left] |
373 | inc ebx |
374 | inc ebx |
374 | cmp ebx,[draw_data+32+RECT.bottom] |
375 | cmp ebx,[draw_data+32+RECT.bottom] |
375 | jg v12dp4 |
376 | jg v12dp4 |
376 | jmp v12dp3 |
377 | jmp v12dp3 |
377 | 378 | ||
378 | v12dp4: |
379 | v12dp4: |
379 | 380 | ||
380 | pop edx |
381 | pop edx |
381 | pop ecx |
382 | pop ecx |
382 | pop ebx |
383 | pop ebx |
383 | pop eax |
384 | pop eax |
384 | ret |
385 | ret |
385 | 386 | ||
386 | 387 | ||
387 | vesa12_drawbar: |
388 | vesa12_drawbar: |
388 | 389 | ||
389 | call [disable_mouse] |
390 | call [_display.disable_mouse] |
390 | 391 | ||
391 | ;; mov [novesachecksum],dword 0 |
392 | ;; mov [novesachecksum],dword 0 |
392 | sub edx,ebx |
393 | sub edx,ebx |
393 | sub ecx,eax |
394 | sub ecx,eax |
394 | push esi |
395 | push esi |
395 | push edi |
396 | push edi |
396 | push eax |
397 | push eax |
397 | push ebx |
398 | push ebx |
398 | push ecx |
399 | push ecx |
399 | push edx |
400 | push edx |
400 | mov ecx,[TASK_BASE] |
401 | mov ecx,[TASK_BASE] |
401 | add eax,[ecx-twdw+WDATA.box.left] |
402 | add eax,[ecx-twdw+WDATA.box.left] |
402 | add ebx,[ecx-twdw+WDATA.box.top] |
403 | add ebx,[ecx-twdw+WDATA.box.top] |
403 | push eax |
404 | push eax |
404 | mov eax,ebx ; y |
405 | mov eax,ebx ; y |
405 | mov ebx,[BytesPerScanLine] |
406 | mov ebx,[BytesPerScanLine] |
406 | mul ebx |
407 | mul ebx |
407 | pop ecx |
408 | pop ecx |
408 | add eax,ecx ; x |
409 | add eax,ecx ; x |
409 | add eax,ecx |
410 | add eax,ecx |
410 | add eax,ecx |
411 | add eax,ecx |
411 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start |
412 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start |
412 | jz dbpi2412 |
413 | jz dbpi2412 |
413 | add eax,ecx |
414 | add eax,ecx |
414 | 415 | ||
415 | dbpi2412: |
416 | dbpi2412: |
416 | 417 | ||
417 | add eax,VGABasePtr |
418 | add eax,VGABasePtr |
418 | mov edi,eax |
419 | mov edi,eax |
419 | 420 | ||
420 | ; x size |
421 | ; x size |
421 | 422 | ||
422 | mov eax,[esp+4] ; [esp+6] |
423 | mov eax,[esp+4] ; [esp+6] |
423 | mov ecx,eax |
424 | mov ecx,eax |
424 | add ecx,eax |
425 | add ecx,eax |
425 | add ecx,eax |
426 | add ecx,eax |
426 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
427 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
427 | jz dbpi24312 |
428 | jz dbpi24312 |
428 | add ecx,eax |
429 | add ecx,eax |
429 | 430 | ||
430 | dbpi24312: |
431 | dbpi24312: |
431 | 432 | ||
432 | mov ebx,[esp+0] |
433 | mov ebx,[esp+0] |
433 | 434 | ||
434 | ; check limits ? |
435 | ; check limits ? |
435 | 436 | ||
436 | push eax |
437 | push eax |
437 | push ecx |
438 | push ecx |
438 | mov eax,[TASK_BASE] |
439 | mov eax,[TASK_BASE] |
439 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.left] |
440 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.left] |
440 | cmp ecx,0 |
441 | cmp ecx,0 |
441 | jnz dbcblimitlset12 |
442 | jnz dbcblimitlset12 |
442 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.top] |
443 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.top] |
443 | cmp ecx,0 |
444 | cmp ecx,0 |
444 | jnz dbcblimitlset12 |
445 | jnz dbcblimitlset12 |
445 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] |
446 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] |
446 | cmp ecx,[Screen_Max_X] |
447 | cmp ecx,[Screen_Max_X] |
447 | jnz dbcblimitlset12 |
448 | jnz dbcblimitlset12 |
448 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] |
449 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] |
449 | cmp ecx,[Screen_Max_Y] |
450 | cmp ecx,[Screen_Max_Y] |
450 | jnz dbcblimitlset12 |
451 | jnz dbcblimitlset12 |
451 | pop ecx |
452 | pop ecx |
452 | pop eax |
453 | pop eax |
453 | push dword 0 |
454 | push dword 0 |
454 | jmp dbcblimitlno12 |
455 | jmp dbcblimitlno12 |
455 | 456 | ||
456 | dbcblimitlset12: |
457 | dbcblimitlset12: |
457 | 458 | ||
458 | pop ecx |
459 | pop ecx |
459 | pop eax |
460 | pop eax |
460 | push dword 1 |
461 | push dword 1 |
461 | 462 | ||
462 | dbcblimitlno12: |
463 | dbcblimitlno12: |
463 | 464 | ||
464 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
465 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
465 | jz dbpi24bit12 |
466 | jz dbpi24bit12 |
466 | jmp dbpi32bit12 |
467 | jmp dbpi32bit12 |
467 | 468 | ||
468 | 469 | ||
469 | ; DRAWBAR 24 BBP |
470 | ; DRAWBAR 24 BBP |
470 | 471 | ||
471 | 472 | ||
472 | dbpi24bit12: |
473 | dbpi24bit12: |
473 | 474 | ||
474 | push eax |
475 | push eax |
475 | push ebx |
476 | push ebx |
476 | push edx |
477 | push edx |
477 | mov eax,ecx |
478 | mov eax,ecx |
478 | mov ebx,3 |
479 | mov ebx,3 |
479 | div ebx |
480 | div ebx |
480 | mov ecx,eax |
481 | mov ecx,eax |
481 | pop edx |
482 | pop edx |
482 | pop ebx |
483 | pop ebx |
483 | pop eax |
484 | pop eax |
484 | cld |
485 | cld |
485 | 486 | ||
486 | dbnewpi12: |
487 | dbnewpi12: |
487 | 488 | ||
488 | push ebx |
489 | push ebx |
489 | push edi |
490 | push edi |
490 | push ecx |
491 | push ecx |
491 | 492 | ||
492 | xor edx,edx |
493 | xor edx,edx |
493 | mov eax,edi |
494 | mov eax,edi |
494 | sub eax,VGABasePtr |
495 | sub eax,VGABasePtr |
495 | mov ebx,3 |
496 | mov ebx,3 |
496 | div ebx |
497 | div ebx |
497 | add eax,WinMapAddress |
498 | add eax, [_WinMapAddress] |
498 | mov ebx,[CURRENT_TASK] |
499 | mov ebx,[CURRENT_TASK] |
499 | cld |
500 | cld |
500 | 501 | ||
501 | dbnp2412: |
502 | dbnp2412: |
502 | 503 | ||
503 | mov dl,[eax] |
504 | mov dl,[eax] |
504 | push eax |
505 | push eax |
505 | push ecx |
506 | push ecx |
506 | cmp dl,bl |
507 | cmp dl,bl |
507 | jnz dbimp24no12 |
508 | jnz dbimp24no12 |
508 | cmp [esp+5*4],dword 0 |
509 | cmp [esp+5*4],dword 0 |
509 | jz dbimp24yes12 |
510 | jz dbimp24yes12 |
510 | ; call dbcplimit |
511 | ; call dbcplimit |
511 | ; jnz dbimp24no12 |
512 | ; jnz dbimp24no12 |
512 | 513 | ||
513 | dbimp24yes12: |
514 | dbimp24yes12: |
514 | 515 | ||
515 | push edi |
516 | push edi |
516 | mov eax,edi |
517 | mov eax,edi |
517 | sub eax,VGABasePtr |
518 | sub eax,VGABasePtr |
518 | shr eax,16 |
519 | shr eax,16 |
519 | call set_bank |
520 | call set_bank |
520 | and edi,0xffff |
521 | and edi,0xffff |
521 | add edi,VGABasePtr |
522 | add edi,VGABasePtr |
522 | mov eax,[esp+8+3*4+16+4+4] |
523 | mov eax,[esp+8+3*4+16+4+4] |
523 | stosw |
524 | stosw |
524 | shr eax,16 |
525 | shr eax,16 |
525 | stosb |
526 | stosb |
526 | sti |
527 | sti |
527 | pop edi |
528 | pop edi |
528 | add edi,3 |
529 | add edi,3 |
529 | pop ecx |
530 | pop ecx |
530 | pop eax |
531 | pop eax |
531 | inc eax |
532 | inc eax |
532 | loop dbnp2412 |
533 | loop dbnp2412 |
533 | jmp dbnp24d12 |
534 | jmp dbnp24d12 |
534 | 535 | ||
535 | dbimp24no12: |
536 | dbimp24no12: |
536 | 537 | ||
537 | pop ecx |
538 | pop ecx |
538 | pop eax |
539 | pop eax |
539 | cld |
540 | cld |
540 | add edi,3 |
541 | add edi,3 |
541 | inc eax |
542 | inc eax |
542 | loop dbnp2412 |
543 | loop dbnp2412 |
543 | 544 | ||
544 | dbnp24d12: |
545 | dbnp24d12: |
545 | 546 | ||
546 | mov eax,[esp+3*4+16+4] |
547 | mov eax,[esp+3*4+16+4] |
547 | test eax,0x80000000 |
548 | test eax,0x80000000 |
548 | jz nodbgl2412 |
549 | jz nodbgl2412 |
549 | cmp al,0 |
550 | cmp al,0 |
550 | jz nodbgl2412 |
551 | jz nodbgl2412 |
551 | dec eax |
552 | dec eax |
552 | mov [esp+3*4+16+4],eax |
553 | mov [esp+3*4+16+4],eax |
553 | 554 | ||
554 | nodbgl2412: |
555 | nodbgl2412: |
555 | 556 | ||
556 | pop ecx |
557 | pop ecx |
557 | pop edi |
558 | pop edi |
558 | pop ebx |
559 | pop ebx |
559 | add edi,[BytesPerScanLine] |
560 | add edi,[BytesPerScanLine] |
560 | dec ebx |
561 | dec ebx |
561 | jz dbnonewpi12 |
562 | jz dbnonewpi12 |
562 | jmp dbnewpi12 |
563 | jmp dbnewpi12 |
563 | 564 | ||
564 | dbnonewpi12: |
565 | dbnonewpi12: |
565 | 566 | ||
566 | add esp,7*4 |
567 | add esp,7*4 |
567 | 568 | ||
568 | ret |
569 | ret |
569 | 570 | ||
570 | 571 | ||
571 | ; DRAWBAR 32 BBP |
572 | ; DRAWBAR 32 BBP |
572 | 573 | ||
573 | 574 | ||
574 | dbpi32bit12: |
575 | dbpi32bit12: |
575 | 576 | ||
576 | cld |
577 | cld |
577 | shr ecx,2 |
578 | shr ecx,2 |
578 | 579 | ||
579 | dbnewpi3212: |
580 | dbnewpi3212: |
580 | 581 | ||
581 | push ebx |
582 | push ebx |
582 | push edi |
583 | push edi |
583 | push ecx |
584 | push ecx |
584 | 585 | ||
585 | mov eax,edi |
586 | mov eax,edi |
586 | sub eax,VGABasePtr |
587 | sub eax,VGABasePtr |
587 | shr eax,2 |
588 | shr eax,2 |
588 | add eax,WinMapAddress |
589 | add eax, [_WinMapAddress] |
589 | mov ebx,[CURRENT_TASK] |
590 | mov ebx,[CURRENT_TASK] |
590 | cld |
591 | cld |
591 | 592 | ||
592 | dbnp3212: |
593 | dbnp3212: |
593 | 594 | ||
594 | mov dl,[eax] |
595 | mov dl,[eax] |
595 | push eax |
596 | push eax |
596 | push ecx |
597 | push ecx |
597 | cmp dl,bl |
598 | cmp dl,bl |
598 | jnz dbimp32no12 |
599 | jnz dbimp32no12 |
599 | cmp [esp+5*4],dword 0 |
600 | cmp [esp+5*4],dword 0 |
600 | jz dbimp32yes12 |
601 | jz dbimp32yes12 |
601 | ; call dbcplimit |
602 | ; call dbcplimit |
602 | ; jnz dbimp32no12 |
603 | ; jnz dbimp32no12 |
603 | 604 | ||
604 | dbimp32yes12: |
605 | dbimp32yes12: |
605 | 606 | ||
606 | push edi |
607 | push edi |
607 | mov eax,edi |
608 | mov eax,edi |
608 | sub eax,VGABasePtr |
609 | sub eax,VGABasePtr |
609 | shr eax,16 |
610 | shr eax,16 |
610 | call set_bank |
611 | call set_bank |
611 | and edi,0xffff |
612 | and edi,0xffff |
612 | add edi,VGABasePtr |
613 | add edi,VGABasePtr |
613 | mov eax,[esp+8+3*4+16+4+4] |
614 | mov eax,[esp+8+3*4+16+4+4] |
614 | stosw |
615 | stosw |
615 | shr eax,16 |
616 | shr eax,16 |
616 | stosb |
617 | stosb |
617 | sti |
618 | sti |
618 | pop edi |
619 | pop edi |
619 | add edi,4 |
620 | add edi,4 |
620 | inc ebp |
621 | inc ebp |
621 | pop ecx |
622 | pop ecx |
622 | pop eax |
623 | pop eax |
623 | inc eax |
624 | inc eax |
624 | loop dbnp3212 |
625 | loop dbnp3212 |
625 | jmp dbnp32d12 |
626 | jmp dbnp32d12 |
626 | 627 | ||
627 | dbimp32no12: |
628 | dbimp32no12: |
628 | 629 | ||
629 | pop ecx |
630 | pop ecx |
630 | pop eax |
631 | pop eax |
631 | inc eax |
632 | inc eax |
632 | add edi,4 |
633 | add edi,4 |
633 | inc ebp |
634 | inc ebp |
634 | loop dbnp3212 |
635 | loop dbnp3212 |
635 | 636 | ||
636 | dbnp32d12: |
637 | dbnp32d12: |
637 | 638 | ||
638 | mov eax,[esp+12+16+4] |
639 | mov eax,[esp+12+16+4] |
639 | test eax,0x80000000 |
640 | test eax,0x80000000 |
640 | jz nodbgl3212 |
641 | jz nodbgl3212 |
641 | cmp al,0 |
642 | cmp al,0 |
642 | jz nodbgl3212 |
643 | jz nodbgl3212 |
643 | dec eax |
644 | dec eax |
644 | mov [esp+12+16+4],eax |
645 | mov [esp+12+16+4],eax |
645 | 646 | ||
646 | nodbgl3212: |
647 | nodbgl3212: |
647 | 648 | ||
648 | pop ecx |
649 | pop ecx |
649 | pop edi |
650 | pop edi |
650 | pop ebx |
651 | pop ebx |
651 | add edi,[BytesPerScanLine] |
652 | add edi,[BytesPerScanLine] |
652 | dec ebx |
653 | dec ebx |
653 | jz nodbnewpi3212 |
654 | jz nodbnewpi3212 |
654 | jmp dbnewpi3212 |
655 | jmp dbnewpi3212 |
655 | 656 | ||
656 | nodbnewpi3212: |
657 | nodbnewpi3212: |
657 | 658 | ||
658 | add esp,7*4 |
659 | add esp,7*4 |
659 | ret |
660 | ret |
660 | 661 | ||
661 | 662 | ||
662 | Vesa12_putpixel24: |
663 | Vesa12_putpixel24: |
663 | 664 | ||
664 | mov edi,eax ; x |
665 | mov edi,eax ; x |
665 | mov eax,ebx ; y |
666 | mov eax,ebx ; y |
666 | lea edi,[edi+edi*2] |
667 | lea edi,[edi+edi*2] |
667 | mov ebx,[BytesPerScanLine] |
668 | mov ebx,[BytesPerScanLine] |
668 | mul ebx |
669 | mul ebx |
669 | add edi,eax |
670 | add edi,eax |
670 | mov eax,edi |
671 | mov eax,edi |
671 | shr eax,16 |
672 | shr eax,16 |
672 | call set_bank |
673 | call set_bank |
673 | and edi,65535 |
674 | and edi,65535 |
674 | add edi,VGABasePtr |
675 | add edi,VGABasePtr |
675 | mov eax,[esp+28] |
676 | mov eax,[esp+28] |
676 | stosw |
677 | stosw |
677 | shr eax,16 |
678 | shr eax,16 |
678 | mov [edi],al |
679 | mov [edi],al |
679 | sti |
680 | sti |
680 | ret |
681 | ret |
681 | 682 | ||
682 | 683 | ||
683 | 684 | ||
684 | Vesa12_putpixel32: |
685 | Vesa12_putpixel32: |
685 | 686 | ||
686 | mov edi,eax ; x |
687 | mov edi,eax ; x |
687 | mov eax,ebx ; y |
688 | mov eax,ebx ; y |
688 | shl edi,2 |
689 | shl edi,2 |
689 | mov ebx,[BytesPerScanLine] |
690 | mov ebx,[BytesPerScanLine] |
690 | mul ebx |
691 | mul ebx |
691 | add edi,eax |
692 | add edi,eax |
692 | mov eax,edi |
693 | mov eax,edi |
693 | shr eax,16 |
694 | shr eax,16 |
694 | call set_bank |
695 | call set_bank |
695 | and edi,65535 |
696 | and edi,65535 |
696 | add edi,VGABasePtr |
697 | add edi,VGABasePtr |
697 | mov ecx,[esp+28] |
698 | mov ecx,[esp+28] |
698 | mov [edi],ecx |
699 | mov [edi],ecx |
699 | sti |
700 | sti |
700 | ret |
701 | ret |
701 | 702 | ||
702 | 703 | ||
703 | Vesa12_getpixel24: |
704 | Vesa12_getpixel24: |
704 | 705 | ||
705 | mov edi,eax ; x |
706 | mov edi,eax ; x |
706 | mov eax,ebx ; y |
707 | mov eax,ebx ; y |
707 | lea edi,[edi+edi*2] |
708 | lea edi,[edi+edi*2] |
708 | mov ebx,[BytesPerScanLine] |
709 | mov ebx,[BytesPerScanLine] |
709 | mul ebx |
710 | mul ebx |
710 | add edi,eax |
711 | add edi,eax |
711 | mov eax,edi |
712 | mov eax,edi |
712 | shr eax,16 |
713 | shr eax,16 |
713 | call set_bank |
714 | call set_bank |
714 | and edi,65535 |
715 | and edi,65535 |
715 | add edi,VGABasePtr |
716 | add edi,VGABasePtr |
716 | mov ecx,[edi] |
717 | mov ecx,[edi] |
717 | and ecx,255*256*256+255*256+255 |
718 | and ecx,255*256*256+255*256+255 |
718 | sti |
719 | sti |
719 | ret |
720 | ret |
720 | 721 | ||
721 | 722 | ||
722 | Vesa12_getpixel32: |
723 | Vesa12_getpixel32: |
723 | 724 | ||
724 | mov edi,eax ; x |
725 | mov edi,eax ; x |
725 | mov eax,ebx ; y |
726 | mov eax,ebx ; y |
726 | shl edi,2 |
727 | shl edi,2 |
727 | mov ebx,[BytesPerScanLine] |
728 | mov ebx,[BytesPerScanLine] |
728 | xor edx,edx |
729 | xor edx,edx |
729 | mul ebx |
730 | mul ebx |
730 | add edi,eax |
731 | add edi,eax |
731 | mov eax,edi |
732 | mov eax,edi |
732 | shr eax,16 |
733 | shr eax,16 |
733 | call set_bank |
734 | call set_bank |
734 | and edi,65535 |
735 | and edi,65535 |
735 | add edi,VGABasePtr |
736 | add edi,VGABasePtr |
736 | mov ecx,[edi] |
737 | mov ecx,[edi] |
737 | and ecx,255*256*256+255*256+255 |
738 | and ecx,255*256*256+255*256+255 |
738 | sti |
739 | sti |
739 | 740 | ||
740 | ret |
741 | ret |
741 | 742 | ||
742 | 743 | ||
743 | 744 | ||
744 | vesa12_putimage: |
745 | vesa12_putimage: |
745 | ; ebx = pointer to image |
746 | ; ebx = pointer to image |
746 | ; ecx = size [x|y] |
747 | ; ecx = size [x|y] |
747 | ; edx = coordinates [x|y] |
748 | ; edx = coordinates [x|y] |
748 | ; ebp = pointer to 'get' function |
749 | ; ebp = pointer to 'get' function |
749 | ; esi = pointer to 'init' function |
750 | ; esi = pointer to 'init' function |
750 | ; edi = parameter for 'get' function |
751 | ; edi = parameter for 'get' function |
751 | 752 | ||
752 | ; mov ebx,image |
753 | ; mov ebx,image |
753 | ; mov ecx,320*65536+240 |
754 | ; mov ecx,320*65536+240 |
754 | ; mov edx,20*65536+20 |
755 | ; mov edx,20*65536+20 |
755 | 756 | ||
756 | call [disable_mouse] |
757 | call [_display.disable_mouse] |
757 | 758 | ||
758 | mov [novesachecksum],dword 0 |
759 | mov [novesachecksum],dword 0 |
759 | push esi |
760 | push esi |
760 | push edi |
761 | push edi |
761 | push eax |
762 | push eax |
762 | push ebx |
763 | push ebx |
763 | push ecx |
764 | push ecx |
764 | push edx |
765 | push edx |
765 | movzx eax,word [esp+2] |
766 | movzx eax,word [esp+2] |
766 | movzx ebx,word [esp+0] |
767 | movzx ebx,word [esp+0] |
767 | mov ecx,[TASK_BASE] |
768 | mov ecx,[TASK_BASE] |
768 | add eax,[ecx-twdw+WDATA.box.left] |
769 | add eax,[ecx-twdw+WDATA.box.left] |
769 | add ebx,[ecx-twdw+WDATA.box.top] |
770 | add ebx,[ecx-twdw+WDATA.box.top] |
770 | push eax |
771 | push eax |
771 | mov eax,ebx ; y |
772 | mov eax,ebx ; y |
772 | mul dword [BytesPerScanLine] |
773 | mul dword [BytesPerScanLine] |
773 | pop ecx |
774 | pop ecx |
774 | add eax,ecx ; x |
775 | add eax,ecx ; x |
775 | add eax,ecx |
776 | add eax,ecx |
776 | add eax,ecx |
777 | add eax,ecx |
777 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start |
778 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x start |
778 | jz pi2412 |
779 | jz pi2412 |
779 | add eax,ecx |
780 | add eax,ecx |
780 | 781 | ||
781 | pi2412: |
782 | pi2412: |
782 | 783 | ||
783 | add eax,VGABasePtr |
784 | add eax,VGABasePtr |
784 | mov edi,eax |
785 | mov edi,eax |
785 | 786 | ||
786 | ; x size |
787 | ; x size |
787 | 788 | ||
788 | movzx ecx,word [esp+6] |
789 | movzx ecx,word [esp+6] |
789 | 790 | ||
790 | mov esi,[esp+8] |
791 | mov esi,[esp+8] |
791 | movzx ebx,word [esp+4] |
792 | movzx ebx,word [esp+4] |
792 | 793 | ||
793 | ; check limits while draw ? |
794 | ; check limits while draw ? |
794 | 795 | ||
795 | push ecx |
796 | push ecx |
796 | mov eax,[TASK_BASE] |
797 | mov eax,[TASK_BASE] |
797 | cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 |
798 | cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 |
798 | jnz dbcblimitlset212 |
799 | jnz dbcblimitlset212 |
799 | cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 |
800 | cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 |
800 | jnz dbcblimitlset212 |
801 | jnz dbcblimitlset212 |
801 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] |
802 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] |
802 | cmp ecx,[Screen_Max_X] |
803 | cmp ecx,[Screen_Max_X] |
803 | jnz dbcblimitlset212 |
804 | jnz dbcblimitlset212 |
804 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] |
805 | mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] |
805 | cmp ecx,[Screen_Max_Y] |
806 | cmp ecx,[Screen_Max_Y] |
806 | jnz dbcblimitlset212 |
807 | jnz dbcblimitlset212 |
807 | pop ecx |
808 | pop ecx |
808 | push 0 |
809 | push 0 |
809 | jmp dbcblimitlno212 |
810 | jmp dbcblimitlno212 |
810 | 811 | ||
811 | dbcblimitlset212: |
812 | dbcblimitlset212: |
812 | 813 | ||
813 | pop ecx |
814 | pop ecx |
814 | push 1 |
815 | push 1 |
815 | 816 | ||
816 | dbcblimitlno212: |
817 | dbcblimitlno212: |
817 | 818 | ||
818 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
819 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
819 | jnz pi32bit12 |
820 | jnz pi32bit12 |
820 | 821 | ||
821 | pi24bit12: |
822 | pi24bit12: |
822 | 823 | ||
823 | newpi12: |
824 | newpi12: |
824 | 825 | ||
825 | push edi |
826 | push edi |
826 | push ecx |
827 | push ecx |
827 | push ebx |
828 | push ebx |
828 | 829 | ||
829 | mov edx,edi |
830 | mov edx,edi |
830 | sub edx,VGABasePtr |
831 | sub edx,VGABasePtr |
831 | mov ebx,3 |
832 | mov ebx,3 |
832 | div ebx |
833 | div ebx |
833 | add edx,WinMapAddress |
834 | add edx, [_WinMapAddress] |
834 | mov ebx,[CURRENT_TASK] |
835 | mov ebx,[CURRENT_TASK] |
835 | mov bh,[esp+4*3] |
836 | mov bh,[esp+4*3] |
836 | 837 | ||
837 | np2412: |
838 | np2412: |
838 | 839 | ||
839 | cmp bl,[edx] |
840 | cmp bl,[edx] |
840 | jnz imp24no12 |
841 | jnz imp24no12 |
841 | ; mov eax,[esi] |
842 | ; mov eax,[esi] |
842 | push dword [esp+4*3+20] |
843 | push dword [esp+4*3+20] |
843 | call ebp |
844 | call ebp |
844 | ; cmp bh,0 |
845 | ; cmp bh,0 |
845 | ; jz imp24yes12 |
846 | ; jz imp24yes12 |
846 | ; call dbcplimit |
847 | ; call dbcplimit |
847 | ; jnz imp24no12 |
848 | ; jnz imp24no12 |
848 | 849 | ||
849 | imp24yes12: |
850 | imp24yes12: |
850 | 851 | ||
851 | push edi |
852 | push edi |
852 | push eax |
853 | push eax |
853 | mov eax,edi |
854 | mov eax,edi |
854 | sub eax,VGABasePtr |
855 | sub eax,VGABasePtr |
855 | shr eax,16 |
856 | shr eax,16 |
856 | call set_bank |
857 | call set_bank |
857 | pop eax |
858 | pop eax |
858 | and edi,0xffff |
859 | and edi,0xffff |
859 | add edi,VGABasePtr |
860 | add edi,VGABasePtr |
860 | mov [edi],ax |
861 | mov [edi],ax |
861 | shr eax,16 |
862 | shr eax,16 |
862 | mov [edi+2],al |
863 | mov [edi+2],al |
863 | pop edi |
864 | pop edi |
864 | 865 | ||
865 | imp24no12: |
866 | imp24no12: |
866 | 867 | ||
867 | inc edx |
868 | inc edx |
868 | ; add esi,3 |
869 | ; add esi,3 |
869 | add edi,3 |
870 | add edi,3 |
870 | dec ecx |
871 | dec ecx |
871 | jnz np2412 |
872 | jnz np2412 |
872 | 873 | ||
873 | np24d12: |
874 | np24d12: |
874 | 875 | ||
875 | pop ebx |
876 | pop ebx |
876 | pop ecx |
877 | pop ecx |
877 | pop edi |
878 | pop edi |
878 | 879 | ||
879 | add edi,[BytesPerScanLine] |
880 | add edi,[BytesPerScanLine] |
880 | add esi,[esp+32] |
881 | add esi,[esp+32] |
881 | cmp ebp,putimage_get1bpp |
882 | cmp ebp,putimage_get1bpp |
882 | jz .correct |
883 | jz .correct |
883 | cmp ebp,putimage_get2bpp |
884 | cmp ebp,putimage_get2bpp |
884 | jz .correct |
885 | jz .correct |
885 | cmp ebp,putimage_get4bpp |
886 | cmp ebp,putimage_get4bpp |
886 | jnz @f |
887 | jnz @f |
887 | .correct: |
888 | .correct: |
888 | mov eax,[esp+20] |
889 | mov eax,[esp+20] |
889 | mov byte[eax],80h |
890 | mov byte[eax],80h |
890 | @@: |
891 | @@: |
891 | dec ebx |
892 | dec ebx |
892 | jnz newpi12 |
893 | jnz newpi12 |
893 | 894 | ||
894 | nonewpi12: |
895 | nonewpi12: |
895 | 896 | ||
896 | pop eax edx ecx ebx eax edi esi |
897 | pop eax edx ecx ebx eax edi esi |
897 | xor eax, eax |
898 | xor eax, eax |
898 | ret |
899 | ret |
899 | 900 | ||
900 | 901 | ||
901 | pi32bit12: |
902 | pi32bit12: |
902 | 903 | ||
903 | newpi3212: |
904 | newpi3212: |
904 | 905 | ||
905 | push edi |
906 | push edi |
906 | push ecx |
907 | push ecx |
907 | push ebx |
908 | push ebx |
908 | 909 | ||
909 | mov edx,edi |
910 | mov edx,edi |
910 | sub edx,VGABasePtr |
911 | sub edx,VGABasePtr |
911 | shr edx,2 |
912 | shr edx,2 |
912 | add edx,WinMapAddress |
913 | add edx, [_WinMapAddress] |
913 | mov ebx,[CURRENT_TASK] |
914 | mov ebx,[CURRENT_TASK] |
914 | mov bh,[esp+4*3] |
915 | mov bh,[esp+4*3] |
915 | 916 | ||
916 | np3212: |
917 | np3212: |
917 | 918 | ||
918 | cmp bl,[edx] |
919 | cmp bl,[edx] |
919 | jnz imp32no12 |
920 | jnz imp32no12 |
920 | ; mov eax,[esi] |
921 | ; mov eax,[esi] |
921 | push dword [esp+4*3+20] |
922 | push dword [esp+4*3+20] |
922 | call ebp |
923 | call ebp |
923 | ; cmp bh,0 |
924 | ; cmp bh,0 |
924 | ; jz imp32yes12 |
925 | ; jz imp32yes12 |
925 | ; call dbcplimit |
926 | ; call dbcplimit |
926 | ; jnz imp32no12 |
927 | ; jnz imp32no12 |
927 | 928 | ||
928 | imp32yes12: |
929 | imp32yes12: |
929 | 930 | ||
930 | push edi |
931 | push edi |
931 | push eax |
932 | push eax |
932 | mov eax,edi |
933 | mov eax,edi |
933 | sub eax,VGABasePtr |
934 | sub eax,VGABasePtr |
934 | shr eax,16 |
935 | shr eax,16 |
935 | call set_bank |
936 | call set_bank |
936 | pop eax |
937 | pop eax |
937 | and edi,0xffff |
938 | and edi,0xffff |
938 | mov [edi+VGABasePtr],eax |
939 | mov [edi+VGABasePtr],eax |
939 | pop edi |
940 | pop edi |
940 | 941 | ||
941 | imp32no12: |
942 | imp32no12: |
942 | 943 | ||
943 | inc edx |
944 | inc edx |
944 | ; add esi,3 |
945 | ; add esi,3 |
945 | add edi,4 |
946 | add edi,4 |
946 | dec ecx |
947 | dec ecx |
947 | jnz np3212 |
948 | jnz np3212 |
948 | 949 | ||
949 | np32d12: |
950 | np32d12: |
950 | 951 | ||
951 | pop ebx |
952 | pop ebx |
952 | pop ecx |
953 | pop ecx |
953 | pop edi |
954 | pop edi |
954 | 955 | ||
955 | add edi,[BytesPerScanLine] |
956 | add edi,[BytesPerScanLine] |
956 | cmp ebp,putimage_get1bpp |
957 | cmp ebp,putimage_get1bpp |
957 | jz .correct |
958 | jz .correct |
958 | cmp ebp,putimage_get2bpp |
959 | cmp ebp,putimage_get2bpp |
959 | jz .correct |
960 | jz .correct |
960 | cmp ebp,putimage_get4bpp |
961 | cmp ebp,putimage_get4bpp |
961 | jnz @f |
962 | jnz @f |
962 | .correct: |
963 | .correct: |
963 | mov eax,[esp+20] |
964 | mov eax,[esp+20] |
964 | mov byte[eax],80h |
965 | mov byte[eax],80h |
965 | @@: |
966 | @@: |
966 | dec ebx |
967 | dec ebx |
967 | jnz newpi3212 |
968 | jnz newpi3212 |
968 | 969 | ||
969 | nonewpi3212: |
970 | nonewpi3212: |
970 | 971 | ||
971 | pop eax edx ecx ebx eax edi esi |
972 | pop eax edx ecx ebx eax edi esi |
972 | xor eax, eax |
973 | xor eax, eax |
973 | ret |
974 | ret |
974 | 975 | ||
975 | 976 | ||
976 | vesa12_read_screen_pixel: |
977 | vesa12_read_screen_pixel: |
977 | 978 | ||
978 | and eax,0x3FFFFF |
979 | and eax,0x3FFFFF |
979 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
980 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? |
980 | jz v12rsp24 |
981 | jz v12rsp24 |
981 | mov edi,eax |
982 | mov edi,eax |
982 | shl edi,2 |
983 | shl edi,2 |
983 | mov eax,edi |
984 | mov eax,edi |
984 | shr eax,16 |
985 | shr eax,16 |
985 | call set_bank |
986 | call set_bank |
986 | and edi,65535 |
987 | and edi,65535 |
987 | add edi,VGABasePtr |
988 | add edi,VGABasePtr |
988 | mov eax,[edi] |
989 | mov eax,[edi] |
989 | and eax,0x00ffffff |
990 | and eax,0x00ffffff |
990 | ret |
991 | ret |
991 | v12rsp24: |
992 | v12rsp24: |
992 | 993 | ||
993 | imul eax,3 |
994 | imul eax,3 |
994 | mov edi,eax |
995 | mov edi,eax |
995 | shr eax,16 |
996 | shr eax,16 |
996 | call set_bank |
997 | call set_bank |
997 | and edi,65535 |
998 | and edi,65535 |
998 | add edi,VGABasePtr |
999 | add edi,VGABasePtr |
999 | mov eax,[edi] |
1000 | mov eax,[edi] |
1000 | and eax,0x00ffffff |
1001 | and eax,0x00ffffff |
1001 | ret |
1002 | ret |