- set video mode: clear vga memory in graphics mode
[vgabios.git] / vbe.c
blob43ae682674ed0abf09f5b4f78b30e7c180c013cb
1 // ============================================================================================
2 //
3 // Copyright (C) 2002 Jeroen Janssen
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.
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 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 // ============================================================================================
25 //
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 // ============================================================================================
32 // defines available
33 // enable LFB support (depends upon bochs-vbe-lfb patch)
34 #define VBE_HAVE_LFB
36 // disable VESA/VBE2 check in vbe info
37 //#define VBE2_NO_VESA_CHECK
39 // dynamicly generate a mode_info list
40 //#define DYN_LIST
42 // enable unsupported modi in the mode_info list (ie >8bpp)
43 //#define LIST_UNSUPPORTED_MODI
46 #include "vbe.h"
47 #include "vbetables.h"
50 // The current OEM Software Revision of this VBE Bios
51 #define VBE_OEM_SOFTWARE_REV 0x0002;
53 #define VBEInfoData ((VbeInfoBlock *) 0)
55 extern char vbebios_copyright;
56 extern char vbebios_vendor_name;
57 extern char vbebios_product_name;
58 extern char vbebios_product_revision;
60 // FIXME: find out why we cannot use the dynamic list generation (due to a bug somewhere)
61 //#define DYN_LIST
63 #ifndef DYN_LIST
64 extern Bit16u vbebios_mode_list;
65 #endif
67 ASM_START
68 // FIXME: 'merge' these (c) etc strings with the vgabios.c strings?
69 _vbebios_copyright:
70 .ascii "Bochs/Plex86 VBE(C) 2002 Jeroen Janssen <japj@darius.demon.nl>"
71 .byte 0x00
73 _vbebios_vendor_name:
74 .ascii "Bochs/Plex86 Developers"
75 .byte 0x00
77 _vbebios_product_name:
78 .ascii "Bochs/Plex86 VBE Adapter"
79 .byte 0x00
81 _vbebios_product_revision:
82 .ascii "$Id$"
83 .byte 0x00
85 _vbebios_info_string:
86 .ascii "Bochs VBE Display Adapter enabled"
87 .byte 0x0a,0x0d
88 .byte 0x0a,0x0d
89 .byte 0x00
91 _no_vbebios_info_string:
92 .ascii "NO Bochs VBE Support available!"
93 .byte 0x0a,0x0d
94 .byte 0x0a,0x0d
95 .byte 0x00
98 #ifndef DYN_LIST
99 // FIXME: for each new mode add a statement here
100 // at least until dynamic list creation is working
101 _vbebios_mode_list:
103 #ifdef LIST_UNSUPPORTED_MODI
104 .word VBE_VESA_MODE_640X480X565
105 .word VBE_VESA_MODE_640X480X565 + 0x4000
106 .word VBE_VESA_MODE_800X600X565
107 .word VBE_VESA_MODE_800X600X565 + 0x4000
108 .word VBE_VESA_MODE_640X480X888
109 .word VBE_VESA_MODE_640X480X888 + 0x4000
110 .word VBE_VESA_MODE_800X600X888
111 .word VBE_VESA_MODE_800X600X888 + 0x4000
112 .word VBE_OWN_MODE_800X600X8888
113 .word VBE_OWN_MODE_800X600X8888 + 0x4000
114 .word VBE_OWN_MODE_1024X768X8888
115 .word VBE_OWN_MODE_1024X768X8888 + 0x4000
116 #endif
118 .word VBE_OWN_MODE_320X200X8
119 .word VBE_VESA_MODE_640X400X8
120 .word VBE_VESA_MODE_640X400X8 + 0x4000
121 .word VBE_VESA_MODE_640X480X8
122 .word VBE_VESA_MODE_640X480X8 + 0x4000
123 .word VBE_VESA_MODE_800X600X8
124 .word VBE_VESA_MODE_800X600X8 + 0x4000
125 .word VBE_VESA_MODE_1024X768X8
126 .word VBE_VESA_MODE_1024X768X8 + 0x4000
127 .word VBE_VESA_MODE_END_OF_LIST
128 #endif
130 ASM_END
132 // from rombios.c
133 #define PANIC_PORT 0x501
135 ASM_START
136 MACRO HALT
137 ;; the HALT macro is called with the line number of the HALT call.
138 ;; The line number is then sent to the PANIC_PORT, causing Bochs to
139 ;; print a BX_PANIC message. This will normally halt the simulation
140 ;; with a message such as "BIOS panic at rombios.c, line 4091".
141 ;; However, users can choose to make panics non-fatal and continue.
142 mov dx,#PANIC_PORT
143 mov ax,#?1
144 out dx,ax
145 MEND
146 ASM_END
148 // DISPI ioport functions
149 // FIXME: what if no VBE host side code?
150 static Bit16u dispi_get_id()
152 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ID);
153 return inw(VBE_DISPI_IOPORT_DATA);
156 static void dispi_set_id(id)
157 Bit16u id;
159 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ID);
160 outw(VBE_DISPI_IOPORT_DATA,id);
163 static void dispi_set_xres(xres)
164 Bit16u xres;
166 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_XRES);
167 outw(VBE_DISPI_IOPORT_DATA,xres);
170 static void dispi_set_yres(yres)
171 Bit16u yres;
173 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_YRES);
174 outw(VBE_DISPI_IOPORT_DATA,yres);
177 static void dispi_set_bpp(bpp)
178 Bit16u bpp;
180 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_BPP);
181 outw(VBE_DISPI_IOPORT_DATA,bpp);
184 void dispi_set_enable(enable)
185 Bit16u enable;
187 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ENABLE);
188 outw(VBE_DISPI_IOPORT_DATA,enable);
191 static void dispi_set_bank(bank)
192 Bit16u bank;
194 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_BANK);
195 outw(VBE_DISPI_IOPORT_DATA,bank);
198 static void dispi_set_x_offset(offset)
199 Bit16u offset;
201 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_X_OFFSET);
202 outw(VBE_DISPI_IOPORT_DATA,offset);
205 static Bit16u dispi_get_x_offset()
207 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_X_OFFSET);
208 return inw(VBE_DISPI_IOPORT_DATA);
211 static void dispi_set_y_offset(offset)
212 Bit16u offset;
214 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_Y_OFFSET);
215 outw(VBE_DISPI_IOPORT_DATA,offset);
218 static Bit16u dispi_get_y_offset()
220 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_Y_OFFSET);
221 return inw(VBE_DISPI_IOPORT_DATA);
224 static void dispi_set_virt_width(width)
225 Bit16u width;
227 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_VIRT_WIDTH);
228 outw(VBE_DISPI_IOPORT_DATA,width);
231 static Bit16u dispi_get_virt_width()
233 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_VIRT_WIDTH);
234 return inw(VBE_DISPI_IOPORT_DATA);
237 static void dispi_set_virt_height(height)
238 Bit16u height;
240 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_VIRT_HEIGHT);
241 outw(VBE_DISPI_IOPORT_DATA,height);
244 static Bit16u dispi_get_virt_height()
246 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_VIRT_HEIGHT);
247 return inw(VBE_DISPI_IOPORT_DATA);
251 // ModeInfo helper function
252 static ModeInfoListItem* mode_info_find_mode(mode)
253 Bit16u mode;
255 ModeInfoListItem *cur_info=&mode_info_list;
257 while (cur_info->mode != VBE_VESA_MODE_END_OF_LIST)
259 if (cur_info->mode == mode)
261 return cur_info;
264 cur_info++;
267 return 0;
270 /** Has VBE display - Returns true if VBE display detected
273 Boolean vbe_has_vbe_display()
275 dispi_set_id(VBE_DISPI_ID1);
277 return (dispi_get_id()==VBE_DISPI_ID1);
280 /** VBE Init - Initialise the Vesa Bios Extension Code
282 * This function does a sanity check on the host side display code interface.
284 void vbe_init()
286 Bit16u dispi_id;
288 outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ID);
289 outw(VBE_DISPI_IOPORT_DATA,VBE_DISPI_ID0);
291 dispi_id=inw(VBE_DISPI_IOPORT_DATA);
293 if (dispi_id!=VBE_DISPI_ID0)
295 //FIXME this results in a 'rombios.c' line panic, but it's actually a 'vbe.c' panic
296 ASM_START
297 HALT(__LINE__)
298 ASM_END
300 //#ifdef DEBUG
301 printf("VBE Bios $Id$\n");
302 //#endif
305 /** VBE Display Info - Display information on screen about the VBE
307 void vbe_display_info()
309 // Check for VBE display extension in Bochs
310 if (vbe_has_vbe_display())
312 ASM_START
313 mov ax,#0xc000
314 mov ds,ax
315 mov si,#_vbebios_info_string
316 call _display_string
317 ASM_END
319 else
321 ASM_START
322 mov ax,#0xc000
323 mov ds,ax
324 mov si,#_no_vbebios_info_string
325 call _display_string
326 ASM_END
331 /** Function 00h - Return VBE Controller Information
333 * Input:
334 * AX = 4F00h
335 * ES:DI = Pointer to buffer in which to place VbeInfoBlock structure
336 * (VbeSignature should be VBE2 when VBE 2.0 information is desired and
337 * the info block is 512 bytes in size)
338 * Output:
339 * AX = VBE Return Status
342 void vbe_biosfn_return_controller_information(AX, ES, DI)
343 Bit16u *AX;Bit16u ES;Bit16u DI;
345 Bit16u ss=get_SS();
346 VbeInfoBlock vbe_info_block;
347 Bit16u status;
348 Bit16u result;
349 Bit16u vbe2_info;
350 #ifdef DYN_LIST
351 Bit16u *video_mode_list;
352 #endif
353 Bit16u cur_mode=0;
354 ModeInfoListItem *cur_info=&mode_info_list;
356 status = read_word(ss, AX);
358 #ifdef DEBUG
359 printf("VBE vbe_biosfn_return_vbe_info ES%x DI%x AX%x\n",ES,DI,status);
360 #endif
362 vbe2_info = 0;
363 #ifdef VBE2_NO_VESA_CHECK
364 #else
365 // get vbe_info_block into local variable
366 memcpyb(ss, &vbe_info_block, ES, DI, sizeof(vbe_info_block));
368 // check for VBE2 signature
369 if (((vbe_info_block.VbeSignature[0] == 'V') &&
370 (vbe_info_block.VbeSignature[1] == 'B') &&
371 (vbe_info_block.VbeSignature[2] == 'E') &&
372 (vbe_info_block.VbeSignature[3] == '2')) ||
374 ((vbe_info_block.VbeSignature[0] == 'V') &&
375 (vbe_info_block.VbeSignature[1] == 'E') &&
376 (vbe_info_block.VbeSignature[2] == 'S') &&
377 (vbe_info_block.VbeSignature[3] == 'A')) )
379 vbe2_info = 1;
380 #ifdef DEBUG
381 printf("VBE correct VESA/VBE2 signature found\n");
382 #endif
384 #endif
386 // VBE Signature
387 vbe_info_block.VbeSignature[0] = 'V';
388 vbe_info_block.VbeSignature[1] = 'E';
389 vbe_info_block.VbeSignature[2] = 'S';
390 vbe_info_block.VbeSignature[3] = 'A';
392 // VBE Version supported
393 vbe_info_block.VbeVersion = 0x0200;
395 // OEM String
396 vbe_info_block.OemStringPtr_Seg = 0xc000;
397 vbe_info_block.OemStringPtr_Off = &vbebios_copyright;
399 // Capabilities
400 vbe_info_block.Capabilities[0] = 0;
401 vbe_info_block.Capabilities[1] = 0;
402 vbe_info_block.Capabilities[2] = 0;
403 vbe_info_block.Capabilities[3] = 0;
405 #ifdef DYN_LIST
406 // FIXME: This doesn't work correctly somehow?
407 // VBE Video Mode Pointer (dynamicly generated from the mode_info_list)
408 vbe_info_block.VideoModePtr_Seg= ES ;//0xc000;
409 vbe_info_block.VideoModePtr_Off= DI + 34;//&(VBEInfoData->Reserved);//&vbebios_mode_list;
410 #else
411 // VBE Video Mode Pointer (staticly in rom)
412 vbe_info_block.VideoModePtr_Seg = 0xc000;
413 vbe_info_block.VideoModePtr_Off = &vbebios_mode_list;
415 #endif
417 #ifdef DYN_LIST
419 // video_mode_list=(Bit16u*)&(vbe_info_block.Reserved);
423 #ifdef DEBUG
424 printf("VBE found mode %x => %x\n", cur_info->mode,cur_mode);
425 #endif
426 // *video_mode_list=cur_info->mode;
427 vbe_info_block.Reserved[cur_mode] = cur_info->mode;
429 cur_info++;
430 //video_mode_list++;
431 cur_mode++;
432 } while (cur_info->mode != VBE_VESA_MODE_END_OF_LIST);
434 // Add vesa mode list terminator
435 vbe_info_block.Reserved[cur_mode] = VBE_VESA_MODE_END_OF_LIST;
436 #endif
438 if (vbe2_info)
440 // VBE Total Memory (in 64b blocks)
441 vbe_info_block.TotalMemory = VBE_TOTAL_VIDEO_MEMORY_DIV_64K;
443 // OEM Stuff
444 vbe_info_block.OemSoftwareRev = VBE_OEM_SOFTWARE_REV;
445 vbe_info_block.OemVendorNamePtr_Seg = 0xc000;
446 vbe_info_block.OemVendorNamePtr_Off = &vbebios_vendor_name;
447 vbe_info_block.OemProductNamePtr_Seg = 0xc000;
448 vbe_info_block.OemProductNamePtr_Off = &vbebios_product_name;
449 vbe_info_block.OemProductRevPtr_Seg = 0xc000;
450 vbe_info_block.OemProductRevPtr_Off = &vbebios_product_revision;
452 // copy updates in vbe_info_block back
453 memcpyb(ES, DI, ss, &vbe_info_block, sizeof(vbe_info_block));
455 else
457 // copy updates in vbe_info_block back (VBE 1.x compatibility)
458 memcpyb(ES, DI, ss, &vbe_info_block, 256);
461 result = 0x4f;
463 write_word(ss, AX, result);
467 /** Function 01h - Return VBE Mode Information
469 * Input:
470 * AX = 4F01h
471 * CX = Mode Number
472 * ES:DI = Pointer to buffer in which to place ModeInfoBlock structure
473 * Output:
474 * AX = VBE Return Status
477 void vbe_biosfn_return_mode_information(AX, CX, ES, DI)
478 Bit16u *AX;Bit16u CX; Bit16u ES;Bit16u DI;
480 Bit16u result=0x0100;
481 Bit16u ss=get_SS();
482 ModeInfoBlock info;
483 ModeInfoListItem *cur_info=&mode_info_list;
484 Boolean found=0;
486 #ifdef DEBUG
487 printf("VBE vbe_biosfn_return_mode_information ES%x DI%x CX%x\n",ES,DI,CX);
488 #endif
490 while ((cur_info->mode != VBE_VESA_MODE_END_OF_LIST) && (!found))
492 if (cur_info->mode == CX)
494 found=1;
496 else
498 cur_info++;
502 if (found)
504 #ifdef DEBUG
505 printf("VBE found mode %x\n",CX);
506 #endif
507 memsetb(ss, &info, 0, sizeof(ModeInfoBlock));
508 memcpyb(ss, &info, 0xc000, &(cur_info->info), sizeof(ModeInfoBlockCompact));
510 result = 0x4f;
512 else
514 #ifdef DEBUG
515 printf("VBE *NOT* found mode %x\n",CX);
516 #endif
517 result = 0x100;
520 if (result == 0x4f)
522 // copy updates in mode_info_block back
523 memcpyb(ES, DI, ss, &info, sizeof(info));
526 write_word(ss, AX, result);
529 /** Function 02h - Set VBE Mode
531 * Input:
532 * AX = 4F02h
533 * BX = Desired Mode to set
534 * ES:DI = Pointer to CRTCInfoBlock structure
535 * Output:
536 * AX = VBE Return Status
539 void vbe_biosfn_set_mode(AX, BX, ES, DI)
540 Bit16u *AX;Bit16u BX; Bit16u ES;Bit16u DI;
542 Bit16u ss = get_SS();
543 Bit16u result;
544 ModeInfoListItem *cur_info = &mode_info_list;
545 Boolean found = 0;
546 Boolean using_lfb;
548 using_lfb=((BX & VBE_MODE_LINEAR_FRAME_BUFFER) == VBE_MODE_LINEAR_FRAME_BUFFER);
550 BX = (BX & 0x1ff);
552 //result=read_word(ss,AX);
554 // check for non vesa mode
555 if (BX<VBE_MODE_VESA_DEFINED)
557 Bit8u mode;
559 dispi_set_enable(VBE_DISPI_DISABLED);
560 // call the vgabios in order to set the video mode
561 // this allows for going back to textmode with a VBE call (some applications expect that to work)
563 mode=(BX & 0xff);
564 biosfn_set_video_mode(mode);
565 result = 0x4f;
568 while ((cur_info->mode != VBE_VESA_MODE_END_OF_LIST) && (!found))
570 if (cur_info->mode == BX)
572 found = 1;
574 else
576 cur_info++;
579 if (found)
581 #ifdef DEBUG
582 printf("VBE found mode %x, setting:\n", BX);
583 printf("\txres%x yres%x bpp%x\n",
584 cur_info->info.XResolution,
585 cur_info->info.YResolution,
586 cur_info->info.BitsPerPixel);
587 #endif
588 // FIXME: this is here so we can do some testing
589 // at least until bochs host side display is up & running
590 // (we're using the 'standard' 320x200x256 vga mode as if it
591 // were a vesa mode)
593 if (cur_info->info.BitsPerPixel == 8)
595 // we have a 8bpp mode, preparing to set it
597 // first disable current mode (when switching between vesa modi)
598 dispi_set_enable(VBE_DISPI_DISABLED);
600 dispi_set_xres(cur_info->info.XResolution);
601 dispi_set_yres(cur_info->info.YResolution);
602 dispi_set_bpp(VBE_DISPI_BPP_8);
603 dispi_set_bank(0);
604 dispi_set_enable(VBE_DISPI_ENABLED);
606 // FIXME: store current mode in CMOS
608 result = 0x4f;
611 //FIXME: new resolutions will need special code (per bpp)
613 else
615 #ifdef DEBUG
616 printf("VBE *NOT* found mode %x\n" , BX);
617 #endif
618 result = 0x100;
620 // FIXME: redirect non VBE modi to normal VGA bios operation
621 // (switch back to VGA mode
622 if (BX == 3)
623 result = 0x4f;
626 write_word(ss, AX, result);
629 /** Function 03h - Return Current VBE Mode
631 * Input:
632 * AX = 4F03h
633 * Output:
634 * AX = VBE Return Status
635 * BX = Current VBE Mode
638 void vbe_biosfn_return_current_mode(AX, BX)
639 Bit16u *AX;Bit16u *BX;
641 Bit16u ss=get_SS();
643 // FIXME: get current mode from CMOS reg?
645 #ifdef DEBUG
646 printf("VBE vbe_biosfn_return_current_mode\n");
647 #endif
649 write_word(ss, AX, 0x4f);
650 write_word(ss, BX, 0x3);
654 /** Function 04h - Save/Restore State
656 * Input:
657 * AX = 4F04h
658 * DL = 00h Return Save/Restore State buffer size
659 * 01h Save State
660 * 02h Restore State
661 * CX = Requested states
662 * ES:BX = Pointer to buffer (if DL <> 00h)
663 * Output:
664 * AX = VBE Return Status
665 * BX = Number of 64-byte blocks to hold the state buffer (if DL=00h)
668 void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX)
673 /** Function 05h - Display Window Control
675 * Input:
676 * AX = 4F05h
677 * (16-bit) BH = 00h Set memory window
678 * = 01h Get memory window
679 * BL = Window number
680 * = 00h Window A
681 * = 01h Window B
682 * DX = Window number in video memory in window
683 * granularity units (Set Memory Window only)
684 * Note:
685 * If this function is called while in a linear frame buffer mode,
686 * this function must fail with completion code AH=03h
688 * Output:
689 * AX = VBE Return Status
690 * DX = Window number in window granularity units
691 * (Get Memory Window only)
693 void vbe_biosfn_display_window_control(AX,BX,DX)
694 Bit16u *AX;Bit16u BX;Bit16u *DX;
696 Bit16u ss = get_SS();
697 Bit16u window = read_word(ss, DX);
699 if (BX==0x0000)
701 dispi_set_bank(window);
706 /** Function 06h - Set/Get Logical Scan Line Length
708 * Input:
709 * AX = 4F06h
710 * BL = 00h Set Scan Line Length in Pixels
711 * = 01h Get Scan Line Length
712 * = 02h Set Scan Line Length in Bytes
713 * = 03h Get Maximum Scan Line Length
714 * CX = If BL=00h Desired Width in Pixels
715 * If BL=02h Desired Width in Bytes
716 * (Ignored for Get Functions)
718 * Output:
719 * AX = VBE Return Status
720 * BX = Bytes Per Scan Line
721 * CX = Actual Pixels Per Scan Line
722 * (truncated to nearest complete pixel)
723 * DX = Maximum Number of Scan Lines
725 void vbe_biosfn_set_get_logical_scan_line_length(AX,BX,CX,DX)
726 Bit16u *AX;Bit16u *BX;Bit16u *DX;Bit16u *DX;
728 Bit16u ss=get_SS();
729 Bit16u result=0x100;
730 Bit16u width = read_word(ss, CX);
731 Bit16u cmd = read_word(ss, BX);
733 // check bl
734 if ( ((cmd & 0xff) == 0x00) || ((cmd & 0xff) == 0x02) )
736 // set scan line lenght in pixels(0x00) or bytes (0x00)
737 Bit16u new_width;
738 Bit16u new_height;
740 dispi_set_virt_width(width);
741 new_width=dispi_get_virt_width();
742 new_height=dispi_get_virt_height();
744 if (new_width!=width)
746 #ifdef DEBUG
747 printf("* VBE width adjusted\n");
748 #endif
750 // notify width adjusted
751 result=0x024f;
753 else
755 result=0x4f;
758 // FIXME: adjust for higher bpp (in bytes)
759 write_word(ss,BX,new_width);
760 write_word(ss,CX,new_width);
761 write_word(ss,DX,new_height);
764 write_word(ss, AX, result);
768 /** Function 07h - Set/Get Display Start
770 * Input(16-bit):
771 * AX = 4F07h
772 * BH = 00h Reserved and must be 00h
773 * BL = 00h Set Display Start
774 * = 01h Get Display Start
775 * = 02h Schedule Display Start (Alternate)
776 * = 03h Schedule Stereoscopic Display Start
777 * = 04h Get Scheduled Display Start Status
778 * = 05h Enable Stereoscopic Mode
779 * = 06h Disable Stereoscopic Mode
780 * = 80h Set Display Start during Vertical Retrace
781 * = 82h Set Display Start during Vertical Retrace (Alternate)
782 * = 83h Set Stereoscopic Display Start during Vertical Retrace
783 * ECX = If BL=02h/82h Display Start Address in bytes
784 * If BL=03h/83h Left Image Start Address in bytes
785 * EDX = If BL=03h/83h Right Image Start Address in bytes
786 * CX = If BL=00h/80h First Displayed Pixel In Scan Line
787 * DX = If BL=00h/80h First Displayed Scan Line
789 * Output:
790 * AX = VBE Return Status
791 * BH = If BL=01h Reserved and will be 0
792 * CX = If BL=01h First Displayed Pixel In Scan Line
793 * If BL=04h 0 if flip has not occurred, not 0 if it has
794 * DX = If BL=01h First Displayed Scan Line
796 * Input(32-bit):
797 * BH = 00h Reserved and must be 00h
798 * BL = 00h Set Display Start
799 * = 80h Set Display Start during Vertical Retrace
800 * CX = Bits 0-15 of display start address
801 * DX = Bits 16-31 of display start address
802 * ES = Selector for memory mapped registers
804 void vbe_biosfn_set_get_display_start(AX,BX,CX,DX)
805 Bit16u *AX;Bit16u BX;Bit16u CX;Bit16u DX;
807 Bit16u ss=get_SS();
808 Bit16u result=0x100;
809 #ifdef DEBUG
810 // printf("VBE vbe_biosfn_set_get_display_start\n");
811 #endif
813 // check for set display start
814 if ((GET_BL()==0x00) || (GET_BL()==0x80))
816 // 0x80 is during vertical retrace - is also used by sdd vbetest during multibuffering
817 #ifdef DEBUG
818 // printf("VBE vbe_biosfn_set_get_display_start CX%x DX%x\n",CX,DX);
819 #endif
821 dispi_set_x_offset(CX);
822 dispi_set_y_offset(DX);
823 result = 0x4f;
826 write_word(ss, AX, result);
830 /** Function 08h - Set/Get Dac Palette Format
832 * Input:
833 * AX = 4F08h
834 * Output:
835 * AX = VBE Return Status
837 * FIXME: incomplete API description, Input & Output
839 void vbe_biosfn_set_get_dac_palette_format(AX)
844 /** Function 09h - Set/Get Palette Data
846 * Input:
847 * AX = 4F09h
848 * Output:
849 * AX = VBE Return Status
851 * FIXME: incomplete API description, Input & Output
853 void vbe_biosfn_set_get_palette_data(AX)
857 /** Function 0Ah - Return VBE Protected Mode Interface
859 * Input:
860 * AX = 4F0Ah
861 * Output:
862 * AX = VBE Return Status
864 * FIXME: incomplete API description, Input & Output
866 void vbe_biosfn_return_protected_mode_interface(AX)