Rev 9715 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9715 | Rev 9949 | ||
---|---|---|---|
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. 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: 9715 $ |
18 | $Revision: 9949 $ |
19 | 19 | ||
20 | 20 | ||
21 | TRIDENT = 0 |
21 | TRIDENT = 0 |
22 | S3_VIDEO = 0 |
22 | S3_VIDEO = 0 |
23 | INTEL_VIDEO = 0 |
23 | INTEL_VIDEO = 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 [_display.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, [background_window + WDATA.draw_data.left] |
260 | mov ebx, [draw_data+32+RECT.top] |
260 | mov ebx, [background_window + WDATA.draw_data.top] |
261 | xor edi, edi;no force |
261 | xor edi, edi;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 | add eax, [_WinMapAddress] |
331 | cmp [eax+esi], byte 1 |
331 | cmp [eax+esi], byte 1 |
332 | jnz v12nbgp |
332 | jnz v12nbgp |
333 | mov eax, [BytesPerScanLine] |
333 | mov eax, [BytesPerScanLine] |
334 | mov ebx, edi |
334 | mov ebx, edi |
335 | mul ebx |
335 | mul ebx |
336 | add eax, esi |
336 | add eax, esi |
337 | lea eax, [VGABasePtr+eax+esi*2] |
337 | lea eax, [VGABasePtr+eax+esi*2] |
338 | cmp [ScreenBPP], byte 24 |
338 | cmp [ScreenBPP], byte 24 |
339 | jz v12bgl3 |
339 | jz v12bgl3 |
340 | add eax, esi |
340 | add eax, esi |
341 | 341 | ||
342 | v12bgl3: |
342 | v12bgl3: |
343 | 343 | ||
344 | push ebx |
344 | push ebx |
345 | push eax |
345 | push eax |
346 | 346 | ||
347 | sub eax, VGABasePtr |
347 | sub eax, VGABasePtr |
348 | 348 | ||
349 | shr eax, 16 |
349 | shr eax, 16 |
350 | call set_bank |
350 | call set_bank |
351 | pop eax |
351 | pop eax |
352 | and eax, 65535 |
352 | and eax, 65535 |
353 | add eax, VGABasePtr |
353 | add eax, VGABasePtr |
354 | pop ebx |
354 | pop ebx |
355 | 355 | ||
356 | mov [eax], cx |
356 | mov [eax], cx |
357 | add eax, 2 |
357 | add eax, 2 |
358 | shr ecx, 16 |
358 | shr ecx, 16 |
359 | mov [eax], cl |
359 | mov [eax], cl |
360 | sti |
360 | sti |
361 | 361 | ||
362 | v12nbgp: |
362 | v12nbgp: |
363 | 363 | ||
364 | popa |
364 | popa |
365 | add esi, 3 |
365 | add esi, 3 |
366 | inc eax |
366 | inc eax |
367 | cmp eax, [draw_data+32+RECT.right] |
367 | cmp eax, [draw_data+32+RECT.right] |
368 | jg v12nodp31 |
368 | jg v12nodp31 |
369 | jmp v12dp3 |
369 | jmp v12dp3 |
370 | 370 | ||
371 | v12nodp31: |
371 | v12nodp31: |
372 | 372 | ||
373 | mov eax, [draw_data+32+RECT.left] |
373 | mov eax, [draw_data+32+RECT.left] |
374 | inc ebx |
374 | inc ebx |
375 | cmp ebx, [draw_data+32+RECT.bottom] |
375 | cmp ebx, [draw_data+32+RECT.bottom] |
376 | jg v12dp4 |
376 | jg v12dp4 |
377 | jmp v12dp3 |
377 | jmp v12dp3 |
378 | 378 | ||
379 | v12dp4: |
379 | v12dp4: |
380 | 380 | ||
381 | pop edx |
381 | pop edx |
382 | pop ecx |
382 | pop ecx |
383 | pop ebx |
383 | pop ebx |
384 | pop eax |
384 | pop eax |
385 | ret |
385 | ret |
386 | 386 | ||
387 | 387 | ||
388 | vesa12_drawbar: |
388 | vesa12_drawbar: |
389 | 389 | ||
390 | call [_display.disable_mouse] |
390 | call [_display.disable_mouse] |
391 | 391 | ||
392 | ;; mov [novesachecksum],dword 0 |
392 | ;; mov [novesachecksum],dword 0 |
393 | sub edx, ebx |
393 | sub edx, ebx |
394 | sub ecx, eax |
394 | sub ecx, eax |
395 | push esi |
395 | push esi |
396 | push edi |
396 | push edi |
397 | push eax |
397 | push eax |
398 | push ebx |
398 | push ebx |
399 | push ecx |
399 | push ecx |
400 | push edx |
400 | push edx |
401 | mov ecx, [current_slot_idx] |
401 | mov ecx, [current_slot_idx] |
402 | shl ecx, 5 |
402 | shl ecx, 5 |
403 | add eax, [ecx + window_data + WDATA.box.left] |
403 | add eax, [ecx + window_data + WDATA.box.left] |
404 | add ebx, [ecx + window_data + WDATA.box.top] |
404 | add ebx, [ecx + window_data + WDATA.box.top] |
405 | push eax |
405 | push eax |
406 | mov eax, ebx ; y |
406 | mov eax, ebx ; y |
407 | mov ebx, [BytesPerScanLine] |
407 | mov ebx, [BytesPerScanLine] |
408 | mul ebx |
408 | mul ebx |
409 | pop ecx |
409 | pop ecx |
410 | add eax, ecx ; x |
410 | add eax, ecx ; x |
411 | add eax, ecx |
411 | add eax, ecx |
412 | add eax, ecx |
412 | add eax, ecx |
413 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x start |
413 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x start |
414 | jz dbpi2412 |
414 | jz dbpi2412 |
415 | add eax, ecx |
415 | add eax, ecx |
416 | 416 | ||
417 | dbpi2412: |
417 | dbpi2412: |
418 | 418 | ||
419 | add eax, VGABasePtr |
419 | add eax, VGABasePtr |
420 | mov edi, eax |
420 | mov edi, eax |
421 | 421 | ||
422 | ; x size |
422 | ; x size |
423 | 423 | ||
424 | mov eax, [esp+4]; [esp+6] |
424 | mov eax, [esp+4]; [esp+6] |
425 | mov ecx, eax |
425 | mov ecx, eax |
426 | add ecx, eax |
426 | add ecx, eax |
427 | add ecx, eax |
427 | add ecx, eax |
428 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x size |
428 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x size |
429 | jz dbpi24312 |
429 | jz dbpi24312 |
430 | add ecx, eax |
430 | add ecx, eax |
431 | 431 | ||
432 | dbpi24312: |
432 | dbpi24312: |
433 | 433 | ||
434 | mov ebx, [esp+0] |
434 | mov ebx, [esp+0] |
435 | 435 | ||
436 | ; check limits ? |
436 | ; check limits ? |
437 | 437 | ||
438 | push eax |
438 | push eax |
439 | push ecx |
439 | push ecx |
440 | mov eax, [TASK_BASE] |
440 | mov eax, [TASK_BASE] |
441 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.left] |
441 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.left] |
442 | cmp ecx, 0 |
442 | cmp ecx, 0 |
443 | jnz dbcblimitlset12 |
443 | jnz dbcblimitlset12 |
444 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.top] |
444 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.top] |
445 | cmp ecx, 0 |
445 | cmp ecx, 0 |
446 | jnz dbcblimitlset12 |
446 | jnz dbcblimitlset12 |
447 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.right] |
447 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.right] |
448 | cmp ecx, [Screen_Max_X] |
448 | cmp ecx, [Screen_Max_X] |
449 | jnz dbcblimitlset12 |
449 | jnz dbcblimitlset12 |
450 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.bottom] |
450 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.bottom] |
451 | cmp ecx, [Screen_Max_Y] |
451 | cmp ecx, [Screen_Max_Y] |
452 | jnz dbcblimitlset12 |
452 | jnz dbcblimitlset12 |
453 | pop ecx |
453 | pop ecx |
454 | pop eax |
454 | pop eax |
455 | push dword 0 |
455 | push dword 0 |
456 | jmp dbcblimitlno12 |
456 | jmp dbcblimitlno12 |
457 | 457 | ||
458 | dbcblimitlset12: |
458 | dbcblimitlset12: |
459 | 459 | ||
460 | pop ecx |
460 | pop ecx |
461 | pop eax |
461 | pop eax |
462 | push dword 1 |
462 | push dword 1 |
463 | 463 | ||
464 | dbcblimitlno12: |
464 | dbcblimitlno12: |
465 | 465 | ||
466 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
466 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
467 | jz dbpi24bit12 |
467 | jz dbpi24bit12 |
468 | jmp dbpi32bit12 |
468 | jmp dbpi32bit12 |
469 | 469 | ||
470 | 470 | ||
471 | ; DRAWBAR 24 BBP |
471 | ; DRAWBAR 24 BBP |
472 | 472 | ||
473 | 473 | ||
474 | dbpi24bit12: |
474 | dbpi24bit12: |
475 | 475 | ||
476 | push eax |
476 | push eax |
477 | push ebx |
477 | push ebx |
478 | push edx |
478 | push edx |
479 | mov eax, ecx |
479 | mov eax, ecx |
480 | mov ebx, 3 |
480 | mov ebx, 3 |
481 | div ebx |
481 | div ebx |
482 | mov ecx, eax |
482 | mov ecx, eax |
483 | pop edx |
483 | pop edx |
484 | pop ebx |
484 | pop ebx |
485 | pop eax |
485 | pop eax |
486 | cld |
486 | cld |
487 | 487 | ||
488 | dbnewpi12: |
488 | dbnewpi12: |
489 | 489 | ||
490 | push ebx |
490 | push ebx |
491 | push edi |
491 | push edi |
492 | push ecx |
492 | push ecx |
493 | 493 | ||
494 | xor edx, edx |
494 | xor edx, edx |
495 | mov eax, edi |
495 | mov eax, edi |
496 | sub eax, VGABasePtr |
496 | sub eax, VGABasePtr |
497 | mov ebx, 3 |
497 | mov ebx, 3 |
498 | div ebx |
498 | div ebx |
499 | add eax, [_WinMapAddress] |
499 | add eax, [_WinMapAddress] |
500 | mov ebx, [CURRENT_TASK] |
500 | mov ebx, [CURRENT_TASK] |
501 | cld |
501 | cld |
502 | 502 | ||
503 | dbnp2412: |
503 | dbnp2412: |
504 | 504 | ||
505 | mov dl, [eax] |
505 | mov dl, [eax] |
506 | push eax |
506 | push eax |
507 | push ecx |
507 | push ecx |
508 | cmp dl, bl |
508 | cmp dl, bl |
509 | jnz dbimp24no12 |
509 | jnz dbimp24no12 |
510 | cmp [esp+5*4], dword 0 |
510 | cmp [esp+5*4], dword 0 |
511 | jz dbimp24yes12 |
511 | jz dbimp24yes12 |
512 | ; call dbcplimit |
512 | ; call dbcplimit |
513 | ; jnz dbimp24no12 |
513 | ; jnz dbimp24no12 |
514 | 514 | ||
515 | dbimp24yes12: |
515 | dbimp24yes12: |
516 | 516 | ||
517 | push edi |
517 | push edi |
518 | mov eax, edi |
518 | mov eax, edi |
519 | sub eax, VGABasePtr |
519 | sub eax, VGABasePtr |
520 | shr eax, 16 |
520 | shr eax, 16 |
521 | call set_bank |
521 | call set_bank |
522 | and edi, 0xffff |
522 | and edi, 0xffff |
523 | add edi, VGABasePtr |
523 | add edi, VGABasePtr |
524 | mov eax, [esp+8+3*4+16+4+4] |
524 | mov eax, [esp+8+3*4+16+4+4] |
525 | stosw |
525 | stosw |
526 | shr eax, 16 |
526 | shr eax, 16 |
527 | stosb |
527 | stosb |
528 | sti |
528 | sti |
529 | pop edi |
529 | pop edi |
530 | add edi, 3 |
530 | add edi, 3 |
531 | pop ecx |
531 | pop ecx |
532 | pop eax |
532 | pop eax |
533 | inc eax |
533 | inc eax |
534 | loop dbnp2412 |
534 | loop dbnp2412 |
535 | jmp dbnp24d12 |
535 | jmp dbnp24d12 |
536 | 536 | ||
537 | dbimp24no12: |
537 | dbimp24no12: |
538 | 538 | ||
539 | pop ecx |
539 | pop ecx |
540 | pop eax |
540 | pop eax |
541 | cld |
541 | cld |
542 | add edi, 3 |
542 | add edi, 3 |
543 | inc eax |
543 | inc eax |
544 | loop dbnp2412 |
544 | loop dbnp2412 |
545 | 545 | ||
546 | dbnp24d12: |
546 | dbnp24d12: |
547 | 547 | ||
548 | mov eax, [esp+3*4+16+4] |
548 | mov eax, [esp+3*4+16+4] |
549 | test eax, 0x80000000 |
549 | test eax, 0x80000000 |
550 | jz nodbgl2412 |
550 | jz nodbgl2412 |
551 | cmp al, 0 |
551 | cmp al, 0 |
552 | jz nodbgl2412 |
552 | jz nodbgl2412 |
553 | dec eax |
553 | dec eax |
554 | mov [esp+3*4+16+4], eax |
554 | mov [esp+3*4+16+4], eax |
555 | 555 | ||
556 | nodbgl2412: |
556 | nodbgl2412: |
557 | 557 | ||
558 | pop ecx |
558 | pop ecx |
559 | pop edi |
559 | pop edi |
560 | pop ebx |
560 | pop ebx |
561 | add edi, [BytesPerScanLine] |
561 | add edi, [BytesPerScanLine] |
562 | dec ebx |
562 | dec ebx |
563 | jz dbnonewpi12 |
563 | jz dbnonewpi12 |
564 | jmp dbnewpi12 |
564 | jmp dbnewpi12 |
565 | 565 | ||
566 | dbnonewpi12: |
566 | dbnonewpi12: |
567 | 567 | ||
568 | add esp, 7*4 |
568 | add esp, 7*4 |
569 | 569 | ||
570 | ret |
570 | ret |
571 | 571 | ||
572 | 572 | ||
573 | ; DRAWBAR 32 BBP |
573 | ; DRAWBAR 32 BBP |
574 | 574 | ||
575 | 575 | ||
576 | dbpi32bit12: |
576 | dbpi32bit12: |
577 | 577 | ||
578 | cld |
578 | cld |
579 | shr ecx, 2 |
579 | shr ecx, 2 |
580 | 580 | ||
581 | dbnewpi3212: |
581 | dbnewpi3212: |
582 | 582 | ||
583 | push ebx |
583 | push ebx |
584 | push edi |
584 | push edi |
585 | push ecx |
585 | push ecx |
586 | 586 | ||
587 | mov eax, edi |
587 | mov eax, edi |
588 | sub eax, VGABasePtr |
588 | sub eax, VGABasePtr |
589 | shr eax, 2 |
589 | shr eax, 2 |
590 | add eax, [_WinMapAddress] |
590 | add eax, [_WinMapAddress] |
591 | mov ebx, [CURRENT_TASK] |
591 | mov ebx, [CURRENT_TASK] |
592 | cld |
592 | cld |
593 | 593 | ||
594 | dbnp3212: |
594 | dbnp3212: |
595 | 595 | ||
596 | mov dl, [eax] |
596 | mov dl, [eax] |
597 | push eax |
597 | push eax |
598 | push ecx |
598 | push ecx |
599 | cmp dl, bl |
599 | cmp dl, bl |
600 | jnz dbimp32no12 |
600 | jnz dbimp32no12 |
601 | cmp [esp+5*4], dword 0 |
601 | cmp [esp+5*4], dword 0 |
602 | jz dbimp32yes12 |
602 | jz dbimp32yes12 |
603 | ; call dbcplimit |
603 | ; call dbcplimit |
604 | ; jnz dbimp32no12 |
604 | ; jnz dbimp32no12 |
605 | 605 | ||
606 | dbimp32yes12: |
606 | dbimp32yes12: |
607 | 607 | ||
608 | push edi |
608 | push edi |
609 | mov eax, edi |
609 | mov eax, edi |
610 | sub eax, VGABasePtr |
610 | sub eax, VGABasePtr |
611 | shr eax, 16 |
611 | shr eax, 16 |
612 | call set_bank |
612 | call set_bank |
613 | and edi, 0xffff |
613 | and edi, 0xffff |
614 | add edi, VGABasePtr |
614 | add edi, VGABasePtr |
615 | mov eax, [esp+8+3*4+16+4+4] |
615 | mov eax, [esp+8+3*4+16+4+4] |
616 | stosw |
616 | stosw |
617 | shr eax, 16 |
617 | shr eax, 16 |
618 | stosb |
618 | stosb |
619 | sti |
619 | sti |
620 | pop edi |
620 | pop edi |
621 | add edi, 4 |
621 | add edi, 4 |
622 | inc ebp |
622 | inc ebp |
623 | pop ecx |
623 | pop ecx |
624 | pop eax |
624 | pop eax |
625 | inc eax |
625 | inc eax |
626 | loop dbnp3212 |
626 | loop dbnp3212 |
627 | jmp dbnp32d12 |
627 | jmp dbnp32d12 |
628 | 628 | ||
629 | dbimp32no12: |
629 | dbimp32no12: |
630 | 630 | ||
631 | pop ecx |
631 | pop ecx |
632 | pop eax |
632 | pop eax |
633 | inc eax |
633 | inc eax |
634 | add edi, 4 |
634 | add edi, 4 |
635 | inc ebp |
635 | inc ebp |
636 | loop dbnp3212 |
636 | loop dbnp3212 |
637 | 637 | ||
638 | dbnp32d12: |
638 | dbnp32d12: |
639 | 639 | ||
640 | mov eax, [esp+12+16+4] |
640 | mov eax, [esp+12+16+4] |
641 | test eax, 0x80000000 |
641 | test eax, 0x80000000 |
642 | jz nodbgl3212 |
642 | jz nodbgl3212 |
643 | cmp al, 0 |
643 | cmp al, 0 |
644 | jz nodbgl3212 |
644 | jz nodbgl3212 |
645 | dec eax |
645 | dec eax |
646 | mov [esp+12+16+4], eax |
646 | mov [esp+12+16+4], eax |
647 | 647 | ||
648 | nodbgl3212: |
648 | nodbgl3212: |
649 | 649 | ||
650 | pop ecx |
650 | pop ecx |
651 | pop edi |
651 | pop edi |
652 | pop ebx |
652 | pop ebx |
653 | add edi, [BytesPerScanLine] |
653 | add edi, [BytesPerScanLine] |
654 | dec ebx |
654 | dec ebx |
655 | jz nodbnewpi3212 |
655 | jz nodbnewpi3212 |
656 | jmp dbnewpi3212 |
656 | jmp dbnewpi3212 |
657 | 657 | ||
658 | nodbnewpi3212: |
658 | nodbnewpi3212: |
659 | 659 | ||
660 | add esp, 7*4 |
660 | add esp, 7*4 |
661 | ret |
661 | ret |
662 | 662 | ||
663 | 663 | ||
664 | Vesa12_putpixel24: |
664 | Vesa12_putpixel24: |
665 | 665 | ||
666 | mov edi, eax; x |
666 | mov edi, eax; x |
667 | mov eax, ebx; y |
667 | mov eax, ebx; y |
668 | lea edi, [edi+edi*2] |
668 | lea edi, [edi+edi*2] |
669 | mov ebx, [BytesPerScanLine] |
669 | mov ebx, [BytesPerScanLine] |
670 | mul ebx |
670 | mul ebx |
671 | add edi, eax |
671 | add edi, eax |
672 | mov eax, edi |
672 | mov eax, edi |
673 | shr eax, 16 |
673 | shr eax, 16 |
674 | call set_bank |
674 | call set_bank |
675 | and edi, 65535 |
675 | and edi, 65535 |
676 | add edi, VGABasePtr |
676 | add edi, VGABasePtr |
677 | mov eax, [esp+28] |
677 | mov eax, [esp+28] |
678 | stosw |
678 | stosw |
679 | shr eax, 16 |
679 | shr eax, 16 |
680 | mov [edi], al |
680 | mov [edi], al |
681 | sti |
681 | sti |
682 | ret |
682 | ret |
683 | 683 | ||
684 | 684 | ||
685 | 685 | ||
686 | Vesa12_putpixel32: |
686 | Vesa12_putpixel32: |
687 | 687 | ||
688 | mov edi, eax; x |
688 | mov edi, eax; x |
689 | mov eax, ebx; y |
689 | mov eax, ebx; y |
690 | shl edi, 2 |
690 | shl edi, 2 |
691 | mov ebx, [BytesPerScanLine] |
691 | mov ebx, [BytesPerScanLine] |
692 | mul ebx |
692 | mul ebx |
693 | add edi, eax |
693 | add edi, eax |
694 | mov eax, edi |
694 | mov eax, edi |
695 | shr eax, 16 |
695 | shr eax, 16 |
696 | call set_bank |
696 | call set_bank |
697 | and edi, 65535 |
697 | and edi, 65535 |
698 | add edi, VGABasePtr |
698 | add edi, VGABasePtr |
699 | mov ecx, [esp+28] |
699 | mov ecx, [esp+28] |
700 | mov [edi], ecx |
700 | mov [edi], ecx |
701 | sti |
701 | sti |
702 | ret |
702 | ret |
703 | 703 | ||
704 | 704 | ||
705 | Vesa12_getpixel24: |
705 | Vesa12_getpixel24: |
706 | 706 | ||
707 | mov edi, eax; x |
707 | mov edi, eax; x |
708 | mov eax, ebx; y |
708 | mov eax, ebx; y |
709 | lea edi, [edi+edi*2] |
709 | lea edi, [edi+edi*2] |
710 | mov ebx, [BytesPerScanLine] |
710 | mov ebx, [BytesPerScanLine] |
711 | mul ebx |
711 | mul ebx |
712 | add edi, eax |
712 | add edi, eax |
713 | mov eax, edi |
713 | mov eax, edi |
714 | shr eax, 16 |
714 | shr eax, 16 |
715 | call set_bank |
715 | call set_bank |
716 | and edi, 65535 |
716 | and edi, 65535 |
717 | add edi, VGABasePtr |
717 | add edi, VGABasePtr |
718 | mov ecx, [edi] |
718 | mov ecx, [edi] |
719 | and ecx, 255*256*256+255*256+255 |
719 | and ecx, 255*256*256+255*256+255 |
720 | sti |
720 | sti |
721 | ret |
721 | ret |
722 | 722 | ||
723 | 723 | ||
724 | Vesa12_getpixel32: |
724 | Vesa12_getpixel32: |
725 | 725 | ||
726 | mov edi, eax; x |
726 | mov edi, eax; x |
727 | mov eax, ebx; y |
727 | mov eax, ebx; y |
728 | shl edi, 2 |
728 | shl edi, 2 |
729 | mov ebx, [BytesPerScanLine] |
729 | mov ebx, [BytesPerScanLine] |
730 | xor edx, edx |
730 | xor edx, edx |
731 | mul ebx |
731 | mul ebx |
732 | add edi, eax |
732 | add edi, eax |
733 | mov eax, edi |
733 | mov eax, edi |
734 | shr eax, 16 |
734 | shr eax, 16 |
735 | call set_bank |
735 | call set_bank |
736 | and edi, 65535 |
736 | and edi, 65535 |
737 | add edi, VGABasePtr |
737 | add edi, VGABasePtr |
738 | mov ecx, [edi] |
738 | mov ecx, [edi] |
739 | and ecx, 255*256*256+255*256+255 |
739 | and ecx, 255*256*256+255*256+255 |
740 | sti |
740 | sti |
741 | 741 | ||
742 | ret |
742 | ret |
743 | 743 | ||
744 | 744 | ||
745 | 745 | ||
746 | vesa12_putimage: |
746 | vesa12_putimage: |
747 | ; ebx = pointer to image |
747 | ; ebx = pointer to image |
748 | ; ecx = size [x|y] |
748 | ; ecx = size [x|y] |
749 | ; edx = coordinates [x|y] |
749 | ; edx = coordinates [x|y] |
750 | ; ebp = pointer to 'get' function |
750 | ; ebp = pointer to 'get' function |
751 | ; esi = pointer to 'init' function |
751 | ; esi = pointer to 'init' function |
752 | ; edi = parameter for 'get' function |
752 | ; edi = parameter for 'get' function |
753 | 753 | ||
754 | ; mov ebx,image |
754 | ; mov ebx,image |
755 | ; mov ecx,320*65536+240 |
755 | ; mov ecx,320*65536+240 |
756 | ; mov edx,20*65536+20 |
756 | ; mov edx,20*65536+20 |
757 | 757 | ||
758 | call [_display.disable_mouse] |
758 | call [_display.disable_mouse] |
759 | 759 | ||
760 | mov [novesachecksum], dword 0 |
760 | mov [novesachecksum], dword 0 |
761 | push esi |
761 | push esi |
762 | push edi |
762 | push edi |
763 | push eax |
763 | push eax |
764 | push ebx |
764 | push ebx |
765 | push ecx |
765 | push ecx |
766 | push edx |
766 | push edx |
767 | movzx eax, word [esp+2] |
767 | movzx eax, word [esp+2] |
768 | movzx ebx, word [esp+0] |
768 | movzx ebx, word [esp+0] |
769 | mov ecx, [current_slot_idx] |
769 | mov ecx, [current_slot_idx] |
770 | shl ecx, 5 |
770 | shl ecx, 5 |
771 | add eax, [ecx + window_data + WDATA.box.left] |
771 | add eax, [ecx + window_data + WDATA.box.left] |
772 | add ebx, [ecx + window_data + WDATA.box.top] |
772 | add ebx, [ecx + window_data + WDATA.box.top] |
773 | push eax |
773 | push eax |
774 | mov eax, ebx ; y |
774 | mov eax, ebx ; y |
775 | mul dword [BytesPerScanLine] |
775 | mul dword [BytesPerScanLine] |
776 | pop ecx |
776 | pop ecx |
777 | add eax, ecx ; x |
777 | add eax, ecx ; x |
778 | add eax, ecx |
778 | add eax, ecx |
779 | add eax, ecx |
779 | add eax, ecx |
780 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x start |
780 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? - x start |
781 | jz pi2412 |
781 | jz pi2412 |
782 | add eax, ecx |
782 | add eax, ecx |
783 | 783 | ||
784 | pi2412: |
784 | pi2412: |
785 | 785 | ||
786 | add eax, VGABasePtr |
786 | add eax, VGABasePtr |
787 | mov edi, eax |
787 | mov edi, eax |
788 | 788 | ||
789 | ; x size |
789 | ; x size |
790 | 790 | ||
791 | movzx ecx, word [esp+6] |
791 | movzx ecx, word [esp+6] |
792 | 792 | ||
793 | mov esi, [esp+8] |
793 | mov esi, [esp+8] |
794 | movzx ebx, word [esp+4] |
794 | movzx ebx, word [esp+4] |
795 | 795 | ||
796 | ; check limits while draw ? |
796 | ; check limits while draw ? |
797 | 797 | ||
798 | push ecx |
798 | push ecx |
799 | mov eax, [TASK_BASE] |
799 | mov eax, [TASK_BASE] |
800 | cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 |
800 | cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 |
801 | jnz dbcblimitlset212 |
801 | jnz dbcblimitlset212 |
802 | cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 |
802 | cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 |
803 | jnz dbcblimitlset212 |
803 | jnz dbcblimitlset212 |
804 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.right] |
804 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.right] |
805 | cmp ecx, [Screen_Max_X] |
805 | cmp ecx, [Screen_Max_X] |
806 | jnz dbcblimitlset212 |
806 | jnz dbcblimitlset212 |
807 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.bottom] |
807 | mov ecx, [eax+draw_data-CURRENT_TASK+RECT.bottom] |
808 | cmp ecx, [Screen_Max_Y] |
808 | cmp ecx, [Screen_Max_Y] |
809 | jnz dbcblimitlset212 |
809 | jnz dbcblimitlset212 |
810 | pop ecx |
810 | pop ecx |
811 | push 0 |
811 | push 0 |
812 | jmp dbcblimitlno212 |
812 | jmp dbcblimitlno212 |
813 | 813 | ||
814 | dbcblimitlset212: |
814 | dbcblimitlset212: |
815 | 815 | ||
816 | pop ecx |
816 | pop ecx |
817 | push 1 |
817 | push 1 |
818 | 818 | ||
819 | dbcblimitlno212: |
819 | dbcblimitlno212: |
820 | 820 | ||
821 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
821 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
822 | jnz pi32bit12 |
822 | jnz pi32bit12 |
823 | 823 | ||
824 | pi24bit12: |
824 | pi24bit12: |
825 | 825 | ||
826 | newpi12: |
826 | newpi12: |
827 | 827 | ||
828 | push edi |
828 | push edi |
829 | push ecx |
829 | push ecx |
830 | push ebx |
830 | push ebx |
831 | 831 | ||
832 | mov edx, edi |
832 | mov edx, edi |
833 | sub edx, VGABasePtr |
833 | sub edx, VGABasePtr |
834 | mov ebx, 3 |
834 | mov ebx, 3 |
835 | div ebx |
835 | div ebx |
836 | add edx, [_WinMapAddress] |
836 | add edx, [_WinMapAddress] |
837 | mov ebx, [CURRENT_TASK] |
837 | mov ebx, [CURRENT_TASK] |
838 | mov bh, [esp+4*3] |
838 | mov bh, [esp+4*3] |
839 | 839 | ||
840 | np2412: |
840 | np2412: |
841 | 841 | ||
842 | cmp bl, [edx] |
842 | cmp bl, [edx] |
843 | jnz imp24no12 |
843 | jnz imp24no12 |
844 | ; mov eax,[esi] |
844 | ; mov eax,[esi] |
845 | push dword [esp+4*3+20] |
845 | push dword [esp+4*3+20] |
846 | call ebp |
846 | call ebp |
847 | ; cmp bh,0 |
847 | ; cmp bh,0 |
848 | ; jz imp24yes12 |
848 | ; jz imp24yes12 |
849 | ; call dbcplimit |
849 | ; call dbcplimit |
850 | ; jnz imp24no12 |
850 | ; jnz imp24no12 |
851 | 851 | ||
852 | imp24yes12: |
852 | imp24yes12: |
853 | 853 | ||
854 | push edi |
854 | push edi |
855 | push eax |
855 | push eax |
856 | mov eax, edi |
856 | mov eax, edi |
857 | sub eax, VGABasePtr |
857 | sub eax, VGABasePtr |
858 | shr eax, 16 |
858 | shr eax, 16 |
859 | call set_bank |
859 | call set_bank |
860 | pop eax |
860 | pop eax |
861 | and edi, 0xffff |
861 | and edi, 0xffff |
862 | add edi, VGABasePtr |
862 | add edi, VGABasePtr |
863 | mov [edi], ax |
863 | mov [edi], ax |
864 | shr eax, 16 |
864 | shr eax, 16 |
865 | mov [edi+2], al |
865 | mov [edi+2], al |
866 | pop edi |
866 | pop edi |
867 | 867 | ||
868 | imp24no12: |
868 | imp24no12: |
869 | 869 | ||
870 | inc edx |
870 | inc edx |
871 | ; add esi,3 |
871 | ; add esi,3 |
872 | add edi, 3 |
872 | add edi, 3 |
873 | dec ecx |
873 | dec ecx |
874 | jnz np2412 |
874 | jnz np2412 |
875 | 875 | ||
876 | np24d12: |
876 | np24d12: |
877 | 877 | ||
878 | pop ebx |
878 | pop ebx |
879 | pop ecx |
879 | pop ecx |
880 | pop edi |
880 | pop edi |
881 | 881 | ||
882 | add edi, [BytesPerScanLine] |
882 | add edi, [BytesPerScanLine] |
883 | add esi, [esp+32] |
883 | add esi, [esp+32] |
884 | cmp ebp, putimage_get1bpp |
884 | cmp ebp, putimage_get1bpp |
885 | jz .correct |
885 | jz .correct |
886 | cmp ebp, putimage_get2bpp |
886 | cmp ebp, putimage_get2bpp |
887 | jz .correct |
887 | jz .correct |
888 | cmp ebp, putimage_get4bpp |
888 | cmp ebp, putimage_get4bpp |
889 | jnz @f |
889 | jnz @f |
890 | .correct: |
890 | .correct: |
891 | mov eax, [esp+20] |
891 | mov eax, [esp+20] |
892 | mov byte[eax], 80h |
892 | mov byte[eax], 80h |
893 | @@: |
893 | @@: |
894 | dec ebx |
894 | dec ebx |
895 | jnz newpi12 |
895 | jnz newpi12 |
896 | 896 | ||
897 | nonewpi12: |
897 | nonewpi12: |
898 | 898 | ||
899 | pop eax edx ecx ebx eax edi esi |
899 | pop eax edx ecx ebx eax edi esi |
900 | xor eax, eax |
900 | xor eax, eax |
901 | ret |
901 | ret |
902 | 902 | ||
903 | 903 | ||
904 | pi32bit12: |
904 | pi32bit12: |
905 | 905 | ||
906 | newpi3212: |
906 | newpi3212: |
907 | 907 | ||
908 | push edi |
908 | push edi |
909 | push ecx |
909 | push ecx |
910 | push ebx |
910 | push ebx |
911 | 911 | ||
912 | mov edx, edi |
912 | mov edx, edi |
913 | sub edx, VGABasePtr |
913 | sub edx, VGABasePtr |
914 | shr edx, 2 |
914 | shr edx, 2 |
915 | add edx, [_WinMapAddress] |
915 | add edx, [_WinMapAddress] |
916 | mov ebx, [CURRENT_TASK] |
916 | mov ebx, [CURRENT_TASK] |
917 | mov bh, [esp+4*3] |
917 | mov bh, [esp+4*3] |
918 | 918 | ||
919 | np3212: |
919 | np3212: |
920 | 920 | ||
921 | cmp bl, [edx] |
921 | cmp bl, [edx] |
922 | jnz imp32no12 |
922 | jnz imp32no12 |
923 | ; mov eax,[esi] |
923 | ; mov eax,[esi] |
924 | push dword [esp+4*3+20] |
924 | push dword [esp+4*3+20] |
925 | call ebp |
925 | call ebp |
926 | ; cmp bh,0 |
926 | ; cmp bh,0 |
927 | ; jz imp32yes12 |
927 | ; jz imp32yes12 |
928 | ; call dbcplimit |
928 | ; call dbcplimit |
929 | ; jnz imp32no12 |
929 | ; jnz imp32no12 |
930 | 930 | ||
931 | imp32yes12: |
931 | imp32yes12: |
932 | 932 | ||
933 | push edi |
933 | push edi |
934 | push eax |
934 | push eax |
935 | mov eax, edi |
935 | mov eax, edi |
936 | sub eax, VGABasePtr |
936 | sub eax, VGABasePtr |
937 | shr eax, 16 |
937 | shr eax, 16 |
938 | call set_bank |
938 | call set_bank |
939 | pop eax |
939 | pop eax |
940 | and edi, 0xffff |
940 | and edi, 0xffff |
941 | mov [edi+VGABasePtr], eax |
941 | mov [edi+VGABasePtr], eax |
942 | pop edi |
942 | pop edi |
943 | 943 | ||
944 | imp32no12: |
944 | imp32no12: |
945 | 945 | ||
946 | inc edx |
946 | inc edx |
947 | ; add esi,3 |
947 | ; add esi,3 |
948 | add edi, 4 |
948 | add edi, 4 |
949 | dec ecx |
949 | dec ecx |
950 | jnz np3212 |
950 | jnz np3212 |
951 | 951 | ||
952 | np32d12: |
952 | np32d12: |
953 | 953 | ||
954 | pop ebx |
954 | pop ebx |
955 | pop ecx |
955 | pop ecx |
956 | pop edi |
956 | pop edi |
957 | 957 | ||
958 | add edi, [BytesPerScanLine] |
958 | add edi, [BytesPerScanLine] |
959 | cmp ebp, putimage_get1bpp |
959 | cmp ebp, putimage_get1bpp |
960 | jz .correct |
960 | jz .correct |
961 | cmp ebp, putimage_get2bpp |
961 | cmp ebp, putimage_get2bpp |
962 | jz .correct |
962 | jz .correct |
963 | cmp ebp, putimage_get4bpp |
963 | cmp ebp, putimage_get4bpp |
964 | jnz @f |
964 | jnz @f |
965 | .correct: |
965 | .correct: |
966 | mov eax, [esp+20] |
966 | mov eax, [esp+20] |
967 | mov byte[eax], 80h |
967 | mov byte[eax], 80h |
968 | @@: |
968 | @@: |
969 | dec ebx |
969 | dec ebx |
970 | jnz newpi3212 |
970 | jnz newpi3212 |
971 | 971 | ||
972 | nonewpi3212: |
972 | nonewpi3212: |
973 | 973 | ||
974 | pop eax edx ecx ebx eax edi esi |
974 | pop eax edx ecx ebx eax edi esi |
975 | xor eax, eax |
975 | xor eax, eax |
976 | ret |
976 | ret |
977 | 977 | ||
978 | 978 | ||
979 | vesa12_read_screen_pixel: |
979 | vesa12_read_screen_pixel: |
980 | 980 | ||
981 | and eax, 0x3FFFFF |
981 | and eax, 0x3FFFFF |
982 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
982 | cmp [ScreenBPP], byte 24; 24 or 32 bpp ? |
983 | jz v12rsp24 |
983 | jz v12rsp24 |
984 | mov edi, eax |
984 | mov edi, eax |
985 | shl edi, 2 |
985 | shl edi, 2 |
986 | mov eax, edi |
986 | mov eax, edi |
987 | shr eax, 16 |
987 | shr eax, 16 |
988 | call set_bank |
988 | call set_bank |
989 | and edi, 65535 |
989 | and edi, 65535 |
990 | add edi, VGABasePtr |
990 | add edi, VGABasePtr |
991 | mov eax, [edi] |
991 | mov eax, [edi] |
992 | and eax, 0x00ffffff |
992 | and eax, 0x00ffffff |
993 | ret |
993 | ret |
994 | v12rsp24: |
994 | v12rsp24: |
995 | 995 | ||
996 | imul eax, 3 |
996 | imul eax, 3 |
997 | mov edi, eax |
997 | mov edi, eax |
998 | shr eax, 16 |
998 | shr eax, 16 |
999 | call set_bank |
999 | call set_bank |
1000 | and edi, 65535 |
1000 | and edi, 65535 |
1001 | add edi, VGABasePtr |
1001 | add edi, VGABasePtr |
1002 | mov eax, [edi] |
1002 | mov eax, [edi] |
1003 | and eax, 0x00ffffff |
1003 | and eax, 0x00ffffff |
1004 | ret |
1004 | ret |