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
120 vesa_pm_set_display_start
:
122 je vesa_pm_set_display_start1
124 je vesa_pm_set_display_start1
127 vesa_pm_set_display_start1
:
128 ; convert offset
to (X
, Y
) coordinate
129 ; (would be simpler to change Bochs VBE API
...)
142 mov dx
, # VBE_DISPI_IOPORT_INDEX
143 mov ax
, # VBE_DISPI_INDEX_VIRT_WIDTH
145 mov dx
, # VBE_DISPI_IOPORT_DATA
149 mov dx
, # VBE_DISPI_IOPORT_INDEX
150 mov ax
, # VBE_DISPI_INDEX_BPP
152 mov dx
, # VBE_DISPI_IOPORT_DATA
169 mov dx
, # VBE_DISPI_IOPORT_INDEX
170 mov ax
, # VBE_DISPI_INDEX_X_OFFSET
173 mov dx
, # VBE_DISPI_IOPORT_DATA
180 mov dx
, # VBE_DISPI_IOPORT_INDEX
181 mov ax
, # VBE_DISPI_INDEX_Y_OFFSET
184 mov dx
, # VBE_DISPI_IOPORT_DATA
196 vesa_pm_unimplemented
:
202 ; DISPI ioport functions
206 mov dx
, # VBE_DISPI_IOPORT_INDEX
207 mov ax
, # VBE_DISPI_INDEX_ID
209 mov dx
, # VBE_DISPI_IOPORT_DATA
217 mov dx
, # VBE_DISPI_IOPORT_INDEX
218 mov ax
, # VBE_DISPI_INDEX_ID
221 mov dx
, # VBE_DISPI_IOPORT_DATA
227 static void dispi_set_xres(xres
)
236 mov dx
, # VBE_DISPI_IOPORT_INDEX
237 mov ax
, # VBE_DISPI_INDEX_XRES
239 mov dx
, # VBE_DISPI_IOPORT_DATA
255 call vga_set_virt_width
263 static void dispi_set_yres(yres
)
266 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_YRES
);
267 outw(VBE_DISPI_IOPORT_DATA
,yres
);
270 static void dispi_set_bpp(bpp
)
273 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_BPP
);
274 outw(VBE_DISPI_IOPORT_DATA
,bpp
);
278 ; AL
= bits per pixel
/ AH
= bytes per pixel
281 mov dx
, # VBE_DISPI_IOPORT_INDEX
282 mov ax
, # VBE_DISPI_INDEX_BPP
284 mov dx
, # VBE_DISPI_IOPORT_DATA
295 ; get display capabilities
300 call dispi_get_enable
302 or ax
, # VBE_DISPI_GETCAPS
303 call _dispi_set_enable
304 mov dx
, # VBE_DISPI_IOPORT_INDEX
305 mov ax
, # VBE_DISPI_INDEX_XRES
307 mov dx
, # VBE_DISPI_IOPORT_DATA
311 call _dispi_set_enable
320 call dispi_get_enable
322 or ax
, # VBE_DISPI_GETCAPS
323 call _dispi_set_enable
324 mov dx
, # VBE_DISPI_IOPORT_INDEX
325 mov ax
, # VBE_DISPI_INDEX_BPP
327 mov dx
, # VBE_DISPI_IOPORT_DATA
331 call _dispi_set_enable
340 mov dx
, # VBE_DISPI_IOPORT_INDEX
341 mov ax
, # VBE_DISPI_INDEX_ENABLE
344 mov dx
, # VBE_DISPI_IOPORT_DATA
351 mov dx
, # VBE_DISPI_IOPORT_INDEX
352 mov ax
, # VBE_DISPI_INDEX_ENABLE
354 mov dx
, # VBE_DISPI_IOPORT_DATA
362 mov dx
, # VBE_DISPI_IOPORT_INDEX
363 mov ax
, # VBE_DISPI_INDEX_BANK
366 mov dx
, # VBE_DISPI_IOPORT_DATA
373 mov dx
, # VBE_DISPI_IOPORT_INDEX
374 mov ax
, # VBE_DISPI_INDEX_BANK
376 mov dx
, # VBE_DISPI_IOPORT_DATA
382 static void dispi_set_bank_farcall()
386 je dispi_set_bank_farcall_get
388 jnz dispi_set_bank_farcall_error
390 mov ax
,# VBE_DISPI_INDEX_BANK
391 mov dx
,# VBE_DISPI_IOPORT_INDEX
394 mov dx
,# VBE_DISPI_IOPORT_DATA
397 dispi_set_bank_farcall_get
:
398 mov ax
,# VBE_DISPI_INDEX_BANK
399 mov dx
,# VBE_DISPI_IOPORT_INDEX
401 mov dx
,# VBE_DISPI_IOPORT_DATA
405 dispi_set_bank_farcall_error
:
415 mov dx
, # VBE_DISPI_IOPORT_INDEX
416 mov ax
, # VBE_DISPI_INDEX_X_OFFSET
419 mov dx
, # VBE_DISPI_IOPORT_DATA
426 mov dx
, # VBE_DISPI_IOPORT_INDEX
427 mov ax
, # VBE_DISPI_INDEX_X_OFFSET
429 mov dx
, # VBE_DISPI_IOPORT_DATA
437 mov dx
, # VBE_DISPI_IOPORT_INDEX
438 mov ax
, # VBE_DISPI_INDEX_Y_OFFSET
441 mov dx
, # VBE_DISPI_IOPORT_DATA
448 mov dx
, # VBE_DISPI_IOPORT_INDEX
449 mov ax
, # VBE_DISPI_INDEX_Y_OFFSET
451 mov dx
, # VBE_DISPI_IOPORT_DATA
476 dispi_set_virt_width
:
477 call vga_set_virt_width
480 mov dx
, # VBE_DISPI_IOPORT_INDEX
481 mov ax
, # VBE_DISPI_INDEX_VIRT_WIDTH
484 mov dx
, # VBE_DISPI_IOPORT_DATA
489 dispi_get_virt_width
:
491 mov dx
, # VBE_DISPI_IOPORT_INDEX
492 mov ax
, # VBE_DISPI_INDEX_VIRT_WIDTH
494 mov dx
, # VBE_DISPI_IOPORT_DATA
499 dispi_get_virt_height
:
501 mov dx
, # VBE_DISPI_IOPORT_INDEX
502 mov ax
, # VBE_DISPI_INDEX_VIRT_HEIGHT
504 mov dx
, # VBE_DISPI_IOPORT_DATA
511 // ModeInfo helper function
512 static ModeInfoListItem
* mode_info_find_mode(mode
, using_lfb
)
513 Bit16u mode
; Boolean using_lfb
;
515 ModeInfoListItem
*cur_info
=&mode_info_list
;
517 while (cur_info
->mode
!= VBE_VESA_MODE_END_OF_LIST
)
519 if (cur_info
->mode
== mode
)
525 else if (cur_info
->info
.ModeAttributes
& VBE_MODE_ATTRIBUTE_LINEAR_FRAME_BUFFER_MODE
)
545 ; Has VBE display
- Returns
true if VBE display detected
547 _vbe_has_vbe_display
:
550 mov ax
, # BIOSMEM_SEG
552 mov bx
, # BIOSMEM_VBE_FLAG
560 ; VBE Init
- Initialise the Vesa Bios Extension Code
561 ; This function does a sanity check on the host side display code interface
.
564 mov ax
, # VBE_DISPI_ID0
567 cmp ax
, # VBE_DISPI_ID0
571 mov ax
, # BIOSMEM_SEG
573 mov bx
, # BIOSMEM_VBE_FLAG
578 mov ax
, # VBE_DISPI_ID3
581 #if defined(USE_BX_INFO) || defined(DEBUG)
582 mov bx
, #msg_vbe_init
590 ; VBE Display Info
- Display information on screen about the VBE
593 call _vbe_has_vbe_display
598 mov si
, #_vbebios_info_string
603 mov si
, #_no_vbebios_info_string
607 /** Function 00h - Return VBE Controller Information
611 * ES:DI = Pointer to buffer in which to place VbeInfoBlock structure
612 * (VbeSignature should be VBE2 when VBE 2.0 information is desired and
613 * the info block is 512 bytes in size)
615 * AX = VBE Return Status
618 void vbe_biosfn_return_controller_information(AX
, ES
, DI
)
619 Bit16u
*AX
;Bit16u ES
;Bit16u DI
;
622 VbeInfoBlock vbe_info_block
;
628 ModeInfoListItem
*cur_info
=&mode_info_list
;
630 status
= read_word(ss
, AX
);
633 printf("VBE vbe_biosfn_return_vbe_info ES%x DI%x AX%x\n",ES
,DI
,status
);
637 #ifdef VBE2_NO_VESA_CHECK
639 // get vbe_info_block into local variable
640 memcpyb(ss
, &vbe_info_block
, ES
, DI
, sizeof(vbe_info_block
));
642 // check for VBE2 signature
643 if (((vbe_info_block
.VbeSignature
[0] == 'V') &&
644 (vbe_info_block
.VbeSignature
[1] == 'B') &&
645 (vbe_info_block
.VbeSignature
[2] == 'E') &&
646 (vbe_info_block
.VbeSignature
[3] == '2')) ||
648 ((vbe_info_block
.VbeSignature
[0] == 'V') &&
649 (vbe_info_block
.VbeSignature
[1] == 'E') &&
650 (vbe_info_block
.VbeSignature
[2] == 'S') &&
651 (vbe_info_block
.VbeSignature
[3] == 'A')) )
655 printf("VBE correct VESA/VBE2 signature found\n");
661 vbe_info_block
.VbeSignature
[0] = 'V';
662 vbe_info_block
.VbeSignature
[1] = 'E';
663 vbe_info_block
.VbeSignature
[2] = 'S';
664 vbe_info_block
.VbeSignature
[3] = 'A';
666 // VBE Version supported
667 vbe_info_block
.VbeVersion
= 0x0200;
670 vbe_info_block
.OemStringPtr_Seg
= 0xc000;
671 vbe_info_block
.OemStringPtr_Off
= &vbebios_copyright
;
674 vbe_info_block
.Capabilities
[0] = VBE_CAPABILITY_8BIT_DAC
;
675 vbe_info_block
.Capabilities
[1] = 0;
676 vbe_info_block
.Capabilities
[2] = 0;
677 vbe_info_block
.Capabilities
[3] = 0;
679 // VBE Video Mode Pointer (dynamicly generated from the mode_info_list)
680 vbe_info_block
.VideoModePtr_Seg
= ES
;
681 vbe_info_block
.VideoModePtr_Off
= DI
+ 34;
683 // VBE Total Memory (in 64b blocks)
684 vbe_info_block
.TotalMemory
= VBE_TOTAL_VIDEO_MEMORY_DIV_64K
;
689 vbe_info_block
.OemSoftwareRev
= VBE_OEM_SOFTWARE_REV
;
690 vbe_info_block
.OemVendorNamePtr_Seg
= 0xc000;
691 vbe_info_block
.OemVendorNamePtr_Off
= &vbebios_vendor_name
;
692 vbe_info_block
.OemProductNamePtr_Seg
= 0xc000;
693 vbe_info_block
.OemProductNamePtr_Off
= &vbebios_product_name
;
694 vbe_info_block
.OemProductRevPtr_Seg
= 0xc000;
695 vbe_info_block
.OemProductRevPtr_Off
= &vbebios_product_revision
;
697 // copy updates in vbe_info_block back
698 memcpyb(ES
, DI
, ss
, &vbe_info_block
, sizeof(vbe_info_block
));
702 // copy updates in vbe_info_block back (VBE 1.x compatibility)
703 memcpyb(ES
, DI
, ss
, &vbe_info_block
, 256);
708 if ((cur_info
->info
.XResolution
<= dispi_get_max_xres()) &&
709 (cur_info
->info
.BitsPerPixel
<= dispi_get_max_bpp())) {
711 printf("VBE found mode %x => %x\n", cur_info
->mode
,cur_mode
);
713 write_word(ES
, DI
+ cur_ptr
, cur_info
->mode
);
718 } while (cur_info
->mode
!= VBE_VESA_MODE_END_OF_LIST
);
720 // Add vesa mode list terminator
721 write_word(ES
, DI
+ cur_ptr
, cur_info
->mode
);
725 write_word(ss
, AX
, result
);
729 /** Function 01h - Return VBE Mode Information
734 * ES:DI = Pointer to buffer in which to place ModeInfoBlock structure
736 * AX = VBE Return Status
739 void vbe_biosfn_return_mode_information(AX
, CX
, ES
, DI
)
740 Bit16u
*AX
;Bit16u CX
; Bit16u ES
;Bit16u DI
;
742 Bit16u result
=0x0100;
745 ModeInfoListItem
*cur_info
;
749 printf("VBE vbe_biosfn_return_mode_information ES%x DI%x CX%x\n",ES
,DI
,CX
);
752 using_lfb
=((CX
& VBE_MODE_LINEAR_FRAME_BUFFER
) == VBE_MODE_LINEAR_FRAME_BUFFER
);
756 cur_info
= mode_info_find_mode(CX
, using_lfb
, &cur_info
);
761 printf("VBE found mode %x\n",CX
);
763 memsetb(ss
, &info
, 0, sizeof(ModeInfoBlock
));
764 memcpyb(ss
, &info
, 0xc000, &(cur_info
->info
), sizeof(ModeInfoBlockCompact
));
765 if (info
.WinAAttributes
& VBE_WINDOW_ATTRIBUTE_RELOCATABLE
) {
766 info
.WinFuncPtr
= 0xC0000000UL
;
767 *(Bit16u
*)&(info
.WinFuncPtr
) = (Bit16u
)(dispi_set_bank_farcall
);
775 printf("VBE *NOT* found mode %x\n",CX
);
782 // copy updates in mode_info_block back
783 memcpyb(ES
, DI
, ss
, &info
, sizeof(info
));
786 write_word(ss
, AX
, result
);
789 /** Function 02h - Set VBE Mode
793 * BX = Desired Mode to set
794 * ES:DI = Pointer to CRTCInfoBlock structure
796 * AX = VBE Return Status
799 void vbe_biosfn_set_mode(AX
, BX
, ES
, DI
)
800 Bit16u
*AX
;Bit16u BX
; Bit16u ES
;Bit16u DI
;
802 Bit16u ss
= get_SS();
804 ModeInfoListItem
*cur_info
;
809 using_lfb
=((BX
& VBE_MODE_LINEAR_FRAME_BUFFER
) == VBE_MODE_LINEAR_FRAME_BUFFER
);
810 lfb_flag
=using_lfb
?VBE_DISPI_LFB_ENABLED
:0;
811 no_clear
=((BX
& VBE_MODE_PRESERVE_DISPLAY_MEMORY
) == VBE_MODE_PRESERVE_DISPLAY_MEMORY
)?VBE_DISPI_NOCLEARMEM
:0;
815 //result=read_word(ss,AX);
817 // check for non vesa mode
818 if (BX
<VBE_MODE_VESA_DEFINED
)
822 dispi_set_enable(VBE_DISPI_DISABLED
);
823 // call the vgabios in order to set the video mode
824 // this allows for going back to textmode with a VBE call (some applications expect that to work)
827 biosfn_set_video_mode(mode
);
831 cur_info
= mode_info_find_mode(BX
, using_lfb
, &cur_info
);
836 printf("VBE found mode %x, setting:\n", BX
);
837 printf("\txres%x yres%x bpp%x\n",
838 cur_info
->info
.XResolution
,
839 cur_info
->info
.YResolution
,
840 cur_info
->info
.BitsPerPixel
);
843 // first disable current mode (when switching between vesa modi)
844 dispi_set_enable(VBE_DISPI_DISABLED
);
846 if (cur_info
->mode
== VBE_VESA_MODE_800X600X4
)
848 biosfn_set_video_mode(0x6a);
851 dispi_set_bpp(cur_info
->info
.BitsPerPixel
);
852 dispi_set_xres(cur_info
->info
.XResolution
);
853 dispi_set_yres(cur_info
->info
.YResolution
);
855 dispi_set_enable(VBE_DISPI_ENABLED
| no_clear
| lfb_flag
);
857 write_word(BIOSMEM_SEG
,BIOSMEM_VBE_MODE
,BX
);
858 write_byte(BIOSMEM_SEG
,BIOSMEM_VIDEO_CTL
,(0x60 | no_clear
));
865 printf("VBE *NOT* found mode %x\n" , BX
);
869 // FIXME: redirect non VBE modi to normal VGA bios operation
870 // (switch back to VGA mode
875 write_word(ss
, AX
, result
);
878 /** Function 03h - Return Current VBE Mode
883 * AX = VBE Return Status
884 * BX = Current VBE Mode
888 vbe_biosfn_return_current_mode
:
890 mov ax
, # BIOSMEM_SEG
892 call dispi_get_enable
893 and ax
, # VBE_DISPI_ENABLED
895 mov bx
, # BIOSMEM_VBE_MODE
900 mov bx
, # BIOSMEM_CURRENT_MODE
911 Bit16u
vbe_biosfn_read_video_state_size()
916 void vbe_biosfn_save_video_state(ES
, BX
)
917 Bit16u ES
; Bit16u BX
;
921 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_ENABLE
);
922 enable
= inw(VBE_DISPI_IOPORT_DATA
);
923 write_word(ES
, BX
, enable
);
925 if (!(enable
& VBE_DISPI_ENABLED
))
927 for(i
= VBE_DISPI_INDEX_XRES
; i
<= VBE_DISPI_INDEX_Y_OFFSET
; i
++) {
928 if (i
!= VBE_DISPI_INDEX_ENABLE
) {
929 outw(VBE_DISPI_IOPORT_INDEX
, i
);
930 write_word(ES
, BX
, inw(VBE_DISPI_IOPORT_DATA
));
937 void vbe_biosfn_restore_video_state(ES
, BX
)
938 Bit16u ES
; Bit16u BX
;
942 enable
= read_word(ES
, BX
);
945 if (!(enable
& VBE_DISPI_ENABLED
)) {
946 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_ENABLE
);
947 outw(VBE_DISPI_IOPORT_DATA
, enable
);
949 outw(VBE_DISPI_IOPORT_INDEX
, VBE_DISPI_INDEX_XRES
);
950 outw(VBE_DISPI_IOPORT_DATA
, read_word(ES
, BX
));
952 outw(VBE_DISPI_IOPORT_INDEX
, VBE_DISPI_INDEX_YRES
);
953 outw(VBE_DISPI_IOPORT_DATA
, read_word(ES
, BX
));
955 outw(VBE_DISPI_IOPORT_INDEX
, VBE_DISPI_INDEX_BPP
);
956 outw(VBE_DISPI_IOPORT_DATA
, read_word(ES
, BX
));
958 outw(VBE_DISPI_IOPORT_INDEX
,VBE_DISPI_INDEX_ENABLE
);
959 outw(VBE_DISPI_IOPORT_DATA
, enable
);
961 for(i
= VBE_DISPI_INDEX_BANK
; i
<= VBE_DISPI_INDEX_Y_OFFSET
; i
++) {
962 outw(VBE_DISPI_IOPORT_INDEX
, i
);
963 outw(VBE_DISPI_IOPORT_DATA
, read_word(ES
, BX
));
969 /** Function 04h - Save/Restore State
973 * DL = 00h Return Save/Restore State buffer size
976 * CX = Requested states
977 * ES:BX = Pointer to buffer (if DL <> 00h)
979 * AX = VBE Return Status
980 * BX = Number of 64-byte blocks to hold the state buffer (if DL=00h)
983 void vbe_biosfn_save_restore_state(AX
, CX
, DX
, ES
, BX
)
984 Bit16u
*AX
; Bit16u CX
; Bit16u DX
; Bit16u ES
; Bit16u
*BX
;
992 val
= biosfn_read_video_state_size2(CX
);
994 printf("VGA state size=%x\n", val
);
997 val
+= vbe_biosfn_read_video_state_size();
998 write_word(ss
, BX
, val
);
1001 val
= read_word(ss
, BX
);
1002 val
= biosfn_save_video_state(CX
, ES
, val
);
1004 printf("VGA save_state offset=%x\n", val
);
1007 vbe_biosfn_save_video_state(ES
, val
);
1010 val
= read_word(ss
, BX
);
1011 val
= biosfn_restore_video_state(CX
, ES
, val
);
1013 printf("VGA restore_state offset=%x\n", val
);
1016 vbe_biosfn_restore_video_state(ES
, val
);
1023 write_word(ss
, AX
, result
);
1026 /** Function 05h - Display Window Control
1030 * (16-bit) BH = 00h Set memory window
1031 * = 01h Get memory window
1032 * BL = Window number
1035 * DX = Window number in video memory in window
1036 * granularity units (Set Memory Window only)
1038 * If this function is called while in a linear frame buffer mode,
1039 * this function must fail with completion code AH=03h
1042 * AX = VBE Return Status
1043 * DX = Window number in window granularity units
1044 * (Get Memory Window only)
1047 vbe_biosfn_display_window_control
:
1051 je get_display_window
1052 jb set_display_window
1057 call _dispi_set_bank
1074 /** Function 06h - Set/Get Logical Scan Line Length
1078 * BL = 00h Set Scan Line Length in Pixels
1079 * = 01h Get Scan Line Length
1080 * = 02h Set Scan Line Length in Bytes
1081 * = 03h Get Maximum Scan Line Length
1082 * CX = If BL=00h Desired Width in Pixels
1083 * If BL=02h Desired Width in Bytes
1084 * (Ignored for Get Functions)
1087 * AX = VBE Return Status
1088 * BX = Bytes Per Scan Line
1089 * CX = Actual Pixels Per Scan Line
1090 * (truncated to nearest complete pixel)
1091 * DX = Maximum Number of Scan Lines
1094 vbe_biosfn_set_get_logical_scan_line_length
:
1097 je get_logical_scan_line_length
1099 je set_logical_scan_line_bytes
1100 jb set_logical_scan_line_pixels
1103 set_logical_scan_line_bytes
:
1111 set_logical_scan_line_pixels
:
1112 call dispi_set_virt_width
1113 get_logical_scan_line_length
:
1117 call dispi_get_virt_width
1121 call dispi_get_virt_height
1128 /** Function 07h - Set/Get Display Start
1132 * BH = 00h Reserved and must be 00h
1133 * BL = 00h Set Display Start
1134 * = 01h Get Display Start
1135 * = 02h Schedule Display Start (Alternate)
1136 * = 03h Schedule Stereoscopic Display Start
1137 * = 04h Get Scheduled Display Start Status
1138 * = 05h Enable Stereoscopic Mode
1139 * = 06h Disable Stereoscopic Mode
1140 * = 80h Set Display Start during Vertical Retrace
1141 * = 82h Set Display Start during Vertical Retrace (Alternate)
1142 * = 83h Set Stereoscopic Display Start during Vertical Retrace
1143 * ECX = If BL=02h/82h Display Start Address in bytes
1144 * If BL=03h/83h Left Image Start Address in bytes
1145 * EDX = If BL=03h/83h Right Image Start Address in bytes
1146 * CX = If BL=00h/80h First Displayed Pixel In Scan Line
1147 * DX = If BL=00h/80h First Displayed Scan Line
1150 * AX = VBE Return Status
1151 * BH = If BL=01h Reserved and will be 0
1152 * CX = If BL=01h First Displayed Pixel In Scan Line
1153 * If BL=04h 0 if flip has not occurred, not 0 if it has
1154 * DX = If BL=01h First Displayed Scan Line
1157 * BH = 00h Reserved and must be 00h
1158 * BL = 00h Set Display Start
1159 * = 80h Set Display Start during Vertical Retrace
1160 * CX = Bits 0-15 of display start address
1161 * DX = Bits 16-31 of display start address
1162 * ES = Selector for memory mapped registers
1165 vbe_biosfn_set_get_display_start
:
1167 je set_display_start
1169 je get_display_start
1170 jb set_display_start
1175 call dispi_set_x_offset
1177 call dispi_set_y_offset
1181 call dispi_get_x_offset
1183 call dispi_get_y_offset
1191 /** Function 08h - Set/Get Dac Palette Format
1195 * BL = 00h set DAC palette width
1196 * = 01h get DAC palette width
1197 * BH = If BL=00h: desired number of bits per primary color
1199 * AX = VBE Return Status
1200 * BH = current number of bits per primary color (06h = standard VGA)
1203 vbe_biosfn_set_get_dac_palette_format
:
1205 je get_dac_palette_format
1206 jb set_dac_palette_format
1209 set_dac_palette_format
:
1210 call dispi_get_enable
1214 jne vbe_08_unsupported
1215 or ax
, # VBE_DISPI_8BIT_DAC
1218 and ax
, #~ VBE_DISPI_8BIT_DAC
1220 call _dispi_set_enable
1221 get_dac_palette_format
:
1223 call dispi_get_enable
1224 and ax
, # VBE_DISPI_8BIT_DAC
1236 /** Function 09h - Set/Get Palette Data
1241 * AX = VBE Return Status
1243 * FIXME: incomplete API description, Input & Output
1245 void vbe_biosfn_set_get_palette_data(AX
)
1249 /** Function 0Ah - Return VBE Protected Mode Interface
1250 * Input: AX = 4F0Ah VBE 2.0 Protected Mode Interface
1251 * BL = 00h Return protected mode table
1254 * Output: AX = Status
1255 * ES = Real Mode Segment of Table
1256 * DI = Offset of Table
1257 * CX = Length of Table including protected mode code
1258 * (for copying purposes)
1261 vbe_biosfn_return_protected_mode_interface
:
1266 mov di
, # vesa_pm_start
1267 mov cx
, # vesa_pm_end