aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen Janssen <japj@xs4all.nl>2002-03-06 20:55:45 +0000
committerJeroen Janssen <japj@xs4all.nl>2002-03-06 20:55:45 +0000
commitcf78470cc05739efdf5e43a008a67c45686a70d2 (patch)
tree2e7fb675f4cd56da4242833675cbc0501117bf49
parentbefb8b91ef482a8fb64b6957b2e8bcdc14da7c49 (diff)
downloadvgabios-cf78470cc05739efdf5e43a008a67c45686a70d2.tar.gz
- updated changelog with new modi
- added 640x480x8 (Mandrake Installer can use this!) - added pre VBE2 compatible 'detection' - fixed problem when normal vga set mode wouldn't disable vbe mode
-rw-r--r--ChangeLog1
-rw-r--r--TODO3
-rw-r--r--vbe.c85
-rw-r--r--vbetables.h62
-rw-r--r--vgabios.c20
5 files changed, 155 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 2118a67..fd24fcf 100644
--- a/ChangeLog
+++ b/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/TODO b/TODO
index e4e67a6..e8e5d63 100644
--- a/TODO
+++ b/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/vbe.c b/vbe.c
index 574e122..01bf830 100644
--- a/vbe.c
+++ b/vbe.c
@@ -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/vbetables.h b/vbetables.h
index 6a62653..2de6c56 100644
--- a/vbetables.h
+++ b/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.c b/vgabios.c
index f71050b..6030270 100644
--- a/vgabios.c
+++ b/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;