VirtualBox

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

Last change on this file since 77577 was 69294, checked in by vboxsync, 7 years ago

Devices/Graphics: scm cleanups

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