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