i915: Accelerate depth textures with border color.
[mesa.git] / src / mesa / drivers / dos / blit.S
1 /*
2 * Mesa 3-D graphics library
3 * Version: 4.0
4 *
5 * Copyright (C) 1999 Brian Paul All Rights Reserved.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25 /*
26 * DOS/DJGPP device driver for Mesa
27 *
28 * Author: Daniel Borca
29 * Email : dborca@yahoo.com
30 * Web : http://www.geocities.com/dborca
31 */
32
33
34 .file "blit.S"
35
36 /*
37 * extern unsigned int vesa_gran_mask, vesa_gran_shift;
38 * extern int vl_video_selector;
39
40 * extern void *vl_current_draw_buffer;
41 * extern int vl_current_stride, vl_current_height;
42 * extern int vl_current_offset, vl_current_delta;
43 */
44
45 .text
46
47 /* Desc: VESA bank switching routine (BIOS)
48 *
49 * In : EBX=0, EDX = bank number
50 * Out : -
51 *
52 * Note: thrashes EAX
53 */
54 .p2align 5,,31
55 _vesa_swbankBIOS:
56 movw $0x4f05, %ax
57 int $0x10
58 ret
59
60 .p2align 2,,3
61 .global _vesa_swbank
62 _vesa_swbank: .long _vesa_swbankBIOS
63
64 /* Desc: void vesa_b_dump_virtual (void);
65 *
66 * In : -
67 * Out : -
68 *
69 * Note: uses current draw buffer
70 */
71 .p2align 5,,31
72 .global _vesa_b_dump_virtual
73 _vesa_b_dump_virtual:
74 cld
75 pushl %es
76 pushl %ebx
77 pushl %esi
78 pushl %edi
79 pushl %ebp
80 movl _vl_video_selector, %es
81 movl _vl_current_draw_buffer, %esi
82 movl _vl_current_offset, %edi
83 movl _vesa_gran_shift, %ecx
84 movl _vesa_gran_mask, %ebp
85 movl %edi, %edx
86 xorl %ebx, %ebx
87 andl %ebp, %edi
88 shrl %cl, %edx
89 incl %ebp
90 call *_vesa_swbank
91 movl _vl_current_stride, %ecx
92 movl _vl_current_height, %eax
93 movl _vl_current_delta, %ebx
94 shrl $2, %ecx
95 .balign 4
96 0:
97 pushl %ecx
98 .balign 4
99 1:
100 cmpl %ebp, %edi
101 jb 2f
102 pushl %eax
103 pushl %ebx
104 incl %edx
105 xorl %ebx, %ebx
106 call *_vesa_swbank
107 popl %ebx
108 popl %eax
109 subl %ebp, %edi
110 .balign 4
111 2:
112 movsl
113 decl %ecx
114 jnz 1b
115 popl %ecx
116 addl %ebx, %edi
117 decl %eax
118 jnz 0b
119 popl %ebp
120 popl %edi
121 popl %esi
122 popl %ebx
123 popl %es
124 ret
125
126 /* Desc: void vesa_l_dump_virtual (void);
127 *
128 * In : -
129 * Out : -
130 *
131 * Note: uses current draw buffer
132 */
133 .p2align 5,,31
134 .global _vesa_l_dump_virtual
135 _vesa_l_dump_virtual:
136 cld
137 pushl %es
138 pushl %esi
139 pushl %edi
140 movl _vl_video_selector, %es
141 movl _vl_current_draw_buffer, %esi
142 movl _vl_current_offset, %edi
143 movl _vl_current_stride, %ecx
144 movl _vl_current_height, %edx
145 movl _vl_current_delta, %eax
146 shrl $2, %ecx
147 .balign 4
148 0:
149 pushl %ecx
150 rep; movsl
151 popl %ecx
152 addl %eax, %edi
153 decl %edx
154 jnz 0b
155 popl %edi
156 popl %esi
157 popl %es
158 ret
159
160 /* Desc: void vesa_l_dump_virtual_mmx (void);
161 *
162 * In : -
163 * Out : -
164 *
165 * Note: uses current draw buffer
166 */
167 .p2align 5,,31
168 .global _vesa_l_dump_virtual_mmx
169 _vesa_l_dump_virtual_mmx:
170 #ifdef USE_MMX_ASM
171 pushl %esi
172 pushl %edi
173 movl _vl_video_selector, %fs
174 movl _vl_current_draw_buffer, %esi
175 movl _vl_current_offset, %edi
176 movl _vl_current_stride, %ecx
177 movl _vl_current_height, %edx
178 movl _vl_current_delta, %eax
179 shrl $3, %ecx
180 .balign 4
181 0:
182 pushl %ecx
183 .balign 4
184 1:
185 movq (%esi), %mm0
186 addl $8, %esi
187 movq %mm0, %fs:(%edi)
188 addl $8, %edi
189 decl %ecx
190 jnz 1b
191 popl %ecx
192 addl %eax, %edi
193 decl %edx
194 jnz 0b
195 popl %edi
196 popl %esi
197 emms
198 #endif
199 ret
200
201
202
203 #define CVT_32_TO_16(s, tmp) \
204 /* SRC = bbbbbbbbggggggggrrrrrrrr******** */\
205 movl %e##s##x, %tmp ;\
206 /* TMP = bbbbbbbbggggggggrrrrrrrr******** */\
207 shrb $2, %s##h ;\
208 /* SRC = bbbbbbbbgggggg00rrrrrrrr******** */\
209 andl $0xF80000, %tmp ;\
210 /* TMP = 0000000000000000000rrrrr00000000 */\
211 shrw $3, %s##x ;\
212 /* SRC = bbbbbgggggg00000rrrrrrrr******** */\
213 shrl $8, %tmp ;\
214 /* TMP = 00000000000rrrrr0000000000000000 */\
215 orl %tmp, %e##s##x ;\
216 /* SRC = bbbbbggggggrrrrrrrrrrrrr******** */
217
218 #define CVT_32_TO_15(s, tmp) \
219 /* SRC = bbbbbbbbggggggggrrrrrrrr******** */\
220 movl %e##s##x, %tmp ;\
221 /* TMP = bbbbbbbbggggggggrrrrrrrr******** */\
222 shrb $3, %s##h ;\
223 /* SRC = bbbbbbbbgggggg00rrrrrrrr******** */\
224 andl $0xF80000, %tmp ;\
225 /* TMP = 0000000000000000000rrrrr00000000 */\
226 shrw $3, %s##x ;\
227 /* SRC = bbbbbgggggg00000rrrrrrrr******** */\
228 shrl $9, %tmp ;\
229 /* TMP = 00000000000rrrrr0000000000000000 */\
230 orl %tmp, %e##s##x ;\
231 /* SRC = bbbbbggggggrrrrrrrrrrrrr******** */
232
233 #define CVT_16_TO_15(src, tmp) \
234 /* SRC = bbbbbggggggrrrrrBBBBBGGGGGGRRRRR */\
235 movl %src, %tmp ;\
236 /* TMP = bbbbbggggggrrrrrBBBBBGGGGGGRRRRR */\
237 andl $0x1F001F, %src ;\
238 /* SRC = bbbbb00000000000BBBBB00000000000 */\
239 andl $0xFFC0FFC0, %tmp ;\
240 /* TMP = 000000gggggrrrrr000000GGGGGRRRRR */\
241 shrl %tmp ;\
242 /* TMP = 00000gggggrrrrr000000GGGGGRRRRR0 */\
243 orl %tmp, %src ;\
244 /* SRC = bbbbbgggggrrrrr0BBBBBGGGGGRRRRR0 */\
245
246
247
248 /* transform BGRA to BGR */
249 .p2align 5,,31
250 .global _vesa_l_dump_32_to_24
251 _vesa_l_dump_32_to_24:
252 pushl %ebx
253 pushl %esi
254 pushl %edi
255 movl _vl_video_selector, %fs
256 movl _vl_current_draw_buffer, %esi
257 movl _vl_current_offset, %edi
258 movl _vl_current_stride, %ecx
259 movl _vl_current_height, %edx
260 movl _vl_current_delta, %ebx
261 .balign 4
262 0:
263 pushl %ecx
264 1:
265 movl (%esi), %eax
266 addl $4, %esi
267 movw %ax, %fs:(%edi)
268 shrl $16, %eax
269 movb %al, %fs:2(%edi)
270 addl $3, %edi
271 subl $3, %ecx
272 jnz 1b
273 popl %ecx
274 addl %ebx, %edi
275 decl %edx
276 jnz 0b
277 popl %edi
278 popl %esi
279 popl %ebx
280 ret
281
282 /* transform BGRA to B5G6R5 */
283 .p2align 5,,31
284 .global _vesa_l_dump_32_to_16
285 _vesa_l_dump_32_to_16:
286 pushl %ebp
287 pushl %ebx
288 pushl %esi
289 pushl %edi
290 movl _vl_video_selector, %fs
291 movl _vl_current_draw_buffer, %esi
292 movl _vl_current_offset, %edi
293 movl _vl_current_stride, %ecx
294 movl _vl_current_height, %edx
295 movl _vl_current_delta, %ebx
296 .balign 4
297 0:
298 pushl %ecx
299 1:
300 movl (%esi), %eax
301 addl $4, %esi
302 CVT_32_TO_16(a, ebp)
303 movw %ax, %fs:(%edi)
304 addl $2, %edi
305 subl $2, %ecx
306 jnz 1b
307 popl %ecx
308 addl %ebx, %edi
309 decl %edx
310 jnz 0b
311 popl %edi
312 popl %esi
313 popl %ebx
314 popl %ebp
315 ret
316
317 /* transform BGRA to B5G5R5 */
318 .p2align 5,,31
319 .global _vesa_l_dump_32_to_15
320 _vesa_l_dump_32_to_15:
321 pushl %ebp
322 pushl %ebx
323 pushl %esi
324 pushl %edi
325 movl _vl_video_selector, %fs
326 movl _vl_current_draw_buffer, %esi
327 movl _vl_current_offset, %edi
328 movl _vl_current_stride, %ecx
329 movl _vl_current_height, %edx
330 movl _vl_current_delta, %ebx
331 .balign 4
332 0:
333 pushl %ecx
334 1:
335 movl (%esi), %eax
336 addl $4, %esi
337 CVT_32_TO_15(a, ebp)
338 movw %ax, %fs:(%edi)
339 addl $2, %edi
340 subl $2, %ecx
341 jnz 1b
342 popl %ecx
343 addl %ebx, %edi
344 decl %edx
345 jnz 0b
346 popl %edi
347 popl %esi
348 popl %ebx
349 popl %ebp
350 ret
351
352 /* transform BGRA to fake8 */
353 .p2align 5,,31
354 .global _vesa_l_dump_32_to_8
355 _vesa_l_dump_32_to_8:
356 pushl %ebp
357 pushl %ebx
358 pushl %esi
359 pushl %edi
360 movl _vl_video_selector, %fs
361 movl _vl_current_draw_buffer, %esi
362 movl _vl_current_offset, %edi
363 movl _vl_current_stride, %ecx
364 movl _vl_current_height, %edx
365 movl _vl_current_delta, %ebx
366 .balign 4
367 0:
368 pushl %edx
369 pushl %ecx
370 pushl %ebx
371 1:
372 movl (%esi), %eax
373 addl $4, %esi
374 #if 1
375 xorl %ebx, %ebx
376 movl %eax, %edx
377 movb %ah, %bl
378 shrl $16, %edx
379 andl $0xFF, %edx
380 andl $0xFF, %eax
381
382 movb _array_b(%eax), %al
383 movb _array_r(%edx), %dl
384 movb _array_g(%ebx), %bl
385
386 imull $36, %eax
387 imull $6, %ebx
388 addl %edx, %eax
389 addl %ebx, %eax
390 #endif
391 movb %al, %fs:(%edi)
392 incl %edi
393 decl %ecx
394 jnz 1b
395 popl %ebx
396 popl %ecx
397 popl %edx
398 addl %ebx, %edi
399 decl %edx
400 jnz 0b
401 popl %edi
402 popl %esi
403 popl %ebx
404 popl %ebp
405 ret
406
407 /* transform BGR to BGRx */
408 .p2align 5,,31
409 .global _vesa_l_dump_24_to_32
410 _vesa_l_dump_24_to_32:
411 pushl %ebx
412 pushl %esi
413 pushl %edi
414 movl _vl_video_selector, %fs
415 movl _vl_current_draw_buffer, %esi
416 movl _vl_current_offset, %edi
417 movl _vl_current_stride, %ecx
418 movl _vl_current_height, %edx
419 movl _vl_current_delta, %ebx
420 .balign 4
421 0:
422 pushl %ecx
423 1:
424 movl (%esi), %eax
425 addl $3, %esi
426 movl %eax, %fs:(%edi)
427 addl $4, %edi
428 subl $4, %ecx
429 jnz 1b
430 popl %ecx
431 addl %ebx, %edi
432 decl %edx
433 jnz 0b
434 popl %edi
435 popl %esi
436 popl %ebx
437 ret
438
439 /* transform BGR to fake8 */
440 .p2align 5,,31
441 .global _vesa_l_dump_24_to_8
442 _vesa_l_dump_24_to_8:
443 pushl %ebp
444 pushl %ebx
445 pushl %esi
446 pushl %edi
447 movl _vl_video_selector, %fs
448 movl _vl_current_draw_buffer, %esi
449 movl _vl_current_offset, %edi
450 movl _vl_current_stride, %ecx
451 movl _vl_current_height, %edx
452 movl _vl_current_delta, %ebx
453 .balign 4
454 0:
455 pushl %edx
456 pushl %ecx
457 pushl %ebx
458 1:
459 movl (%esi), %eax
460 addl $3, %esi
461 #if 1
462 xorl %ebx, %ebx
463 movl %eax, %edx
464 movb %ah, %bl
465 shrl $16, %edx
466 andl $0xFF, %edx
467 andl $0xFF, %eax
468
469 movb _array_b(%eax), %al
470 movb _array_r(%edx), %dl
471 movb _array_g(%ebx), %bl
472
473 imull $36, %eax
474 imull $6, %ebx
475 addl %edx, %eax
476 addl %ebx, %eax
477 #endif
478 movb %al, %fs:(%edi)
479 incl %edi
480 decl %ecx
481 jnz 1b
482 popl %ebx
483 popl %ecx
484 popl %edx
485 addl %ebx, %edi
486 decl %edx
487 jnz 0b
488 popl %edi
489 popl %esi
490 popl %ebx
491 popl %ebp
492 ret
493
494 /* transform B5G6R5 to B5G5R5 */
495 .p2align 5,,31
496 .global _vesa_l_dump_16_to_15
497 _vesa_l_dump_16_to_15:
498 pushl %ebp
499 pushl %ebx
500 pushl %esi
501 pushl %edi
502 movl _vl_video_selector, %fs
503 movl _vl_current_draw_buffer, %esi
504 movl _vl_current_offset, %edi
505 movl _vl_current_stride, %ecx
506 movl _vl_current_height, %edx
507 movl _vl_current_delta, %ebx
508 .balign 4
509 0:
510 pushl %ecx
511 1:
512 movl (%esi), %eax
513 addl $4, %esi
514 CVT_16_TO_15(eax, ebp)
515 movl %eax, %fs:(%edi)
516 addl $4, %edi
517 subl $4, %ecx
518 jnz 1b
519 popl %ecx
520 addl %ebx, %edi
521 decl %edx
522 jnz 0b
523 popl %edi
524 popl %esi
525 popl %ebx
526 popl %ebp
527 ret
528
529 /* transform B5G6R5 to fake8 */
530 .p2align 5,,31
531 .global _vesa_l_dump_16_to_8
532 _vesa_l_dump_16_to_8:
533 pushl %ebp
534 pushl %ebx
535 pushl %esi
536 pushl %edi
537 movl _vl_video_selector, %fs
538 movl _vl_current_draw_buffer, %esi
539 movl _vl_current_offset, %edi
540 movl _vl_current_stride, %ecx
541 movl _vl_current_height, %edx
542 movl _vl_current_delta, %ebx
543 .balign 4
544 0:
545 pushl %ecx
546 pushl %ebx
547 1:
548 movl (%esi), %eax
549 addl $4, %esi
550 #if 1
551 movl %eax, %ebx
552 andl $0xFFFF, %eax
553 shrl $16, %ebx
554 movb _tab_16_8(%eax), %al
555 movb _tab_16_8(%ebx), %ah
556 #endif
557 movw %ax, %fs:(%edi)
558 addl $2, %edi
559 subl $2, %ecx
560 jnz 1b
561 popl %ebx
562 popl %ecx
563 addl %ebx, %edi
564 decl %edx
565 jnz 0b
566 popl %edi
567 popl %esi
568 popl %ebx
569 popl %ebp
570 ret
571
572
573
574 .p2align 5,,31
575 .global _vesa_b_dump_32_to_24
576 _vesa_b_dump_32_to_24:
577 pushl %ebx
578 pushl %esi
579 pushl %edi
580 pushl %ebp
581 movl _vl_video_selector, %fs
582 movl _vl_current_draw_buffer, %esi
583 movl _vl_current_offset, %edi
584 movl _vesa_gran_shift, %ecx
585 movl _vesa_gran_mask, %ebp
586 movl %edi, %edx
587 xorl %ebx, %ebx
588 andl %ebp, %edi
589 shrl %cl, %edx
590 incl %ebp
591 call *_vesa_swbank
592 movl _vl_current_stride, %ecx
593 movl _vl_current_height, %eax
594 movl $0x00FFFFFF, %ebx
595 .balign 4
596 0:
597 pushl %eax
598 pushl %ecx
599 .balign 4
600 1:
601 cmpl %ebp, %edi
602 jb 2f
603 pushl %ebx
604 incl %edx
605 xorl %ebx, %ebx
606 call *_vesa_swbank
607 popl %ebx
608 subl %ebp, %edi
609 .balign 4
610 2:
611 movb (%esi), %al /* XXX too many accesses */
612 incl %esi
613 rorl $8, %ebx
614 jnc 2b
615 movb %al, %fs:(%edi)
616 incl %edi
617 decl %ecx
618 jnz 1b
619 popl %ecx
620 popl %eax
621 addl _vl_current_delta, %edi
622 decl %eax
623 jnz 0b
624 popl %ebp
625 popl %edi
626 popl %esi
627 popl %ebx
628 ret
629
630 .p2align 5,,31
631 .global _vesa_b_dump_32_to_16
632 _vesa_b_dump_32_to_16:
633 pushl %ebx
634 pushl %esi
635 pushl %edi
636 pushl %ebp
637 movl _vl_video_selector, %fs
638 movl _vl_current_draw_buffer, %esi
639 movl _vl_current_offset, %edi
640 movl _vesa_gran_shift, %ecx
641 movl _vesa_gran_mask, %ebp
642 movl %edi, %edx
643 xorl %ebx, %ebx
644 andl %ebp, %edi
645 shrl %cl, %edx
646 incl %ebp
647 call *_vesa_swbank
648 movl _vl_current_stride, %ecx
649 movl _vl_current_height, %eax
650 .balign 4
651 0:
652 pushl %eax
653 pushl %ecx
654 .balign 4
655 1:
656 cmpl %ebp, %edi
657 jb 2f
658 incl %edx
659 xorl %ebx, %ebx
660 call *_vesa_swbank
661 subl %ebp, %edi
662 .balign 4
663 2:
664 movl (%esi), %eax
665 addl $4, %esi
666 CVT_32_TO_16(a, ebx)
667 movw %ax, %fs:(%edi)
668 addl $2, %edi
669 subl $2, %ecx
670 jnz 1b
671 popl %ecx
672 popl %eax
673 addl _vl_current_delta, %edi
674 decl %eax
675 jnz 0b
676 popl %ebp
677 popl %edi
678 popl %esi
679 popl %ebx
680 ret
681
682 .p2align 5,,31
683 .global _vesa_b_dump_32_to_15
684 _vesa_b_dump_32_to_15:
685 pushl %ebx
686 pushl %esi
687 pushl %edi
688 pushl %ebp
689 movl _vl_video_selector, %fs
690 movl _vl_current_draw_buffer, %esi
691 movl _vl_current_offset, %edi
692 movl _vesa_gran_shift, %ecx
693 movl _vesa_gran_mask, %ebp
694 movl %edi, %edx
695 xorl %ebx, %ebx
696 andl %ebp, %edi
697 shrl %cl, %edx
698 incl %ebp
699 call *_vesa_swbank
700 movl _vl_current_stride, %ecx
701 movl _vl_current_height, %eax
702 .balign 4
703 0:
704 pushl %eax
705 pushl %ecx
706 .balign 4
707 1:
708 cmpl %ebp, %edi
709 jb 2f
710 incl %edx
711 xorl %ebx, %ebx
712 call *_vesa_swbank
713 subl %ebp, %edi
714 .balign 4
715 2:
716 movl (%esi), %eax
717 addl $4, %esi
718 CVT_32_TO_15(a, ebx)
719 movw %ax, %fs:(%edi)
720 addl $2, %edi
721 subl $2, %ecx
722 jnz 1b
723 popl %ecx
724 popl %eax
725 addl _vl_current_delta, %edi
726 decl %eax
727 jnz 0b
728 popl %ebp
729 popl %edi
730 popl %esi
731 popl %ebx
732 ret
733
734 .p2align 5,,31
735 .global _vesa_b_dump_32_to_8
736 _vesa_b_dump_32_to_8:
737 pushl %ebx
738 pushl %esi
739 pushl %edi
740 pushl %ebp
741 movl _vl_video_selector, %fs
742 movl _vl_current_draw_buffer, %esi
743 movl _vl_current_offset, %edi
744 movl _vesa_gran_shift, %ecx
745 movl _vesa_gran_mask, %ebp
746 movl %edi, %edx
747 xorl %ebx, %ebx
748 andl %ebp, %edi
749 shrl %cl, %edx
750 incl %ebp
751 call *_vesa_swbank
752 movl _vl_current_stride, %ecx
753 movl _vl_current_height, %eax
754 .balign 4
755 0:
756 pushl %eax
757 pushl %ecx
758 pushl %edx
759 .balign 4
760 1:
761 cmpl %ebp, %edi
762 jb 2f
763 popl %edx
764 incl %edx
765 pushl %edx
766 xorl %ebx, %ebx
767 call *_vesa_swbank
768 subl %ebp, %edi
769 .balign 4
770 2:
771 movl (%esi), %eax
772 addl $4, %esi
773 #if 1
774 xorl %ebx, %ebx
775 movl %eax, %edx
776 movb %ah, %bl
777 shrl $16, %edx
778 andl $0xFF, %edx
779 andl $0xFF, %eax
780
781 movb _array_b(%eax), %al
782 movb _array_r(%edx), %dl
783 movb _array_g(%ebx), %bl
784
785 imull $36, %eax
786 imull $6, %ebx
787 addl %edx, %eax
788 addl %ebx, %eax
789 #endif
790 movb %al, %fs:(%edi)
791 incl %edi
792 decl %ecx
793 jnz 1b
794 popl %edx
795 popl %ecx
796 popl %eax
797 addl _vl_current_delta, %edi
798 decl %eax
799 jnz 0b
800 popl %ebp
801 popl %edi
802 popl %esi
803 popl %ebx
804 ret
805
806 .p2align 5,,31
807 .global _vesa_b_dump_24_to_32
808 _vesa_b_dump_24_to_32:
809 pushl %ebx
810 pushl %esi
811 pushl %edi
812 pushl %ebp
813 movl _vl_video_selector, %fs
814 movl _vl_current_draw_buffer, %esi
815 movl _vl_current_offset, %edi
816 movl _vesa_gran_shift, %ecx
817 movl _vesa_gran_mask, %ebp
818 movl %edi, %edx
819 xorl %ebx, %ebx
820 andl %ebp, %edi
821 shrl %cl, %edx
822 incl %ebp
823 call *_vesa_swbank
824 movl _vl_current_stride, %ecx
825 movl _vl_current_height, %eax
826 movl _vl_current_delta, %ebx
827 .balign 4
828 0:
829 pushl %eax
830 pushl %ecx
831 .balign 4
832 1:
833 cmpl %ebp, %edi
834 jb 2f
835 pushl %ebx
836 incl %edx
837 xorl %ebx, %ebx
838 call *_vesa_swbank
839 popl %ebx
840 subl %ebp, %edi
841 .balign 4
842 2:
843 movl (%esi), %eax
844 addl $3, %esi
845 movl %eax, %fs:(%edi)
846 addl $4, %edi
847 subl $4, %ecx
848 jnz 1b
849 popl %ecx
850 popl %eax
851 addl %ebx, %edi
852 decl %eax
853 jnz 0b
854 popl %ebp
855 popl %edi
856 popl %esi
857 popl %ebx
858 ret
859
860 .p2align 5,,31
861 .global _vesa_b_dump_24_to_8
862 _vesa_b_dump_24_to_8:
863 pushl %ebx
864 pushl %esi
865 pushl %edi
866 pushl %ebp
867 movl _vl_video_selector, %fs
868 movl _vl_current_draw_buffer, %esi
869 movl _vl_current_offset, %edi
870 movl _vesa_gran_shift, %ecx
871 movl _vesa_gran_mask, %ebp
872 movl %edi, %edx
873 xorl %ebx, %ebx
874 andl %ebp, %edi
875 shrl %cl, %edx
876 incl %ebp
877 call *_vesa_swbank
878 movl _vl_current_stride, %ecx
879 movl _vl_current_height, %eax
880 .balign 4
881 0:
882 pushl %eax
883 pushl %ecx
884 pushl %edx
885 .balign 4
886 1:
887 cmpl %ebp, %edi
888 jb 2f
889 popl %edx
890 incl %edx
891 pushl %edx
892 xorl %ebx, %ebx
893 call *_vesa_swbank
894 subl %ebp, %edi
895 .balign 4
896 2:
897 movl (%esi), %eax
898 addl $3, %esi
899 #if 1
900 xorl %ebx, %ebx
901 movl %eax, %edx
902 movb %ah, %bl
903 shrl $16, %edx
904 andl $0xFF, %edx
905 andl $0xFF, %eax
906
907 movb _array_b(%eax), %al
908 movb _array_r(%edx), %dl
909 movb _array_g(%ebx), %bl
910
911 imull $36, %eax
912 imull $6, %ebx
913 addl %edx, %eax
914 addl %ebx, %eax
915 #endif
916 movb %al, %fs:(%edi)
917 incl %edi
918 decl %ecx
919 jnz 1b
920 popl %edx
921 popl %ecx
922 popl %eax
923 addl _vl_current_delta, %edi
924 decl %eax
925 jnz 0b
926 popl %ebp
927 popl %edi
928 popl %esi
929 popl %ebx
930 ret
931
932 .p2align 5,,31
933 .global _vesa_b_dump_16_to_15
934 _vesa_b_dump_16_to_15:
935 pushl %ebx
936 pushl %esi
937 pushl %edi
938 pushl %ebp
939 movl _vl_video_selector, %fs
940 movl _vl_current_draw_buffer, %esi
941 movl _vl_current_offset, %edi
942 movl _vesa_gran_shift, %ecx
943 movl _vesa_gran_mask, %ebp
944 movl %edi, %edx
945 xorl %ebx, %ebx
946 andl %ebp, %edi
947 shrl %cl, %edx
948 incl %ebp
949 call *_vesa_swbank
950 movl _vl_current_stride, %ecx
951 movl _vl_current_height, %eax
952 .balign 4
953 0:
954 pushl %eax
955 pushl %ecx
956 .balign 4
957 1:
958 cmpl %ebp, %edi
959 jb 2f
960 incl %edx
961 xorl %ebx, %ebx
962 call *_vesa_swbank
963 subl %ebp, %edi
964 .balign 4
965 2:
966 movw (%esi), %ax
967 addl $2, %esi
968 CVT_16_TO_15(eax, ebx)
969 movw %ax, %fs:(%edi)
970 addl $2, %edi
971 subl $2, %ecx
972 jnz 1b
973 popl %ecx
974 popl %eax
975 addl _vl_current_delta, %edi
976 decl %eax
977 jnz 0b
978 popl %ebp
979 popl %edi
980 popl %esi
981 popl %ebx
982 ret
983
984 .p2align 5,,31
985 .global _vesa_b_dump_16_to_8
986 _vesa_b_dump_16_to_8:
987 pushl %ebx
988 pushl %esi
989 pushl %edi
990 pushl %ebp
991 movl _vl_video_selector, %fs
992 movl _vl_current_draw_buffer, %esi
993 movl _vl_current_offset, %edi
994 movl _vesa_gran_shift, %ecx
995 movl _vesa_gran_mask, %ebp
996 movl %edi, %edx
997 xorl %ebx, %ebx
998 andl %ebp, %edi
999 shrl %cl, %edx
1000 incl %ebp
1001 call *_vesa_swbank
1002 movl _vl_current_stride, %ecx
1003 movl _vl_current_height, %eax
1004 movl _vl_current_delta, %ebx
1005 .balign 4
1006 0:
1007 pushl %eax
1008 pushl %ecx
1009 .balign 4
1010 1:
1011 cmpl %ebp, %edi
1012 jb 2f
1013 pushl %ebx
1014 incl %edx
1015 xorl %ebx, %ebx
1016 call *_vesa_swbank
1017 popl %ebx
1018 subl %ebp, %edi
1019 .balign 4
1020 2:
1021 movw (%esi), %ax
1022 addl $2, %esi
1023 #if 1
1024 andl $0xFFFF, %eax
1025 movb _tab_16_8(%eax), %al
1026 #endif
1027 movb %al, %fs:(%edi)
1028 addl $1, %edi
1029 subl $1, %ecx
1030 jnz 1b
1031 popl %ecx
1032 popl %eax
1033 addl %ebx, %edi
1034 decl %eax
1035 jnz 0b
1036 popl %ebp
1037 popl %edi
1038 popl %esi
1039 popl %ebx
1040 ret