1 // ============================================================================================
3 // Copyright (C) 2002 Jeroen Janssen
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 VBE is part of the VGA Bios specific to the plex86/bochs Emulated VGA card.
22 // You can NOT drive any physical vga card with it.
24 // ============================================================================================
26 // This VBE Bios is based on information taken from :
27 // - VESA BIOS EXTENSION (VBE) Core Functions Standard Version 3.0 located at www.vesa.org
29 // ============================================================================================
34 // disable VESA/VBE2 check in vbe info
35 //#define VBE2_NO_VESA_CHECK
39 #include "vbetables.h"
42 // The current OEM Software Revision of this VBE Bios
43 #define VBE_OEM_SOFTWARE_REV 0x0002;
45 extern char vbebios_copyright
;
46 extern char vbebios_vendor_name
;
47 extern char vbebios_product_name
;
48 extern char vbebios_product_revision
;
51 // FIXME: 'merge' these (c) etc strings with the vgabios.c strings?
53 .ascii
"Bochs/Plex86 VBE(C) 2003 http://savannah.nongnu.org/projects/vgabios/"
57 .ascii
"Bochs/Plex86 Developers"
60 _vbebios_product_name
:
61 .ascii
"Bochs/Plex86 VBE Adapter"
64 _vbebios_product_revision
:
69 .ascii
"Bochs VBE Display Adapter enabled"
74 _no_vbebios_info_string
:
75 .ascii
"NO Bochs VBE Support available!"
80 #if defined(USE_BX_INFO) || defined(DEBUG)
82 .ascii
"VBE Bios $Id$"
88 dw vesa_pm_set_window
- vesa_pm_start
89 dw vesa_pm_set_display_start
- vesa_pm_start
90 dw vesa_pm_unimplemented
- vesa_pm_start
91 dw vesa_pm_io_ports_table
- vesa_pm_start
92 vesa_pm_io_ports_table
:
93 dw VBE_DISPI_IOPORT_INDEX
94 dw VBE_DISPI_IOPORT_INDEX
+ 1
95 dw VBE_DISPI_IOPORT_DATA
96 dw VBE_DISPI_IOPORT_DATA
+ 1
103 je vesa_pm_set_display_window1
106 vesa_pm_set_display_window1
:
110 mov dx
, # VBE_DISPI_IOPORT_INDEX
111 mov ax
, # VBE_DISPI_INDEX_BANK
114 mov dx
, # VBE_DISPI_IOPORT_DATA
126 vesa_pm_set_display_start
:
128 je vesa_pm_set_display_start1
130 je vesa_pm_set_display_start1
133 vesa_pm_set_display_start1
:
134 ; convert offset
to (X
, Y
) coordinate
135 ; (would be simpler to change Bochs VBE API
...)
148 mov dx
, # VBE_DISPI_IOPORT_INDEX
149 mov ax
, # VBE_DISPI_INDEX_VIRT_WIDTH
151 mov dx
, # VBE_DISPI_IOPORT_DATA
155 mov dx
, # VBE_DISPI_IOPORT_INDEX
156 mov ax
, # VBE_DISPI_INDEX_BPP
158 mov dx
, # VBE_DISPI_IOPORT_DATA
187 mov dx
, # VBE_DISPI_IOPORT_INDEX
188 mov ax
, # VBE_DISPI_INDEX_X_OFFSET
191 mov dx
, # VBE_DISPI_IOPORT_DATA
198 mov dx
, # VBE_DISPI_IOPORT_INDEX
199 mov ax
, # VBE_DISPI_INDEX_Y_OFFSET
202 mov dx
, # VBE_DISPI_IOPORT_DATA
214 vesa_pm_unimplemented
:
220 ; DISPI ioport functions
224 mov dx
, # VBE_DISPI_IOPORT_INDEX
225 mov ax
, # VBE_DISPI_INDEX_ID
227 mov dx
, # VBE_DISPI_IOPORT_DATA
235 mov dx
, # VBE_DISPI_IOPORT_INDEX
236 mov ax
, # VBE_DISPI_INDEX_ID
239 mov dx
, # VBE_DISPI_IOPORT_DATA
245 static void dispi_set_xres(xres
)
254 mov dx
, # VBE_DISPI_IOPORT_INDEX
255 mov ax
, # VBE_DISPI_INDEX_XRES
257 mov dx
, # VBE_DISPI_IOPORT_DATA
273 call vga_set_virt_width
281 static void dispi_set_yres(yres
)
284 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_YRES
);
285 outw(VBE_DISPI_IOPORT_DATA
,yres
);
288 static void dispi_set_bpp(bpp
)
291 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_BPP
);
292 outw(VBE_DISPI_IOPORT_DATA
,bpp
);
296 ; AL
= bits per pixel
/ AH
= bytes per pixel
299 mov dx
, # VBE_DISPI_IOPORT_INDEX
300 mov ax
, # VBE_DISPI_INDEX_BPP
302 mov dx
, # VBE_DISPI_IOPORT_DATA
313 ; get display capabilities
318 call dispi_get_enable
320 or ax
, # VBE_DISPI_GETCAPS
321 call _dispi_set_enable
322 mov dx
, # VBE_DISPI_IOPORT_INDEX
323 mov ax
, # VBE_DISPI_INDEX_XRES
325 mov dx
, # VBE_DISPI_IOPORT_DATA
329 call _dispi_set_enable
338 call dispi_get_enable
340 or ax
, # VBE_DISPI_GETCAPS
341 call _dispi_set_enable
342 mov dx
, # VBE_DISPI_IOPORT_INDEX
343 mov ax
, # VBE_DISPI_INDEX_BPP
345 mov dx
, # VBE_DISPI_IOPORT_DATA
349 call _dispi_set_enable
358 mov dx
, # VBE_DISPI_IOPORT_INDEX
359 mov ax
, # VBE_DISPI_INDEX_ENABLE
362 mov dx
, # VBE_DISPI_IOPORT_DATA
369 mov dx
, # VBE_DISPI_IOPORT_INDEX
370 mov ax
, # VBE_DISPI_INDEX_ENABLE
372 mov dx
, # VBE_DISPI_IOPORT_DATA
380 mov dx
, # VBE_DISPI_IOPORT_INDEX
381 mov ax
, # VBE_DISPI_INDEX_BANK
384 mov dx
, # VBE_DISPI_IOPORT_DATA
391 mov dx
, # VBE_DISPI_IOPORT_INDEX
392 mov ax
, # VBE_DISPI_INDEX_BANK
394 mov dx
, # VBE_DISPI_IOPORT_DATA
400 static void dispi_set_bank_farcall()
404 je dispi_set_bank_farcall_get
406 jnz dispi_set_bank_farcall_error
410 mov ax
,# VBE_DISPI_INDEX_BANK
411 mov dx
,# VBE_DISPI_IOPORT_INDEX
414 mov dx
,# VBE_DISPI_IOPORT_DATA
419 jne dispi_set_bank_farcall_error
422 dispi_set_bank_farcall_get
:
423 mov ax
,# VBE_DISPI_INDEX_BANK
424 mov dx
,# VBE_DISPI_IOPORT_INDEX
426 mov dx
,# VBE_DISPI_IOPORT_DATA
430 dispi_set_bank_farcall_error
:
440 mov dx
, # VBE_DISPI_IOPORT_INDEX
441 mov ax
, # VBE_DISPI_INDEX_X_OFFSET
444 mov dx
, # VBE_DISPI_IOPORT_DATA
451 mov dx
, # VBE_DISPI_IOPORT_INDEX
452 mov ax
, # VBE_DISPI_INDEX_X_OFFSET
454 mov dx
, # VBE_DISPI_IOPORT_DATA
462 mov dx
, # VBE_DISPI_IOPORT_INDEX
463 mov ax
, # VBE_DISPI_INDEX_Y_OFFSET
466 mov dx
, # VBE_DISPI_IOPORT_DATA
473 mov dx
, # VBE_DISPI_IOPORT_INDEX
474 mov ax
, # VBE_DISPI_INDEX_Y_OFFSET
476 mov dx
, # VBE_DISPI_IOPORT_DATA
501 dispi_set_virt_width
:
502 call vga_set_virt_width
505 mov dx
, # VBE_DISPI_IOPORT_INDEX
506 mov ax
, # VBE_DISPI_INDEX_VIRT_WIDTH
509 mov dx
, # VBE_DISPI_IOPORT_DATA
514 dispi_get_virt_width
:
516 mov dx
, # VBE_DISPI_IOPORT_INDEX
517 mov ax
, # VBE_DISPI_INDEX_VIRT_WIDTH
519 mov dx
, # VBE_DISPI_IOPORT_DATA
524 dispi_get_virt_height
:
526 mov dx
, # VBE_DISPI_IOPORT_INDEX
527 mov ax
, # VBE_DISPI_INDEX_VIRT_HEIGHT
529 mov dx
, # VBE_DISPI_IOPORT_DATA
536 // ModeInfo helper function
537 static ModeInfoListItem
* mode_info_find_mode(mode
, using_lfb
)
538 Bit16u mode
; Boolean using_lfb
;
540 ModeInfoListItem
*cur_info
=&mode_info_list
;
542 while (cur_info
->mode
!= VBE_VESA_MODE_END_OF_LIST
)
544 if (cur_info
->mode
== mode
)
550 else if (cur_info
->info
.ModeAttributes
& VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE
)
570 ; Has VBE display
- Returns
true if VBE display detected
572 _vbe_has_vbe_display
:
575 mov ax
, # BIOSMEM_SEG
577 mov bx
, # BIOSMEM_VBE_FLAG
585 ; VBE Init
- Initialise the Vesa Bios Extension Code
586 ; This function does a sanity check on the host side display code interface
.
589 mov ax
, # VBE_DISPI_ID0
592 cmp ax
, # VBE_DISPI_ID0
596 mov ax
, # BIOSMEM_SEG
598 mov bx
, # BIOSMEM_VBE_FLAG
603 mov ax
, # VBE_DISPI_ID3
606 #if defined(USE_BX_INFO) || defined(DEBUG)
607 mov bx
, #msg_vbe_init
615 ; VBE Display Info
- Display information on screen about the VBE
618 call _vbe_has_vbe_display
623 mov si
, #_vbebios_info_string
628 mov si
, #_no_vbebios_info_string
632 /** Function 00h - Return VBE Controller Information
636 * ES:DI = Pointer to buffer in which to place VbeInfoBlock structure
637 * (VbeSignature should be VBE2 when VBE 2.0 information is desired and
638 * the info block is 512 bytes in size)
640 * AX = VBE Return Status
643 void vbe_biosfn_return_controller_information(AX
, ES
, DI
)
644 Bit16u
*AX
;Bit16u ES
;Bit16u DI
;
647 VbeInfoBlock vbe_info_block
;
653 ModeInfoListItem
*cur_info
=&mode_info_list
;
655 status
= read_word(ss
, AX
);
658 printf("VBE vbe_biosfn_return_vbe_info ES%x DI%x AX%x\n",ES
,DI
,status
);
662 #ifdef VBE2_NO_VESA_CHECK
664 // get vbe_info_block into local variable
665 memcpyb(ss
, &vbe_info_block
, ES
, DI
, sizeof(vbe_info_block
));
667 // check for VBE2 signature
668 if (((vbe_info_block
.VbeSignature
[0] == 'V') &&
669 (vbe_info_block
.VbeSignature
[1] == 'B') &&
670 (vbe_info_block
.VbeSignature
[2] == 'E') &&
671 (vbe_info_block
.VbeSignature
[3] == '2')) ||
673 ((vbe_info_block
.VbeSignature
[0] == 'V') &&
674 (vbe_info_block
.VbeSignature
[1] == 'E') &&
675 (vbe_info_block
.VbeSignature
[2] == 'S') &&
676 (vbe_info_block
.VbeSignature
[3] == 'A')) )
680 printf("VBE correct VESA/VBE2 signature found\n");
686 vbe_info_block
.VbeSignature
[0] = 'V';
687 vbe_info_block
.VbeSignature
[1] = 'E';
688 vbe_info_block
.VbeSignature
[2] = 'S';
689 vbe_info_block
.VbeSignature
[3] = 'A';
691 // VBE Version supported
692 vbe_info_block
.VbeVersion
= 0x0200;
695 vbe_info_block
.OemStringPtr_Seg
= 0xc000;
696 vbe_info_block
.OemStringPtr_Off
= &vbebios_copyright
;
699 vbe_info_block
.Capabilities
[0] = VBE_CAPABILITY_8BIT_DAC
;
700 vbe_info_block
.Capabilities
[1] = 0;
701 vbe_info_block
.Capabilities
[2] = 0;
702 vbe_info_block
.Capabilities
[3] = 0;
704 // VBE Video Mode Pointer (dynamicly generated from the mode_info_list)
705 vbe_info_block
.VideoModePtr_Seg
= ES
;
706 vbe_info_block
.VideoModePtr_Off
= DI
+ 34;
708 // VBE Total Memory (in 64b blocks)
709 vbe_info_block
.TotalMemory
= VBE_TOTAL_VIDEO_MEMORY_DIV_64K
;
714 vbe_info_block
.OemSoftwareRev
= VBE_OEM_SOFTWARE_REV
;
715 vbe_info_block
.OemVendorNamePtr_Seg
= 0xc000;
716 vbe_info_block
.OemVendorNamePtr_Off
= &vbebios_vendor_name
;
717 vbe_info_block
.OemProductNamePtr_Seg
= 0xc000;
718 vbe_info_block
.OemProductNamePtr_Off
= &vbebios_product_name
;
719 vbe_info_block
.OemProductRevPtr_Seg
= 0xc000;
720 vbe_info_block
.OemProductRevPtr_Off
= &vbebios_product_revision
;
722 // copy updates in vbe_info_block back
723 memcpyb(ES
, DI
, ss
, &vbe_info_block
, sizeof(vbe_info_block
));
727 // copy updates in vbe_info_block back (VBE 1.x compatibility)
728 memcpyb(ES
, DI
, ss
, &vbe_info_block
, 256);
733 if ((cur_info
->info
.XResolution
<= dispi_get_max_xres()) &&
734 (cur_info
->info
.BitsPerPixel
<= dispi_get_max_bpp())) {
736 printf("VBE found mode %x => %x\n", cur_info
->mode
,cur_mode
);
738 write_word(ES
, DI
+ cur_ptr
, cur_info
->mode
);
743 } while (cur_info
->mode
!= VBE_VESA_MODE_END_OF_LIST
);
745 // Add vesa mode list terminator
746 write_word(ES
, DI
+ cur_ptr
, cur_info
->mode
);
750 write_word(ss
, AX
, result
);
754 /** Function 01h - Return VBE Mode Information
759 * ES:DI = Pointer to buffer in which to place ModeInfoBlock structure
761 * AX = VBE Return Status
764 void vbe_biosfn_return_mode_information(AX
, CX
, ES
, DI
)
765 Bit16u
*AX
;Bit16u CX
; Bit16u ES
;Bit16u DI
;
767 Bit16u result
=0x0100;
770 ModeInfoListItem
*cur_info
;
774 printf("VBE vbe_biosfn_return_mode_information ES%x DI%x CX%x\n",ES
,DI
,CX
);
777 using_lfb
=((CX
& VBE_MODE_LINEAR_FRAME_BUFFER
) == VBE_MODE_LINEAR_FRAME_BUFFER
);
781 cur_info
= mode_info_find_mode(CX
, using_lfb
, &cur_info
);
786 printf("VBE found mode %x\n",CX
);
788 memsetb(ss
, &info
, 0, sizeof(ModeInfoBlock
));
789 memcpyb(ss
, &info
, 0xc000, &(cur_info
->info
), sizeof(ModeInfoBlockCompact
));
790 if (info
.WinAAttributes
& VBE_WINDOW_ATTRIBUTE_RELOCATABLE
) {
791 info
.WinFuncPtr
= 0xC0000000UL
;
792 *(Bit16u
*)&(info
.WinFuncPtr
) = (Bit16u
)(dispi_set_bank_farcall
);
800 printf("VBE *NOT* found mode %x\n",CX
);
807 // copy updates in mode_info_block back
808 memcpyb(ES
, DI
, ss
, &info
, sizeof(info
));
811 write_word(ss
, AX
, result
);
814 /** Function 02h - Set VBE Mode
818 * BX = Desired Mode to set
819 * ES:DI = Pointer to CRTCInfoBlock structure
821 * AX = VBE Return Status
824 void vbe_biosfn_set_mode(AX
, BX
, ES
, DI
)
825 Bit16u
*AX
;Bit16u BX
; Bit16u ES
;Bit16u DI
;
827 Bit16u ss
= get_SS();
829 ModeInfoListItem
*cur_info
;
834 using_lfb
=((BX
& VBE_MODE_LINEAR_FRAME_BUFFER
) == VBE_MODE_LINEAR_FRAME_BUFFER
);
835 lfb_flag
=using_lfb
?VBE_DISPI_LFB_ENABLED
:0;
836 no_clear
=((BX
& VBE_MODE_PRESERVE_DISPLAY_MEMORY
) == VBE_MODE_PRESERVE_DISPLAY_MEMORY
)?VBE_DISPI_NOCLEARMEM
:0;
840 //result=read_word(ss,AX);
842 // check for non vesa mode
843 if (BX
<VBE_MODE_VESA_DEFINED
)
847 dispi_set_enable(VBE_DISPI_DISABLED
);
848 // call the vgabios in order to set the video mode
849 // this allows for going back to textmode with a VBE call (some applications expect that to work)
852 biosfn_set_video_mode(mode
);
856 cur_info
= mode_info_find_mode(BX
, using_lfb
, &cur_info
);
861 printf("VBE found mode %x, setting:\n", BX
);
862 printf("\txres%x yres%x bpp%x\n",
863 cur_info
->info
.XResolution
,
864 cur_info
->info
.YResolution
,
865 cur_info
->info
.BitsPerPixel
);
868 // first disable current mode (when switching between vesa modi)
869 dispi_set_enable(VBE_DISPI_DISABLED
);
871 if (cur_info
->mode
== VBE_VESA_MODE_800X600X4
)
873 biosfn_set_video_mode(0x6a);
876 dispi_set_bpp(cur_info
->info
.BitsPerPixel
);
877 dispi_set_xres(cur_info
->info
.XResolution
);
878 dispi_set_yres(cur_info
->info
.YResolution
);
880 dispi_set_enable(VBE_DISPI_ENABLED
| no_clear
| lfb_flag
);
882 write_word(BIOSMEM_SEG
,BIOSMEM_VBE_MODE
,BX
);
883 write_byte(BIOSMEM_SEG
,BIOSMEM_VIDEO_CTL
,(0x60 | no_clear
));
890 printf("VBE *NOT* found mode %x\n" , BX
);
894 // FIXME: redirect non VBE modi to normal VGA bios operation
895 // (switch back to VGA mode
900 write_word(ss
, AX
, result
);
903 /** Function 03h - Return Current VBE Mode
908 * AX = VBE Return Status
909 * BX = Current VBE Mode
913 vbe_biosfn_return_current_mode
:
915 mov ax
, # BIOSMEM_SEG
917 call dispi_get_enable
918 and ax
, # VBE_DISPI_ENABLED
920 mov bx
, # BIOSMEM_VBE_MODE
925 mov bx
, # BIOSMEM_CURRENT_MODE
936 Bit16u
vbe_biosfn_read_video_state_size()
941 void vbe_biosfn_save_video_state(ES
, BX
)
942 Bit16u ES
; Bit16u BX
;
946 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_ENABLE
);
947 enable
= inw(VBE_DISPI_IOPORT_DATA
);
948 write_word(ES
, BX
, enable
);
950 if (!(enable
& VBE_DISPI_ENABLED
))
952 for(i
= VBE_DISPI_INDEX_XRES
; i
<= VBE_DISPI_INDEX_Y_OFFSET
; i
++) {
953 if (i
!= VBE_DISPI_INDEX_ENABLE
) {
954 outw(VBE_DISPI_IOPORT_INDEX
, i
);
955 write_word(ES
, BX
, inw(VBE_DISPI_IOPORT_DATA
));
962 void vbe_biosfn_restore_video_state(ES
, BX
)
963 Bit16u ES
; Bit16u BX
;
967 enable
= read_word(ES
, BX
);
970 if (!(enable
& VBE_DISPI_ENABLED
)) {
971 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_ENABLE
);
972 outw(VBE_DISPI_IOPORT_DATA
, enable
);
974 outw(VBE_DISPI_IOPORT_INDEX
, VBE_DISPI_INDEX_XRES
);
975 outw(VBE_DISPI_IOPORT_DATA
, read_word(ES
, BX
));
977 outw(VBE_DISPI_IOPORT_INDEX
, VBE_DISPI_INDEX_YRES
);
978 outw(VBE_DISPI_IOPORT_DATA
, read_word(ES
, BX
));
980 outw(VBE_DISPI_IOPORT_INDEX
, VBE_DISPI_INDEX_BPP
);
981 outw(VBE_DISPI_IOPORT_DATA
, read_word(ES
, BX
));
983 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_ENABLE
);
984 outw(VBE_DISPI_IOPORT_DATA
, enable
);
986 for(i
= VBE_DISPI_INDEX_BANK
; i
<= VBE_DISPI_INDEX_Y_OFFSET
; i
++) {
987 outw(VBE_DISPI_IOPORT_INDEX
, i
);
988 outw(VBE_DISPI_IOPORT_DATA
, read_word(ES
, BX
));
994 /** Function 04h - Save/Restore State
998 * DL = 00h Return Save/Restore State buffer size
1001 * CX = Requested states
1002 * ES:BX = Pointer to buffer (if DL <> 00h)
1004 * AX = VBE Return Status
1005 * BX = Number of 64-byte blocks to hold the state buffer (if DL=00h)
1008 void vbe_biosfn_save_restore_state(AX
, CX
, DX
, ES
, BX
)
1009 Bit16u
*AX
; Bit16u CX
; Bit16u DX
; Bit16u ES
; Bit16u
*BX
;
1017 val
= biosfn_read_video_state_size2(CX
);
1019 printf("VGA state size=%x\n", val
);
1022 val
+= vbe_biosfn_read_video_state_size();
1023 write_word(ss
, BX
, val
);
1026 val
= read_word(ss
, BX
);
1027 val
= biosfn_save_video_state(CX
, ES
, val
);
1029 printf("VGA save_state offset=%x\n", val
);
1032 vbe_biosfn_save_video_state(ES
, val
);
1035 val
= read_word(ss
, BX
);
1036 val
= biosfn_restore_video_state(CX
, ES
, val
);
1038 printf("VGA restore_state offset=%x\n", val
);
1041 vbe_biosfn_restore_video_state(ES
, val
);
1048 write_word(ss
, AX
, result
);
1051 /** Function 05h - Display Window Control
1055 * (16-bit) BH = 00h Set memory window
1056 * = 01h Get memory window
1057 * BL = Window number
1060 * DX = Window number in video memory in window
1061 * granularity units (Set Memory Window only)
1063 * If this function is called while in a linear frame buffer mode,
1064 * this function must fail with completion code AH=03h
1067 * AX = VBE Return Status
1068 * DX = Window number in window granularity units
1069 * (Get Memory Window only)
1072 vbe_biosfn_display_window_control
:
1076 je get_display_window
1077 jb set_display_window
1082 call _dispi_set_bank
1099 /** Function 06h - Set/Get Logical Scan Line Length
1103 * BL = 00h Set Scan Line Length in Pixels
1104 * = 01h Get Scan Line Length
1105 * = 02h Set Scan Line Length in Bytes
1106 * = 03h Get Maximum Scan Line Length
1107 * CX = If BL=00h Desired Width in Pixels
1108 * If BL=02h Desired Width in Bytes
1109 * (Ignored for Get Functions)
1112 * AX = VBE Return Status
1113 * BX = Bytes Per Scan Line
1114 * CX = Actual Pixels Per Scan Line
1115 * (truncated to nearest complete pixel)
1116 * DX = Maximum Number of Scan Lines
1119 vbe_biosfn_set_get_logical_scan_line_length
:
1122 je get_logical_scan_line_length
1124 je set_logical_scan_line_bytes
1125 jb set_logical_scan_line_pixels
1128 set_logical_scan_line_bytes
:
1141 set_logical_scan_line_pixels
:
1142 call dispi_set_virt_width
1143 get_logical_scan_line_length
:
1147 call dispi_get_virt_width
1156 call dispi_get_virt_height
1163 /** Function 07h - Set/Get Display Start
1167 * BH = 00h Reserved and must be 00h
1168 * BL = 00h Set Display Start
1169 * = 01h Get Display Start
1170 * = 02h Schedule Display Start (Alternate)
1171 * = 03h Schedule Stereoscopic Display Start
1172 * = 04h Get Scheduled Display Start Status
1173 * = 05h Enable Stereoscopic Mode
1174 * = 06h Disable Stereoscopic Mode
1175 * = 80h Set Display Start during Vertical Retrace
1176 * = 82h Set Display Start during Vertical Retrace (Alternate)
1177 * = 83h Set Stereoscopic Display Start during Vertical Retrace
1178 * ECX = If BL=02h/82h Display Start Address in bytes
1179 * If BL=03h/83h Left Image Start Address in bytes
1180 * EDX = If BL=03h/83h Right Image Start Address in bytes
1181 * CX = If BL=00h/80h First Displayed Pixel In Scan Line
1182 * DX = If BL=00h/80h First Displayed Scan Line
1185 * AX = VBE Return Status
1186 * BH = If BL=01h Reserved and will be 0
1187 * CX = If BL=01h First Displayed Pixel In Scan Line
1188 * If BL=04h 0 if flip has not occurred, not 0 if it has
1189 * DX = If BL=01h First Displayed Scan Line
1192 * BH = 00h Reserved and must be 00h
1193 * BL = 00h Set Display Start
1194 * = 80h Set Display Start during Vertical Retrace
1195 * CX = Bits 0-15 of display start address
1196 * DX = Bits 16-31 of display start address
1197 * ES = Selector for memory mapped registers
1200 vbe_biosfn_set_get_display_start
:
1202 je set_display_start
1204 je get_display_start
1205 jb set_display_start
1210 call dispi_set_x_offset
1212 call dispi_set_y_offset
1216 call dispi_get_x_offset
1218 call dispi_get_y_offset
1226 /** Function 08h - Set/Get Dac Palette Format
1230 * BL = 00h set DAC palette width
1231 * = 01h get DAC palette width
1232 * BH = If BL=00h: desired number of bits per primary color
1234 * AX = VBE Return Status
1235 * BH = current number of bits per primary color (06h = standard VGA)
1238 vbe_biosfn_set_get_dac_palette_format
:
1240 je get_dac_palette_format
1241 jb set_dac_palette_format
1244 set_dac_palette_format
:
1245 call dispi_get_enable
1249 jne vbe_08_unsupported
1250 or ax
, # VBE_DISPI_8BIT_DAC
1253 and ax
, #~ VBE_DISPI_8BIT_DAC
1255 call _dispi_set_enable
1256 get_dac_palette_format
:
1258 call dispi_get_enable
1259 and ax
, # VBE_DISPI_8BIT_DAC
1271 /** Function 09h - Set/Get Palette Data
1276 * AX = VBE Return Status
1278 * FIXME: incomplete API description, Input & Output
1280 void vbe_biosfn_set_get_palette_data(AX
)
1284 /** Function 0Ah - Return VBE Protected Mode Interface
1285 * Input: AX = 4F0Ah VBE 2.0 Protected Mode Interface
1286 * BL = 00h Return protected mode table
1289 * Output: AX = Status
1290 * ES = Real Mode Segment of Table
1291 * DI = Offset of Table
1292 * CX = Length of Table including protected mode code
1293 * (for copying purposes)
1296 vbe_biosfn_return_protected_mode_interface
:
1301 mov di
, # vesa_pm_start
1302 mov cx
, # vesa_pm_end