VirtualBox

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

最後變更 在這個檔案從61380是 60441,由 vboxsync 提交於 9 年 前

PCBIOS: 8086 adjustments.

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

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