aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen Janssen <japj@xs4all.nl>2002-03-06 19:59:28 +0000
committerJeroen Janssen <japj@xs4all.nl>2002-03-06 19:59:28 +0000
commitbefb8b91ef482a8fb64b6957b2e8bcdc14da7c49 (patch)
tree45f3522d98643f7edf038e7db4c1c8293b44bf10
parente4d18dfab132aa282f74c9e4208faadc414564ee (diff)
downloadvgabios-befb8b91ef482a8fb64b6957b2e8bcdc14da7c49.tar.gz
- adding 640x400x8 and 800x600x8 vbe support
(this depends HEAVILY on my bochs vga code patch - japj)
-rw-r--r--TODO3
-rw-r--r--vbe.c149
-rw-r--r--vbe.h2
-rw-r--r--vbetables.h125
-rw-r--r--vgabios.c5
5 files changed, 275 insertions, 9 deletions
diff --git a/TODO b/TODO
index 4982a2f..e4e67a6 100644
--- a/TODO
+++ b/TODO
@@ -44,7 +44,8 @@ v3.0
VBE:
----
Short term:
-- get Scitech's vbetest program working with 320x200x8.
+- make bochs guest <-> host display API documentation
+- fix io port calls for VBE_VESA_MODE_640X400X8 and VBE_VESA_MODE_800X600X8
Long term:
- have bochs/plex86 host side display interface
diff --git a/vbe.c b/vbe.c
index ba8b82a..574e122 100644
--- a/vbe.c
+++ b/vbe.c
@@ -81,6 +81,8 @@ _vbebios_mode_list:
.word VBE_OWN_MODE_1024X768X8888
#endif
.word VBE_OWN_MODE_320X200X8
+.word VBE_VESA_MODE_640X400X8
+.word VBE_VESA_MODE_800X600X8
.word VBE_VESA_MODE_END_OF_LIST
#endif
@@ -270,6 +272,79 @@ Bit16u *AX;Bit16u CX; Bit16u ES;Bit16u DI;
write_word(ss, AX, result);
}
+//FIXME: make a generic vbe_set function that does io port with params
+static void vbe_set_800x600x8()
+{
+ #asm
+ // set xresolution
+ mov dx, #0xff80
+ mov ax, #0x01
+ outw dx, ax
+ inc dx
+ mov ax, #0x320
+ outw dx, ax
+ dec dx
+ // set yresolution
+ mov ax, #0x02
+ outw dx, ax
+ inc dx
+ mov ax, #0x258
+ outw dx, ax
+ dec dx
+ // set bank
+ mov ax, #0x04
+ outw dx, ax
+ inc dx
+ mov ax, #0x00
+ outw dx, ax
+ dec dx
+
+ // enable video mode
+ mov ax, #0x03
+ outw dx, ax
+ inc dx
+ mov ax, #0x01
+ outw dx, ax
+
+ #endasm
+}
+
+static void vbe_set_640x400x8()
+{
+ #asm
+ // set xresolution
+ mov dx, #0xff80
+ mov ax, #0x01
+ outw dx, ax
+ inc dx
+ mov ax, #0x280
+ outw dx, ax
+ dec dx
+ // set yresolution
+ mov ax, #0x02
+ outw dx, ax
+ inc dx
+ mov ax, #0x190
+ outw dx, ax
+ dec dx
+ // set bank
+ mov ax, #0x04
+ outw dx, ax
+ inc dx
+ mov ax, #0x00
+ outw dx, ax
+ dec dx
+
+ // enable video mode
+ mov ax, #0x03
+ outw dx, ax
+ inc dx
+ mov ax, #0x01
+ outw dx, ax
+
+ #endasm
+}
+
/** Function 02h - Set VBE Mode
*
* Input:
@@ -299,6 +374,20 @@ Bit16u *AX;Bit16u BX; Bit16u ES;Bit16u DI;
if (BX<VBE_MODE_VESA_DEFINED)
{
Bit8u mode;
+
+ #asm
+ // set xresolution
+ mov dx, #0xff80
+
+ // disable video mode
+ mov ax, #0x03
+ out dx, ax
+ inc dx
+ mov ax, #0x00
+ out dx, ax
+
+ #endasm
+
// call the vgabios in order to set the video mode
// this allows for going back to textmode with a VBE call (some applications expect that to work)
@@ -336,6 +425,21 @@ Bit16u *AX;Bit16u BX; Bit16u ES;Bit16u DI;
{
biosfn_set_video_mode(0x13);
}
+ if (cur_info->mode == VBE_VESA_MODE_640X400X8)
+ {
+#ifdef DEBUG
+ printf("VBE VBE_VESA_MODE_640X400X8");
+#endif
+ vbe_set_640x400x8();
+ }
+ else
+ if (cur_info->mode == VBE_VESA_MODE_800X600X8)
+ {
+#ifdef DEBUG
+ printf("VBE VBE_VESA_MODE_800X600X8");
+#endif
+ vbe_set_800x600x8();
+ }
else
{
// FIXME: setup gfx mode with host
@@ -408,17 +512,56 @@ void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX)
*
* Input:
* AX = 4F05h
+ * (16-bit) BH = 00h Set memory window
+ * = 01h Get memory window
+ * BL = Window number
+ * = 00h Window A
+ * = 01h Window B
+ * DX = Window number in video memory in window
+ * granularity units (Set Memory Window only)
* Note:
* If this function is called while in a linear frame buffer mode,
* this function must fail with completion code AH=03h
*
* Output:
* AX = VBE Return Status
- *
- * FIXME: incomplete API description, Input & Output
+ * DX = Window number in window granularity units
+ * (Get Memory Window only)
*/
-void vbe_biosfn_display_window_control(AX)
+
+static void
+vbe_set_bank(bank)
+ Bit8u bank;
{
+#asm
+ push bp
+ mov bp, sp
+ push ax
+ push dx
+
+ mov dx,#0xff80
+ mov ax,#0x04
+ outw dx, ax
+ inc dx
+
+ mov ax, 4[bp] ;; bank
+ outw dx, ax
+ pop dx
+ pop ax
+ pop bp
+#endasm
+}
+
+void vbe_biosfn_display_window_control(AX,BX,DX)
+Bit16u *AX;Bit16u BX;Bit16u *DX;
+{
+ Bit16u ss = get_SS();
+ Bit16u window = read_word(ss, DX);
+
+ if (BX==0x0000)
+ {
+ vbe_set_bank(window);
+ }
}
diff --git a/vbe.h b/vbe.h
index 680b50a..6abdb47 100644
--- a/vbe.h
+++ b/vbe.h
@@ -13,7 +13,7 @@ void vbe_biosfn_return_mode_information(AX, CX, ES, DI);
void vbe_biosfn_set_mode(AX, BX, ES, DI);
void vbe_biosfn_return_current_mode(AX, BX);
void vbe_biosfn_save_restore_state(AX, DL, CX, ES, BX);
-void vbe_biosfn_display_window_control(AX);
+void vbe_biosfn_display_window_control(AX,BX,DX);
void vbe_biosfn_set_get_logical_scan_line_length(AX);
void vbe_biosfn_set_get_display_start(AX);
void vbe_biosfn_set_get_dac_palette_format(AX);
diff --git a/vbetables.h b/vbetables.h
index fc39fbb..6a62653 100644
--- a/vbetables.h
+++ b/vbetables.h
@@ -82,6 +82,131 @@ static ModeInfoListItem mode_info_list[]=
/*} ModeInfoBlock;*/
}
},
+
+ {
+ VBE_VESA_MODE_640X400X8,
+ {
+/*typedef struct ModeInfoBlock
+{*/
+// Mandatory information for all VBE revisions
+ /*Bit16u ModeAttributes*/ VBE_MODE_ATTRIBUTE_SUPPORTED |
+ VBE_MODE_ATTRIBUTE_GRAPHICS_MODE |
+ VBE_MODE_ATTRIBUTE_COLOR_MODE |
+ VBE_MODE_ATTRIBUTE_GRAPHICS_MODE,
+ /*Bit8u WinAAttributes*/ VBE_WINDOW_ATTRIBUTE_READABLE |
+ VBE_WINDOW_ATTRIBUTE_WRITEABLE,
+ /*Bit8u WinBAttributes*/ 0,
+ /*Bit16u WinGranularity*/ VBE_BANK_SIZE_KB,
+ /*Bit16u WinSize*/ VBE_BANK_SIZE_KB,
+ /*Bit16u WinASegment*/ VGAMEM_GRAPH,
+ /*Bit16u WinBSegment*/ 0,
+ /*Bit32u WinFuncPtr*/ 0,
+ /*Bit16u BytesPerScanLine*/ 640,
+// Mandatory information for VBE 1.2 and above
+ /*Bit16u XResolution*/ 640,
+ /*Bit16u YResolution*/ 400,
+ /*Bit8u XCharSize*/ 8,
+ /*Bit8u YCharSize*/ 16,
+ /*Bit8u NumberOfPlanes*/ 1,
+ /*Bit8u BitsPerPixel*/ 8,
+ /*Bit8u NumberOfBanks*/ 4, // 640x400/64kb == 4
+ /*Bit8u MemoryModel*/ VBE_MEMORYMODEL_PACKED_PIXEL,
+ /*Bit8u BankSize*/ 0,
+ /*Bit8u NumberOfImagePages*/ 0,
+ /*Bit8u Reserved_page*/ 0,
+// Direct Color fields (required for direct/6 and YUV/7 memory models)
+ /*Bit8u RedMaskSize*/ 0,
+ /*Bit8u RedFieldPosition*/ 0,
+ /*Bit8u GreenMaskSize*/ 0,
+ /*Bit8u GreenFieldPosition*/ 0,
+ /*Bit8u BlueMaskSize*/ 0,
+ /*Bit8u BlueFieldPosition*/ 0,
+ /*Bit8u RsvdMaskSize*/ 0,
+ /*Bit8u RsvdFieldPosition*/ 0,
+ /*Bit8u DirectColorModeInfo*/ 0,
+// Mandatory information for VBE 2.0 and above
+ /*Bit32u PhysBasePtr*/ VGAMEM_GRAPH_PHYSICAL_ADDRESS, //FIXME: this allows this mode to be displayed using the standard 320x200x8 vga mode
+ /*Bit32u OffScreenMemOffset*/ 0,
+ /*Bit16u OffScreenMemSize*/ 0,
+// Mandatory information for VBE 3.0 and above
+ /*Bit16u LinBytesPerScanLine*/ 640,
+ /*Bit8u BnkNumberOfPages*/ 0,
+ /*Bit8u LinNumberOfPages*/ 0,
+ /*Bit8u LinRedMaskSize*/ 0,
+ /*Bit8u LinRedFieldPosition*/ 0,
+ /*Bit8u LinGreenMaskSize*/ 0,
+ /*Bit8u LinGreenFieldPosition*/ 0,
+ /*Bit8u LinBlueMaskSize*/ 0,
+ /*Bit8u LinBlueFieldPosition*/ 0,
+ /*Bit8u LinRsvdMaskSize*/ 0,
+ /*Bit8u LinRsvdFieldPosition*/ 0,
+ /*Bit32u MaxPixelClock*/ 0,
+/*} ModeInfoBlock;*/
+ }
+ },
+
+ {
+ VBE_VESA_MODE_800X600X8,
+ {
+/*typedef struct ModeInfoBlock
+{*/
+// Mandatory information for all VBE revisions
+ /*Bit16u ModeAttributes*/ VBE_MODE_ATTRIBUTE_SUPPORTED |
+ VBE_MODE_ATTRIBUTE_GRAPHICS_MODE |
+ VBE_MODE_ATTRIBUTE_COLOR_MODE |
+ VBE_MODE_ATTRIBUTE_GRAPHICS_MODE,
+ /*Bit8u WinAAttributes*/ VBE_WINDOW_ATTRIBUTE_READABLE |
+ VBE_WINDOW_ATTRIBUTE_WRITEABLE,
+ /*Bit8u WinBAttributes*/ 0,
+ /*Bit16u WinGranularity*/ VBE_BANK_SIZE_KB,
+ /*Bit16u WinSize*/ VBE_BANK_SIZE_KB,
+ /*Bit16u WinASegment*/ VGAMEM_GRAPH,
+ /*Bit16u WinBSegment*/ 0,
+ /*Bit32u WinFuncPtr*/ 0,
+ /*Bit16u BytesPerScanLine*/ 800,
+// Mandatory information for VBE 1.2 and above
+ /*Bit16u XResolution*/ 800,
+ /*Bit16u YResolution*/ 600,
+ /*Bit8u XCharSize*/ 8,
+ /*Bit8u YCharSize*/ 16,
+ /*Bit8u NumberOfPlanes*/ 1,
+ /*Bit8u BitsPerPixel*/ 8,
+ /*Bit8u NumberOfBanks*/ 8, // 800x600/64kb == 8
+ /*Bit8u MemoryModel*/ VBE_MEMORYMODEL_PACKED_PIXEL,
+ /*Bit8u BankSize*/ 0,
+ /*Bit8u NumberOfImagePages*/ 0,
+ /*Bit8u Reserved_page*/ 0,
+// Direct Color fields (required for direct/6 and YUV/7 memory models)
+ /*Bit8u RedMaskSize*/ 0,
+ /*Bit8u RedFieldPosition*/ 0,
+ /*Bit8u GreenMaskSize*/ 0,
+ /*Bit8u GreenFieldPosition*/ 0,
+ /*Bit8u BlueMaskSize*/ 0,
+ /*Bit8u BlueFieldPosition*/ 0,
+ /*Bit8u RsvdMaskSize*/ 0,
+ /*Bit8u RsvdFieldPosition*/ 0,
+ /*Bit8u DirectColorModeInfo*/ 0,
+// Mandatory information for VBE 2.0 and above
+ /*Bit32u PhysBasePtr*/ VGAMEM_GRAPH_PHYSICAL_ADDRESS, //FIXME: this allows this mode to be displayed using the standard 320x200x8 vga mode
+ /*Bit32u OffScreenMemOffset*/ 0,
+ /*Bit16u OffScreenMemSize*/ 0,
+// Mandatory information for VBE 3.0 and above
+ /*Bit16u LinBytesPerScanLine*/ 800,
+ /*Bit8u BnkNumberOfPages*/ 0,
+ /*Bit8u LinNumberOfPages*/ 0,
+ /*Bit8u LinRedMaskSize*/ 0,
+ /*Bit8u LinRedFieldPosition*/ 0,
+ /*Bit8u LinGreenMaskSize*/ 0,
+ /*Bit8u LinGreenFieldPosition*/ 0,
+ /*Bit8u LinBlueMaskSize*/ 0,
+ /*Bit8u LinBlueFieldPosition*/ 0,
+ /*Bit8u LinRsvdMaskSize*/ 0,
+ /*Bit8u LinRsvdFieldPosition*/ 0,
+ /*Bit32u MaxPixelClock*/ 0,
+/*} ModeInfoBlock;*/
+ }
+ },
+
#ifdef LIST_UNSUPPORTED_MODI
{
VBE_VESA_MODE_640X400X8,
diff --git a/vgabios.c b/vgabios.c
index 645f179..f71050b 100644
--- a/vgabios.c
+++ b/vgabios.c
@@ -687,10 +687,7 @@ static void int10_func(DI, SI, BP, SP, BX, DX, CX, AX, DS, ES, FLAGS)
#endif
break;
case 0x05:
- //FIXME
-#ifdef DEBUG
- unimplemented();
-#endif
+ vbe_biosfn_display_window_control(&AX,BX,&DX);
break;
case 0x06:
//FIXME