VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/BIOS/vgarom.asm@ 83113

Last change on this file since 83113 was 83002, checked in by vboxsync, 5 years ago

VGABIOS: Further reduced mode set stack usage, centralized cld invocation, reduced explicit C000 segment usage.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 20.5 KB
Line 
1;; ============================================================================================
2;;
3;; Copyright (C) 2001,2002 the LGPL VGABios developers Team
4;;
5;; This library is free software; you can redistribute it and/or
6;; modify it under the terms of the GNU Lesser General Public
7;; License as published by the Free Software Foundation; either
8;; version 2 of the License, or (at your option) any later version.
9;;
10;; This library is distributed in the hope that it will be useful,
11;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13;; Lesser General Public License for more details.
14;;
15;; You should have received a copy of the GNU Lesser General Public
16;; License along with this library; if not, write to the Free Software
17;; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18;;
19;; ============================================================================================
20;;
21;; This VGA Bios is specific to the plex86/bochs Emulated VGA card.
22;; You can NOT drive any physical vga card with it.
23;;
24;; ============================================================================================
25;;
26
27
28; Oracle LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
29; other than GPL or LGPL is available it will apply instead, Oracle elects to use only
30; the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
31; a choice of LGPL license versions is made available with the language indicating
32; that LGPLv2 or any later version may be used, or where a choice of which version
33; of the LGPL is applied is otherwise unspecified.
34
35include vgadefs.inc
36include commondefs.inc
37
38public vgabios_int10_handler
39
40VGAROM segment public 'CODE'
41
42; Implemented in C
43extrn _int10_func:near
44extrn _vgabios_init_func:near
45
46ifdef VBE
47; Implemented in separate assembly module
48extrn vbe_biosfn_return_current_mode:near
49extrn vbe_biosfn_display_window_control:near
50extrn vbe_biosfn_set_get_display_start:near
51extrn vbe_biosfn_set_get_dac_palette_format:near
52extrn vbe_biosfn_set_get_palette_data:near
53extrn vbe_biosfn_return_protected_mode_interface:near
54endif
55
56ifdef VGA_DEBUG
57extrn _int10_debugmsg:near
58extrn _printf:near
59extrn _unimplemented:near
60extrn _unknown:near
61endif
62
63vgabios_start:
64
65db 055h, 0AAh ; ROM signature, required for expansion ROMs
66db 40h ; ROM module length in units of 512 bytes */
67
68
69vgabios_entry_point:
70
71 jmp _vgabios_init_func
72
73 org 1Eh
74
75 db 'IBM',0
76
77;;
78;; int10 handled here
79;;
80
81SET_DEFAULT_CPU_286
82
83vgabios_int10_handler:
84 pushf
85ifdef VGA_DEBUG
86 push es
87 push ds
88 DO_pusha
89 push cs
90 pop ds
91 cld
92 call _int10_debugmsg
93 DO_popa
94 pop ds
95 pop es
96endif
97 cmp ah, 0Fh
98 jne int10_test_1A
99 call biosfn_get_video_mode
100 jmp int10_end
101int10_test_1A:
102 cmp ah, 1Ah
103 jne int10_test_0B
104 call biosfn_group_1A
105 jmp int10_end
106int10_test_0B:
107 cmp ah, 0Bh
108 jne int10_test_1103
109 call biosfn_group_0B
110 jmp int10_end
111int10_test_1103:
112 cmp ax, 1103h
113 jne int10_test_12
114 call biosfn_set_text_block_specifier
115 jmp int10_end
116int10_test_12:
117 cmp ah, 12h
118 jne int10_test_101B
119 cmp bl, 10h
120 jne int10_test_BL30
121 call biosfn_get_ega_info
122 jmp int10_end
123int10_test_BL30:
124 cmp bl, 30h
125 jne int10_test_BL31
126 call biosfn_select_vert_res
127 jmp int10_end
128int10_test_BL31:
129 cmp bl, 31h
130 jne int10_test_BL32
131 call biosfn_enable_default_palette_loading
132 jmp int10_end
133int10_test_BL32:
134 cmp bl, 32h
135 jne int10_test_BL33
136 call biosfn_enable_video_addressing
137 jmp int10_end
138int10_test_BL33:
139 cmp bl, 33h
140 jne int10_test_BL34
141 call biosfn_enable_grayscale_summing
142 jmp int10_end
143int10_test_BL34:
144 cmp bl, 34h
145 jne int10_normal
146 call biosfn_enable_cursor_emulation
147 jmp int10_end
148int10_test_101B:
149 cmp ax, 101Bh
150 je int10_normal
151 cmp ah, 10h
152ifndef VBE
153 jne int10_normal
154else
155 jne int10_test_4F
156endif
157 call biosfn_group_10
158 jmp int10_end
159ifdef VBE
160int10_test_4F:
161 cmp ah, 4Fh
162 jne int10_normal
163 cmp al, 3
164 jne int10_test_vbe_05
165 call vbe_biosfn_return_current_mode
166 jmp int10_end
167int10_test_vbe_05:
168 cmp al, 5
169 jne int10_test_vbe_07
170 call vbe_biosfn_display_window_control
171 jmp int10_end
172int10_test_vbe_07:
173 cmp al, 7
174 jne int10_test_vbe_08
175 call vbe_biosfn_set_get_display_start
176 jmp int10_end
177int10_test_vbe_08:
178 cmp al, 8
179 jne int10_test_vbe_09
180 call vbe_biosfn_set_get_dac_palette_format
181 jmp int10_end
182int10_test_vbe_09:
183 cmp al, 9
184 jne int10_test_vbe_0A
185 call vbe_biosfn_set_get_palette_data
186 jmp int10_end
187int10_test_vbe_0A:
188 cmp al, 0Ah
189 jne int10_normal
190 call vbe_biosfn_return_protected_mode_interface
191 jmp int10_end
192endif
193
194int10_normal:
195 push es
196 push ds
197 DO_pusha
198
199;; We have to set ds to access the right data segment
200 push cs
201 pop ds
202 cld
203 call _int10_func
204
205 DO_popa
206 pop ds
207 pop es
208int10_end:
209 popf
210 iret
211
212;;--------------------------------------------------------------------------------------------
213
214biosfn_group_0B:
215 cmp bh, 0
216 je biosfn_set_border_color
217 cmp bh, 1
218 je biosfn_set_palette
219ifdef VGA_DEBUG
220 call _unknown
221endif
222 ret
223biosfn_set_border_color:
224 push ax
225 push bx
226 push cx
227 push dx
228 push ds
229 mov dx, BIOSMEM_SEG
230 mov ds, dx
231 mov dx, VGAREG_ACTL_RESET
232 in al, dx
233 cmp byte ptr ds:[BIOSMEM_CURRENT_MODE], 3
234 jbe set_border_done
235 mov dx, VGAREG_ACTL_ADDRESS
236 mov al, 00h
237 out dx, al
238 mov al, bl
239 and al, 0Fh
240 test al, 08h
241 jz set_low_border
242 add al, 08h
243set_low_border:
244 out dx, al
245 mov cl, 1
246 and bl, 10h
247set_intensity_loop:
248 mov dx, VGAREG_ACTL_ADDRESS
249 mov al, cl
250 out dx, al
251 mov dx, VGAREG_ACTL_READ_DATA
252 in al, dx
253 and al, 0EFh
254 or al, bl
255 mov dx, VGAREG_ACTL_ADDRESS
256 out dx, al
257 inc cl
258 cmp cl, 4
259 jne set_intensity_loop
260set_border_done:
261 mov al, 20h
262 out dx, al
263ifdef VBOX
264 mov dx, VGAREG_ACTL_RESET
265 in al, dx
266endif ; VBOX
267 pop ds
268 pop dx
269 pop cx
270 pop bx
271 pop ax
272 ret
273biosfn_set_palette:
274 push ax
275 push bx
276 push cx
277 push dx
278 mov dx, VGAREG_ACTL_RESET
279 in al, dx
280 mov cl, 01
281 and bl, 01
282set_cga_palette_loop:
283 mov dx, VGAREG_ACTL_ADDRESS
284 mov al, cl
285 out dx, al
286 mov dx, VGAREG_ACTL_READ_DATA
287 in al, dx
288 and al, 0FEh
289 or al, bl
290 mov dx, VGAREG_ACTL_ADDRESS
291 out dx, al
292 inc cl
293 cmp cl, 4
294 jne set_cga_palette_loop
295 mov al, 20h
296 out dx, al
297ifdef VBOX
298 mov dx, VGAREG_ACTL_RESET
299 in al, dx
300endif ; VBOX
301 pop dx
302 pop cx
303 pop bx
304 pop ax
305 ret
306
307;;--------------------------------------------------------------------------------------------
308
309biosfn_get_video_mode:
310 push ds
311 mov ax, BIOSMEM_SEG
312 mov ds, ax
313 push bx
314 mov bx, BIOSMEM_CURRENT_PAGE
315 mov al, [bx]
316 pop bx
317 mov bh, al
318 push bx
319 mov bx, BIOSMEM_VIDEO_CTL
320 mov ah, [bx]
321 and ah, 80h
322 mov bx, BIOSMEM_CURRENT_MODE
323 mov al, [bx]
324 or al, ah
325 mov bx, BIOSMEM_NB_COLS
326 mov ah, [bx]
327 pop bx
328 pop ds
329 ret
330
331;--------------------------------------------------------------------------------------------
332
333biosfn_group_10:
334 cmp al, 0
335 jne int10_test_1001
336 jmp biosfn_set_single_palette_reg
337int10_test_1001:
338 cmp al, 1
339 jne int10_test_1002
340 jmp biosfn_set_overscan_border_color
341int10_test_1002:
342 cmp al, 2
343 jne int10_test_1003
344 jmp biosfn_set_all_palette_reg
345int10_test_1003:
346 cmp al, 3
347 jne int10_test_1007
348 jmp biosfn_toggle_intensity
349int10_test_1007:
350 cmp al, 7
351 jne int10_test_1008
352 jmp biosfn_get_single_palette_reg
353int10_test_1008:
354 cmp al, 8
355 jne int10_test_1009
356 jmp biosfn_read_overscan_border_color
357int10_test_1009:
358 cmp al, 9
359 jne int10_test_1010
360 jmp biosfn_get_all_palette_reg
361int10_test_1010:
362 cmp al, 10h
363 jne int10_test_1012
364 jmp biosfn_set_single_dac_reg
365int10_test_1012:
366 cmp al, 12h
367 jne int10_test_1013
368 jmp biosfn_set_all_dac_reg
369int10_test_1013:
370 cmp al, 13h
371 jne int10_test_1015
372 jmp biosfn_select_video_dac_color_page
373int10_test_1015:
374 cmp al, 15h
375 jne int10_test_1017
376 jmp biosfn_read_single_dac_reg
377int10_test_1017:
378 cmp al, 17h
379 jne int10_test_1018
380 jmp biosfn_read_all_dac_reg
381int10_test_1018:
382 cmp al, 18h
383 jne int10_test_1019
384 jmp biosfn_set_pel_mask
385int10_test_1019:
386 cmp al, 19h
387 jne int10_test_101A
388 jmp biosfn_read_pel_mask
389int10_test_101A:
390 cmp al, 1Ah
391 jne int10_group_10_unknown
392 jmp biosfn_read_video_dac_state
393int10_group_10_unknown:
394ifdef VGA_DEBUG
395 call _unknown
396endif
397 ret
398
399biosfn_set_single_palette_reg:
400 cmp bl, 14h
401 ja no_actl_reg1
402 push ax
403 push dx
404 mov dx, VGAREG_ACTL_RESET
405 in al, dx
406 mov dx, VGAREG_ACTL_ADDRESS
407 mov al, bl
408 out dx, al
409 mov al, bh
410 out dx, al
411 mov al, 20h
412 out dx, al
413ifdef VBOX
414 mov dx, VGAREG_ACTL_RESET
415 in al, dx
416endif ; VBOX
417 pop dx
418 pop ax
419no_actl_reg1:
420 ret
421
422;--------------------------------------------------------------------------------------------
423
424biosfn_set_overscan_border_color:
425 push bx
426 mov bl, 11h
427 call biosfn_set_single_palette_reg
428 pop bx
429 ret
430
431;--------------------------------------------------------------------------------------------
432
433biosfn_set_all_palette_reg:
434 push ax
435 push bx
436 push cx
437 push dx
438 mov bx, dx
439 mov dx, VGAREG_ACTL_RESET
440 in al, dx
441 mov cl, 0
442 mov dx, VGAREG_ACTL_ADDRESS
443set_palette_loop:
444 mov al, cl
445 out dx, al
446 mov al, es:[bx]
447 out dx, al
448 inc bx
449 inc cl
450 cmp cl, 10h
451 jne set_palette_loop
452 mov al, 11h
453 out dx, al
454 mov al, es:[bx]
455 out dx, al
456 mov al, 20h
457 out dx, al
458ifdef VBOX
459 mov dx, VGAREG_ACTL_RESET
460 in al, dx
461endif ; VBOX
462 pop dx
463 pop cx
464 pop bx
465 pop ax
466 ret
467
468;;--------------------------------------------------------------------------------------------
469
470biosfn_toggle_intensity:
471 push ax
472 push bx
473 push dx
474 mov dx, VGAREG_ACTL_RESET
475 in al, dx
476 mov dx, VGAREG_ACTL_ADDRESS
477 mov al, 10h
478 out dx, al
479 mov dx, VGAREG_ACTL_READ_DATA
480 in al, dx
481 and al, 0F7h
482 and bl, 01
483if VBOX_BIOS_CPU gt 8086
484 shl bl, 3
485else
486 shl bl, 1
487 shl bl, 1
488 shl bl, 1
489endif
490 or al, bl
491 mov dx, VGAREG_ACTL_ADDRESS
492 out dx, al
493 mov al, 20h
494 out dx, al
495ifdef VBOX
496 mov dx, VGAREG_ACTL_RESET
497 in al, dx
498endif ; VBOX
499 pop dx
500 pop bx
501 pop ax
502 ret
503
504;;--------------------------------------------------------------------------------------------
505
506biosfn_get_single_palette_reg:
507 cmp bl, 14h
508 ja no_actl_reg2
509 push ax
510 push dx
511 mov dx, VGAREG_ACTL_RESET
512 in al, dx
513 mov dx, VGAREG_ACTL_ADDRESS
514 mov al, bl
515 out dx, al
516 mov dx, VGAREG_ACTL_READ_DATA
517 in al, dx
518 mov bh, al
519 mov dx, VGAREG_ACTL_RESET
520 in al, dx
521 mov dx, VGAREG_ACTL_ADDRESS
522 mov al, 20h
523 out dx, al
524ifdef VBOX
525 mov dx, VGAREG_ACTL_RESET
526 in al, dx
527endif ; VBOX
528 pop dx
529 pop ax
530no_actl_reg2:
531 ret
532
533;;--------------------------------------------------------------------------------------------
534
535biosfn_read_overscan_border_color:
536 push ax
537 push bx
538 mov bl, 11h
539 call biosfn_get_single_palette_reg
540 mov al, bh
541 pop bx
542 mov bh, al
543 pop ax
544 ret
545
546;;--------------------------------------------------------------------------------------------
547
548biosfn_get_all_palette_reg:
549 push ax
550 push bx
551 push cx
552 push dx
553 mov bx, dx
554 mov cl, 0
555get_palette_loop:
556 mov dx, VGAREG_ACTL_RESET
557 in al, dx
558 mov dx, VGAREG_ACTL_ADDRESS
559 mov al, cl
560 out dx, al
561 mov dx, VGAREG_ACTL_READ_DATA
562 in al, dx
563 mov es:[bx], al
564 inc bx
565 inc cl
566 cmp cl, 10h
567 jne get_palette_loop
568 mov dx, VGAREG_ACTL_RESET
569 in al, dx
570 mov dx, VGAREG_ACTL_ADDRESS
571 mov al, 11h
572 out dx, al
573 mov dx, VGAREG_ACTL_READ_DATA
574 in al, dx
575 mov es:[bx], al
576 mov dx, VGAREG_ACTL_RESET
577 in al, dx
578 mov dx, VGAREG_ACTL_ADDRESS
579 mov al, 20h
580 out dx, al
581ifdef VBOX
582 mov dx, VGAREG_ACTL_RESET
583 in al, dx
584endif ; VBOX
585 pop dx
586 pop cx
587 pop bx
588 pop ax
589 ret
590
591;;--------------------------------------------------------------------------------------------
592
593biosfn_set_single_dac_reg:
594 push ax
595 push dx
596 mov dx, VGAREG_DAC_WRITE_ADDRESS
597 mov al, bl
598 out dx, al
599 mov dx, VGAREG_DAC_DATA
600 pop ax
601 push ax
602 mov al, ah
603 out dx, al
604 mov al, ch
605 out dx, al
606 mov al, cl
607 out dx, al
608 pop dx
609 pop ax
610 ret
611
612;;--------------------------------------------------------------------------------------------
613
614biosfn_set_all_dac_reg:
615 push ax
616 push bx
617 push cx
618 push dx
619 mov dx, VGAREG_DAC_WRITE_ADDRESS
620 mov al, bl
621 out dx, al
622 pop dx
623 push dx
624 mov bx, dx
625 mov dx, VGAREG_DAC_DATA
626set_dac_loop:
627 mov al, es:[bx]
628 out dx, al
629 inc bx
630 mov al, es:[bx]
631 out dx, al
632 inc bx
633 mov al, es:[bx]
634 out dx, al
635 inc bx
636 dec cx
637 jnz set_dac_loop
638 pop dx
639 pop cx
640 pop bx
641 pop ax
642 ret
643
644;;--------------------------------------------------------------------------------------------
645
646biosfn_select_video_dac_color_page:
647 push ax
648 push bx
649 push dx
650 mov dx, VGAREG_ACTL_RESET
651 in al, dx
652 mov dx, VGAREG_ACTL_ADDRESS
653 mov al, 10h
654 out dx, al
655 mov dx, VGAREG_ACTL_READ_DATA
656 in al, dx
657 and bl, 01
658 jnz set_dac_page
659 and al, 07Fh
660if VBOX_BIOS_CPU gt 8086
661 shl bh, 7
662else
663 shl bh, 1
664 shl bh, 1
665 shl bh, 1
666 shl bh, 1
667 shl bh, 1
668 shl bh, 1
669 shl bh, 1
670endif
671 or al, bh
672 mov dx, VGAREG_ACTL_ADDRESS
673 out dx, al
674 jmp set_actl_normal
675set_dac_page:
676 push ax
677 mov dx, VGAREG_ACTL_RESET
678 in al, dx
679 mov dx, VGAREG_ACTL_ADDRESS
680 mov al, 14h
681 out dx, al
682 pop ax
683 and al, 80h
684 jnz set_dac_16_page
685if VBOX_BIOS_CPU gt 8086
686 shl bh, 2
687else
688 shl bh, 1
689 shl bh, 1
690endif
691set_dac_16_page:
692 and bh, 0Fh
693 mov al, bh
694 out dx, al
695set_actl_normal:
696 mov al, 20h
697 out dx, al
698ifdef VBOX
699 mov dx, VGAREG_ACTL_RESET
700 in al, dx
701endif ; VBOX
702 pop dx
703 pop bx
704 pop ax
705 ret
706
707;;--------------------------------------------------------------------------------------------
708
709biosfn_read_single_dac_reg:
710 push ax
711 push dx
712 mov dx, VGAREG_DAC_READ_ADDRESS
713 mov al, bl
714 out dx, al
715 pop ax
716 mov ah, al
717 mov dx, VGAREG_DAC_DATA
718 in al, dx
719 xchg al, ah
720 push ax
721 in al, dx
722 mov ch, al
723 in al, dx
724 mov cl, al
725 pop dx
726 pop ax
727 ret
728
729;;--------------------------------------------------------------------------------------------
730
731biosfn_read_all_dac_reg:
732 push ax
733 push bx
734 push cx
735 push dx
736 mov dx, VGAREG_DAC_READ_ADDRESS
737 mov al, bl
738 out dx, al
739 pop dx
740 push dx
741 mov bx, dx
742 mov dx, VGAREG_DAC_DATA
743read_dac_loop:
744 in al, dx
745 mov es:[bx], al
746 inc bx
747 in al, dx
748 mov es:[bx], al
749 inc bx
750 in al, dx
751 mov es:[bx], al
752 inc bx
753 dec cx
754 jnz read_dac_loop
755 pop dx
756 pop cx
757 pop bx
758 pop ax
759 ret
760
761;;--------------------------------------------------------------------------------------------
762
763biosfn_set_pel_mask:
764 push ax
765 push dx
766 mov dx, VGAREG_PEL_MASK
767 mov al, bl
768 out dx, al
769 pop dx
770 pop ax
771 ret
772
773;;--------------------------------------------------------------------------------------------
774
775biosfn_read_pel_mask:
776 push ax
777 push dx
778 mov dx, VGAREG_PEL_MASK
779 in al, dx
780 mov bl, al
781 pop dx
782 pop ax
783 ret
784
785;;--------------------------------------------------------------------------------------------
786
787biosfn_read_video_dac_state:
788 push ax
789 push dx
790 mov dx, VGAREG_ACTL_RESET
791 in al, dx
792 mov dx, VGAREG_ACTL_ADDRESS
793 mov al, 10h
794 out dx, al
795 mov dx, VGAREG_ACTL_READ_DATA
796 in al, dx
797 mov bl, al
798if VBOX_BIOS_CPU gt 8086
799 shr bl, 7
800else
801 shr bl, 1
802 shr bl, 1
803 shr bl, 1
804 shr bl, 1
805 shr bl, 1
806 shr bl, 1
807 shr bl, 1
808endif
809 mov dx, VGAREG_ACTL_RESET
810 in al, dx
811 mov dx, VGAREG_ACTL_ADDRESS
812 mov al, 14h
813 out dx, al
814 mov dx, VGAREG_ACTL_READ_DATA
815 in al, dx
816 mov bh, al
817 and bh, 0Fh
818 test bl, 01
819 jnz get_dac_16_page
820if VBOX_BIOS_CPU gt 8086
821 shr bh, 2
822else
823 shr bh, 1
824 shr bh, 1
825endif
826get_dac_16_page:
827 mov dx, VGAREG_ACTL_RESET
828 in al, dx
829 mov dx, VGAREG_ACTL_ADDRESS
830 mov al, 20h
831 out dx, al
832ifdef VBOX
833 mov dx, VGAREG_ACTL_RESET
834 in al, dx
835endif ; VBOX
836 pop dx
837 pop ax
838 ret
839
840;;--------------------------------------------------------------------------------------------
841
842biosfn_set_text_block_specifier:
843 push ax
844 push dx
845 mov dx, VGAREG_SEQU_ADDRESS
846 mov ah, bl
847 mov al, 03
848 out dx, ax
849 pop dx
850 pop ax
851 ret
852
853;;--------------------------------------------------------------------------------------------
854
855biosfn_get_ega_info:
856 push ds
857 push ax
858 mov ax, BIOSMEM_SEG
859 mov ds, ax
860 xor ch, ch
861 mov bx, BIOSMEM_SWITCHES
862 mov cl, [bx]
863 and cl, 0Fh
864 mov bx, BIOSMEM_CRTC_ADDRESS
865 mov ax, [bx]
866 mov bx, 0003h
867 cmp ax, VGAREG_MDA_CRTC_ADDRESS
868 jne mode_ega_color
869 mov bh, 01
870mode_ega_color:
871 pop ax
872 pop ds
873 ret
874
875;;--------------------------------------------------------------------------------------------
876
877biosfn_select_vert_res:
878
879; res : 00 200 lines, 01 350 lines, 02 400 lines
880
881 push ds
882 push bx
883 push dx
884 mov dl, al
885 mov ax, BIOSMEM_SEG
886 mov ds, ax
887 mov bx, BIOSMEM_MODESET_CTL
888 mov al, [bx]
889 mov bx, BIOSMEM_SWITCHES
890 mov ah, [bx]
891 cmp dl, 1
892 je vert_res_350
893 jb vert_res_200
894 cmp dl, 2
895 je vert_res_400
896ifdef VGA_DEBUG
897 mov al, dl
898 xor ah, ah
899 push ax
900 mov bx, msg_vert_res
901 push bx
902 call _printf
903 add sp, 4
904endif
905 jmp set_retcode
906vert_res_400:
907
908 ; reset modeset ctl bit 7 and set bit 4
909 ; set switches bit 3-0 to 09
910
911 and al, 07Fh
912 or al, 010h
913 and ah, 0F0h
914 or ah, 009h
915 jnz set_vert_res
916vert_res_350:
917
918 ; reset modeset ctl bit 7 and bit 4
919 ; set switches bit 3-0 to 09
920
921 and al, 06Fh
922 and ah, 0F0h
923 or ah, 009h
924 jnz set_vert_res
925vert_res_200:
926
927 ; set modeset ctl bit 7 and reset bit 4
928 ; set switches bit 3-0 to 08
929
930 and al, 0EFh
931 or al, 080h
932 and ah, 0F0h
933 or ah, 008h
934set_vert_res:
935 mov bx, BIOSMEM_MODESET_CTL
936 mov [bx], al
937 mov bx, BIOSMEM_SWITCHES
938 mov [bx], ah
939set_retcode:
940 mov ax, 1212h
941 pop dx
942 pop bx
943 pop ds
944 ret
945
946ifdef VGA_DEBUG
947msg_vert_res:
948db "Select vert res (%02x) was discarded", 13, 10, 0
949endif
950
951
952biosfn_enable_default_palette_loading:
953 push ds
954 push bx
955 push dx
956 mov dl, al
957 and dl, 01
958if VBOX_BIOS_CPU gt 8086
959 shl dl, 3
960else
961 shl dl, 1
962 shl dl, 1
963 shl dl, 1
964endif
965 mov ax, BIOSMEM_SEG
966 mov ds, ax
967 mov bx, BIOSMEM_MODESET_CTL
968 mov al, [bx]
969 and al, 0F7h
970 or al, dl
971 mov [bx], al
972 mov ax, 1212h
973 pop dx
974 pop bx
975 pop ds
976 ret
977
978
979biosfn_enable_video_addressing:
980 push bx
981 push dx
982 mov bl, al
983 and bl, 01
984 xor bl, 01
985 shl bl, 1
986 mov dx, VGAREG_READ_MISC_OUTPUT
987 in al, dx
988 and al, 0FDh
989 or al, bl
990 mov dx, VGAREG_WRITE_MISC_OUTPUT
991 out dx, al
992 mov ax, 1212h
993 pop dx
994 pop bx
995 ret
996
997
998biosfn_enable_grayscale_summing:
999 push ds
1000 push bx
1001 push dx
1002 mov dl, al
1003 and dl, 01h
1004 xor dl, 01h
1005 shl dl, 1
1006 mov ax, BIOSMEM_SEG
1007 mov ds, ax
1008 mov bx, BIOSMEM_MODESET_CTL
1009 mov al, [bx]
1010 and al, 0FDh
1011 or al, dl
1012 mov [bx], al
1013 mov ax, 1212h
1014 pop dx
1015 pop bx
1016 pop ds
1017 ret
1018
1019
1020biosfn_enable_cursor_emulation:
1021 push ds
1022 push bx
1023 push dx
1024 mov dl, al
1025 and dl, 01
1026 xor dl, 01
1027 mov ax, BIOSMEM_SEG
1028 mov ds, ax
1029 mov bx, BIOSMEM_MODESET_CTL
1030 mov al, [bx]
1031 and al, 0FEh
1032 or al, dl
1033 mov [bx], al
1034 mov ax, 1212h
1035 pop dx
1036 pop bx
1037 pop ds
1038 ret
1039
1040;;--------------------------------------------------------------------------------------------
1041
1042biosfn_group_1A:
1043 cmp al, 0
1044 je biosfn_read_display_code
1045 cmp al, 1
1046 je biosfn_set_display_code
1047ifdef VGA_DEBUG
1048 call _unknown
1049endif
1050 ret
1051biosfn_read_display_code:
1052 push ds
1053 push ax
1054 mov ax, BIOSMEM_SEG
1055 mov ds, ax
1056 mov bx, BIOSMEM_DCC_INDEX
1057 mov al, [bx]
1058 mov bl, al
1059 xor bh, bh
1060 pop ax
1061 mov al, ah
1062 pop ds
1063 ret
1064biosfn_set_display_code:
1065 push ds
1066 push ax
1067 push bx
1068 mov ax, BIOSMEM_SEG
1069 mov ds, ax
1070 mov ax, bx
1071 mov bx, BIOSMEM_DCC_INDEX
1072 mov [bx], al
1073ifdef VGA_DEBUG
1074 mov al, ah
1075 xor ah, ah
1076 push ax
1077 mov bx, msg_alt_dcc
1078 push bx
1079 call _printf
1080 add sp, 4
1081endif
1082 pop bx
1083 pop ax
1084 mov al, ah
1085 pop ds
1086 ret
1087
1088ifdef VGA_DEBUG
1089msg_alt_dcc:
1090db "Alternate Display code (%02x) was discarded", 13, 10, 0
1091endif
1092
1093VGAROM ends
1094
1095 end
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette