summaryrefslogtreecommitdiff
path: root/vgabios
diff options
context:
space:
mode:
Diffstat (limited to 'vgabios')
-rw-r--r--vgabios/ChangeLog1
-rw-r--r--vgabios/TODO3
-rw-r--r--vgabios/vbe.c87
-rw-r--r--vgabios/vbetables.h62
-rw-r--r--vgabios/vgabios.c20
5 files changed, 156 insertions, 17 deletions
diff --git a/vgabios/ChangeLog b/vgabios/ChangeLog
index 2118a67d..fd24fcfd 100644
--- a/vgabios/ChangeLog
+++ b/vgabios/ChangeLog
@@ -1,5 +1,6 @@
vgabios-0.3a (Not released yet!!)
+ . added 640x400x8, 640x480x8, 800x600x8 (800x600 is partly shown in bochs window)
. added 320x200x8 vbe support (uses the standard 320x200x8 vga mode to
display, this allows for testing & having something on screen as well,
at least until bochs host side display is up & running)
diff --git a/vgabios/TODO b/vgabios/TODO
index e4e67a6e..e8e5d636 100644
--- a/vgabios/TODO
+++ b/vgabios/TODO
@@ -49,4 +49,5 @@ Short term:
Long term:
- have bochs/plex86 host side display interface
-- support more modi \ No newline at end of file
+- support more modi
+- have text io functions in vbe mode \ No newline at end of file
diff --git a/vgabios/vbe.c b/vgabios/vbe.c
index 82e78aa3..1c494f5c 100644
--- a/vgabios/vbe.c
+++ b/vgabios/vbe.c
@@ -63,7 +63,7 @@ _vbebios_product_name:
.byte 0x00
_vbebios_product_revision:
-.ascii "$Id: vbe.c,v 1.5 2002/03/06 19:59:28 japj Exp $"
+.ascii "$Id: vbe.c,v 1.6 2002/03/06 20:55:45 japj Exp $"
.byte 0x00
#ifndef DYN_LIST
@@ -82,6 +82,7 @@ _vbebios_mode_list:
#endif
.word VBE_OWN_MODE_320X200X8
.word VBE_VESA_MODE_640X400X8
+.word VBE_VESA_MODE_640X480X8
.word VBE_VESA_MODE_800X600X8
.word VBE_VESA_MODE_END_OF_LIST
#endif
@@ -121,13 +122,18 @@ Bit16u *AX;Bit16u ES;Bit16u DI;
memcpyb(ss, &vbe_info_block, ES, DI, sizeof(vbe_info_block));
// check for VBE2 signature
- if ( (vbe_info_block.VbeSignature[0] == 'V') &&
+ if (((vbe_info_block.VbeSignature[0] == 'V') &&
(vbe_info_block.VbeSignature[1] == 'B') &&
(vbe_info_block.VbeSignature[2] == 'E') &&
- (vbe_info_block.VbeSignature[3] == '2') )
+ (vbe_info_block.VbeSignature[3] == '2')) ||
+
+ ((vbe_info_block.VbeSignature[0] == 'V') &&
+ (vbe_info_block.VbeSignature[1] == 'E') &&
+ (vbe_info_block.VbeSignature[2] == 'S') &&
+ (vbe_info_block.VbeSignature[3] == 'A')) )
{
#ifdef DEBUG
- printf("VBE correct VBE2 signature found\n");
+ printf("VBE correct VESA/VBE2 signature found\n");
#endif
// VBE Signature
vbe_info_block.VbeSignature[0] = 'V';
@@ -309,6 +315,43 @@ static void vbe_set_800x600x8()
#endasm
}
+static void vbe_set_640x480x8()
+{
+ #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, #0x1E0
+ 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
@@ -375,19 +418,23 @@ Bit16u *AX;Bit16u BX; Bit16u ES;Bit16u DI;
{
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
+ #asm
+ // FIXME: how to to do this nicely?
+ // bochs vbe code disable video mode
+ push dx
+ push ax
+ mov dx, #0xff80
+
+ // disable video mode
+ mov ax, #0x03
+ out dx, ax
+ inc dx
+ mov ax, #0x00
+ out dx, ax
+ pop ax
+ pop dx
+ #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)
@@ -433,6 +480,14 @@ Bit16u *AX;Bit16u BX; Bit16u ES;Bit16u DI;
vbe_set_640x400x8();
}
else
+ if (cur_info->mode == VBE_VESA_MODE_640X480X8)
+ {
+#ifdef DEBUG
+ printf("VBE VBE_VESA_MODE_640X480X8");
+#endif
+ vbe_set_640x480x8();
+ }
+ else
if (cur_info->mode == VBE_VESA_MODE_800X600X8)
{
#ifdef DEBUG
diff --git a/vgabios/vbetables.h b/vgabios/vbetables.h
index 6a626538..2de6c56e 100644
--- a/vgabios/vbetables.h
+++ b/vgabios/vbetables.h
@@ -146,6 +146,68 @@ static ModeInfoListItem mode_info_list[]=
},
{
+ VBE_VESA_MODE_640X480X8,
+ {
+/*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*/ 480,
+ /*Bit8u XCharSize*/ 8,
+ /*Bit8u YCharSize*/ 16,
+ /*Bit8u NumberOfPlanes*/ 1,
+ /*Bit8u BitsPerPixel*/ 8,
+ /*Bit8u NumberOfBanks*/ 5, // 640x480/64kb == 5
+ /*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
diff --git a/vgabios/vgabios.c b/vgabios/vgabios.c
index f71050be..60302709 100644
--- a/vgabios/vgabios.c
+++ b/vgabios/vgabios.c
@@ -750,6 +750,26 @@ static void biosfn_set_video_mode(mode) Bit8u mode;
Bit8u modeset_ctl,video_ctl,vga_switches;
Bit16u crtc_addr;
+
+ #asm
+ // FIXME: how to to do this nicely?
+ // bochs vbe code disable video mode
+ push dx
+ push ax
+ mov dx, #0xff80
+
+ // disable video mode
+ mov ax, #0x03
+ out dx, ax
+ inc dx
+ mov ax, #0x00
+ out dx, ax
+ pop ax
+ pop dx
+
+ #endasm
+
+
// The real mode
mode=mode&0x7f;