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