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