aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen Janssen <japj@xs4all.nl>2002-03-08 22:08:08 +0000
committerJeroen Janssen <japj@xs4all.nl>2002-03-08 22:08:08 +0000
commitbef68d501aefd036a325900ffb003f0ca0a1f82f (patch)
tree96a5d905600253a04094bcc0fa4f80f783a391cf
parent6c833871580808474ed965578154e91512fe87de (diff)
downloadvgabios-bef68d501aefd036a325900ffb003f0ca0a1f82f.tar.gz
- updating vbe code to new API
-rw-r--r--ChangeLog1
-rw-r--r--TODO3
-rw-r--r--vbe.c68
-rw-r--r--vbe.h3
-rw-r--r--vgabios.c24
5 files changed, 87 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index b0dbec6..019591f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
vgabios-0.3a (Not released yet!!)
+ . updated vbebios implementation to new api
. added vbe_display_api documentation
. added 640x400x8, 640x480x8, 800x600x8, 1024x768 (>640x480 needs a special bochs patch atm)
. added 320x200x8 vbe support (uses the standard 320x200x8 vga mode to
diff --git a/TODO b/TODO
index e8e5d63..bef2ce0 100644
--- a/TODO
+++ b/TODO
@@ -44,10 +44,9 @@ v3.0
VBE:
----
Short term:
-- 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
+- have plex86 host side display interface
- 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 c48f509..097e7c1 100644
--- a/vbe.c
+++ b/vbe.c
@@ -77,6 +77,16 @@ _vbebios_product_revision:
.ascii "$Id$"
.byte 0x00
+_vbebios_info_string:
+.ascii "Bochs VBE Display Adapter"
+.byte 0x0a,0x0d
+.ascii "(C) 2002 Jeroen Janssen <japj-vbebios@darius.demon.nl>"
+.byte 0x0a,0x0d
+.ascii "This VBE Bios is released under the GNU LGPL"
+.byte 0x0a,0x0d
+.byte 0x0a,0x0d
+.byte 0x00
+
#ifndef DYN_LIST
// FIXME: for each new mode add a statement here
// at least until dynamic list creation is working
@@ -101,6 +111,60 @@ _vbebios_mode_list:
#endasm
+// from rombios.c
+#define PANIC_PORT 0x400
+
+#asm
+MACRO HALT
+ ;; the HALT macro is called with the line number of the HALT call.
+ ;; The line number is then sent to the PANIC_PORT, causing Bochs to
+ ;; print a BX_PANIC message. This will normally halt the simulation
+ ;; with a message such as "BIOS panic at rombios.c, line 4091".
+ ;; However, users can choose to make panics non-fatal and continue.
+ mov dx,#PANIC_PORT
+ mov ax,#?1
+ out dx,ax
+MEND
+#endasm
+
+
+/** VBE Init - Initialise the Vesa Bios Extension Code
+ *
+ * This function does a sanity check on the host side display code interface.
+ */
+void vbe_init()
+{
+ Bit16u dispi_id;
+
+ outw(VBE_DISPI_IOPORT_INDEX,VBE_DISPI_INDEX_ID);
+ outw(VBE_DISPI_IOPORT_DATA,VBE_DISPI_ID0);
+
+ dispi_id=inw(VBE_DISPI_IOPORT_DATA);
+
+ if (dispi_id!=VBE_DISPI_ID0)
+ {
+//FIXME this results in a 'rombios.c' line panic, but it's actually a 'vbe.c' panic
+#asm
+ HALT(__LINE__)
+#endasm
+ }
+#ifdef DEBUG
+ printf("VBE Bios $Id$\n");
+#endif
+}
+
+/** VBE Display Info - Display information on screen about the VBE
+ */
+void vbe_display_info()
+{
+#asm
+ mov ax,#0xc000
+ mov ds,ax
+ mov si,#_vbebios_info_string
+ call _display_string
+#endasm
+}
+
/** Function 00h - Return VBE Controller Information
*
* Input:
@@ -657,8 +721,8 @@ vbe_set_bank(bank)
push ax
push dx
- mov dx,#0xff80
- mov ax,#0x04
+ mov dx,#VBE_DISPI_IOPORT_INDEX
+ mov ax,#VBE_DISPI_INDEX_BANK
outw dx, ax
inc dx
diff --git a/vbe.h b/vbe.h
index a0bc649..23929e9 100644
--- a/vbe.h
+++ b/vbe.h
@@ -7,7 +7,8 @@
*
* See the function descriptions in vbe.c for more information
*/
-
+void vbe_init();
+void vbe_display_info();
void vbe_biosfn_return_controller_information(AX, ES, DI);
void vbe_biosfn_return_mode_information(AX, CX, ES, DI);
void vbe_biosfn_set_mode(AX, BX, ES, DI);
diff --git a/vgabios.c b/vgabios.c
index 6030270..cc0d06b 100644
--- a/vgabios.c
+++ b/vgabios.c
@@ -60,7 +60,10 @@ static Bit16u read_word();
static void write_byte();
static void write_word();
static Bit8u inb();
+static Bit16u inw();
static void outb();
+static void outw();
+
static Bit16u get_SS();
// Output
@@ -201,6 +204,11 @@ vgabios_init_func:
;; init basic bios vars
call _init_bios_area
+#ifdef VBE
+;; init vbe functions
+ call _vbe_init
+#endif
+
;; set int10 vect
SET_INT_VECTOR(0x10, #0xC000, #vgabios_int10_handler)
@@ -214,6 +222,12 @@ vgabios_init_func:
;; show info
call _display_info
+#ifdef VBE
+;; show vbe info
+ call _vbe_display_info
+#endif
+
+
retf
#endasm
@@ -756,13 +770,13 @@ static void biosfn_set_video_mode(mode) Bit8u mode;
// bochs vbe code disable video mode
push dx
push ax
- mov dx, #0xff80
+ mov dx, #VBE_DISPI_IOPORT_INDEX
// disable video mode
- mov ax, #0x03
+ mov ax, #VBE_DISPI_INDEX_ENABLE
out dx, ax
inc dx
- mov ax, #0x00
+ mov ax, #VBE_DISPI_DISABLED
out dx, ax
pop ax
pop dx
@@ -2251,7 +2265,6 @@ inb(port)
#endasm
}
-#if 0
Bit16u
inw(port)
Bit16u port;
@@ -2268,7 +2281,6 @@ inw(port)
pop bp
#endasm
}
-#endif
// --------------------------------------------------------------------------------------------
void
@@ -2293,7 +2305,6 @@ outb(port, val)
}
// --------------------------------------------------------------------------------------------
-#if 0
void
outw(port, val)
Bit16u port;
@@ -2314,7 +2325,6 @@ outw(port, val)
pop bp
#endasm
}
-#endif
Bit16u get_SS()
{