1
;; ============================================================================================
3
;; Copyright (C) 2001,2002 the LGPL VGABios developers Team
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.
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.
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
19
;; ============================================================================================
21
;; This VGA Bios is specific to the plex86/bochs Emulated VGA card.
22
;; You can NOT drive any physical vga card with it.
24
;; ============================================================================================
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.
37
public vgabios_int10_handler
39
VGAROM segment public 'CODE'
42
extrn _int10_func:near
43
extrn _vgabios_init_func:near
46
; Implemented in separate assembly module
47
extrn vbe_biosfn_return_current_mode:near
48
extrn vbe_biosfn_display_window_control:near
49
extrn vbe_biosfn_set_get_logical_scan_line_length:near
50
extrn vbe_biosfn_set_get_display_start:near
51
extrn vbe_biosfn_set_get_dac_palette_format:near
52
extrn vbe_biosfn_set_get_palette_data:near
53
extrn vbe_biosfn_return_protected_mode_interface:near
57
extrn _int10_debugmsg:near
59
extrn _unimplemented:near
65
db 055h, 0AAh ; ROM signature, required for expansion ROMs
66
db 40h ; ROM module length in units of 512 bytes */
71
jmp _vgabios_init_func
83
vgabios_int10_handler:
98
call biosfn_get_video_mode
113
call biosfn_set_text_block_specifier
120
call biosfn_get_ega_info
125
call biosfn_select_vert_res
130
call biosfn_enable_default_palette_loading
135
call biosfn_enable_video_addressing
140
call biosfn_enable_grayscale_summing
145
call biosfn_enable_cursor_emulation
163
jne int10_test_vbe_05
164
call vbe_biosfn_return_current_mode
168
jne int10_test_vbe_06
169
call vbe_biosfn_display_window_control
173
jne int10_test_vbe_07
174
call vbe_biosfn_set_get_logical_scan_line_length
178
jne int10_test_vbe_08
179
call vbe_biosfn_set_get_display_start
183
jne int10_test_vbe_09
184
call vbe_biosfn_set_get_dac_palette_format
188
jne int10_test_vbe_0A
189
call vbe_biosfn_set_get_palette_data
194
call vbe_biosfn_return_protected_mode_interface
203
;; We have to set ds to access the right data segment
215
;;--------------------------------------------------------------------------------------------
219
je biosfn_set_border_color
221
je biosfn_set_palette
226
biosfn_set_border_color:
234
mov dx, VGAREG_ACTL_RESET
236
cmp byte ptr ds:[BIOSMEM_CURRENT_MODE], 3
238
mov dx, VGAREG_ACTL_ADDRESS
251
mov dx, VGAREG_ACTL_ADDRESS
254
mov dx, VGAREG_ACTL_READ_DATA
258
mov dx, VGAREG_ACTL_ADDRESS
262
jne set_intensity_loop
267
mov dx, VGAREG_ACTL_RESET
281
mov dx, VGAREG_ACTL_RESET
285
set_cga_palette_loop:
286
mov dx, VGAREG_ACTL_ADDRESS
289
mov dx, VGAREG_ACTL_READ_DATA
293
mov dx, VGAREG_ACTL_ADDRESS
297
jne set_cga_palette_loop
301
mov dx, VGAREG_ACTL_RESET
310
;;--------------------------------------------------------------------------------------------
312
biosfn_get_video_mode:
317
mov bx, BIOSMEM_CURRENT_PAGE
322
mov bx, BIOSMEM_VIDEO_CTL
325
mov bx, BIOSMEM_CURRENT_MODE
328
mov bx, BIOSMEM_NB_COLS
334
;--------------------------------------------------------------------------------------------
339
jmp biosfn_set_single_palette_reg
343
jmp biosfn_set_overscan_border_color
347
jmp biosfn_set_all_palette_reg
351
jmp biosfn_toggle_intensity
355
jmp biosfn_get_single_palette_reg
359
jmp biosfn_read_overscan_border_color
363
jmp biosfn_get_all_palette_reg
367
jmp biosfn_set_single_dac_reg
371
jmp biosfn_set_all_dac_reg
375
jmp biosfn_select_video_dac_color_page
379
jmp biosfn_read_single_dac_reg
383
jmp biosfn_read_all_dac_reg
387
jmp biosfn_set_pel_mask
391
jmp biosfn_read_pel_mask
394
jne int10_group_10_unknown
395
jmp biosfn_read_video_dac_state
396
int10_group_10_unknown:
402
biosfn_set_single_palette_reg:
407
mov dx, VGAREG_ACTL_RESET
409
mov dx, VGAREG_ACTL_ADDRESS
417
mov dx, VGAREG_ACTL_RESET
425
;--------------------------------------------------------------------------------------------
427
biosfn_set_overscan_border_color:
430
call biosfn_set_single_palette_reg
434
;--------------------------------------------------------------------------------------------
436
biosfn_set_all_palette_reg:
442
mov dx, VGAREG_ACTL_RESET
445
mov dx, VGAREG_ACTL_ADDRESS
462
mov dx, VGAREG_ACTL_RESET
471
;;--------------------------------------------------------------------------------------------
473
biosfn_toggle_intensity:
477
mov dx, VGAREG_ACTL_RESET
479
mov dx, VGAREG_ACTL_ADDRESS
482
mov dx, VGAREG_ACTL_READ_DATA
488
mov dx, VGAREG_ACTL_ADDRESS
493
mov dx, VGAREG_ACTL_RESET
501
;;--------------------------------------------------------------------------------------------
503
biosfn_get_single_palette_reg:
508
mov dx, VGAREG_ACTL_RESET
510
mov dx, VGAREG_ACTL_ADDRESS
513
mov dx, VGAREG_ACTL_READ_DATA
516
mov dx, VGAREG_ACTL_RESET
518
mov dx, VGAREG_ACTL_ADDRESS
522
mov dx, VGAREG_ACTL_RESET
530
;;--------------------------------------------------------------------------------------------
532
biosfn_read_overscan_border_color:
536
call biosfn_get_single_palette_reg
543
;;--------------------------------------------------------------------------------------------
545
biosfn_get_all_palette_reg:
553
mov dx, VGAREG_ACTL_RESET
555
mov dx, VGAREG_ACTL_ADDRESS
558
mov dx, VGAREG_ACTL_READ_DATA
565
mov dx, VGAREG_ACTL_RESET
567
mov dx, VGAREG_ACTL_ADDRESS
570
mov dx, VGAREG_ACTL_READ_DATA
573
mov dx, VGAREG_ACTL_RESET
575
mov dx, VGAREG_ACTL_ADDRESS
579
mov dx, VGAREG_ACTL_RESET
588
;;--------------------------------------------------------------------------------------------
590
biosfn_set_single_dac_reg:
593
mov dx, VGAREG_DAC_WRITE_ADDRESS
596
mov dx, VGAREG_DAC_DATA
609
;;--------------------------------------------------------------------------------------------
611
biosfn_set_all_dac_reg:
616
mov dx, VGAREG_DAC_WRITE_ADDRESS
622
mov dx, VGAREG_DAC_DATA
641
;;--------------------------------------------------------------------------------------------
643
biosfn_select_video_dac_color_page:
647
mov dx, VGAREG_ACTL_RESET
649
mov dx, VGAREG_ACTL_ADDRESS
652
mov dx, VGAREG_ACTL_READ_DATA
659
mov dx, VGAREG_ACTL_ADDRESS
664
mov dx, VGAREG_ACTL_RESET
666
mov dx, VGAREG_ACTL_ADDRESS
681
mov dx, VGAREG_ACTL_RESET
689
;;--------------------------------------------------------------------------------------------
691
biosfn_read_single_dac_reg:
694
mov dx, VGAREG_DAC_READ_ADDRESS
699
mov dx, VGAREG_DAC_DATA
711
;;--------------------------------------------------------------------------------------------
713
biosfn_read_all_dac_reg:
718
mov dx, VGAREG_DAC_READ_ADDRESS
724
mov dx, VGAREG_DAC_DATA
743
;;--------------------------------------------------------------------------------------------
748
mov dx, VGAREG_PEL_MASK
755
;;--------------------------------------------------------------------------------------------
757
biosfn_read_pel_mask:
760
mov dx, VGAREG_PEL_MASK
767
;;--------------------------------------------------------------------------------------------
769
biosfn_read_video_dac_state:
772
mov dx, VGAREG_ACTL_RESET
774
mov dx, VGAREG_ACTL_ADDRESS
777
mov dx, VGAREG_ACTL_READ_DATA
781
mov dx, VGAREG_ACTL_RESET
783
mov dx, VGAREG_ACTL_ADDRESS
786
mov dx, VGAREG_ACTL_READ_DATA
794
mov dx, VGAREG_ACTL_RESET
796
mov dx, VGAREG_ACTL_ADDRESS
800
mov dx, VGAREG_ACTL_RESET
807
;;--------------------------------------------------------------------------------------------
809
biosfn_set_text_block_specifier:
812
mov dx, VGAREG_SEQU_ADDRESS
820
;;--------------------------------------------------------------------------------------------
828
mov bx, BIOSMEM_SWITCHES
831
mov bx, BIOSMEM_CRTC_ADDRESS
834
cmp ax, VGAREG_MDA_CRTC_ADDRESS
842
;;--------------------------------------------------------------------------------------------
844
biosfn_select_vert_res:
846
; res : 00 200 lines, 01 350 lines, 02 400 lines
854
mov bx, BIOSMEM_MODESET_CTL
856
mov bx, BIOSMEM_SWITCHES
875
; reset modeset ctl bit 7 and set bit 4
876
; set switches bit 3-0 to 09
885
; reset modeset ctl bit 7 and bit 4
886
; set switches bit 3-0 to 09
894
; set modeset ctl bit 7 and reset bit 4
895
; set switches bit 3-0 to 08
902
mov bx, BIOSMEM_MODESET_CTL
904
mov bx, BIOSMEM_SWITCHES
915
db "Select vert res (%02x) was discarded", 13, 10, 0
919
biosfn_enable_default_palette_loading:
928
mov bx, BIOSMEM_MODESET_CTL
940
biosfn_enable_video_addressing:
947
mov dx, VGAREG_READ_MISC_OUTPUT
951
mov dx, VGAREG_WRITE_MISC_OUTPUT
959
biosfn_enable_grayscale_summing:
969
mov bx, BIOSMEM_MODESET_CTL
981
biosfn_enable_cursor_emulation:
990
mov bx, BIOSMEM_MODESET_CTL
1001
;;--------------------------------------------------------------------------------------------
1005
je biosfn_read_display_code
1007
je biosfn_set_display_code
1012
biosfn_read_display_code:
1017
mov bx, BIOSMEM_DCC_INDEX
1025
biosfn_set_display_code:
1032
mov bx, BIOSMEM_DCC_INDEX
1051
db "Alternate Display code (%02x) was discarded", 13, 10, 0