aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-10-23 16:24:36 -0400
committerKevin O'Connor <kevin@koconnor.net>2014-10-27 11:03:12 -0400
commit63977905a05fe36deac4aee9ef28bec8a13be402 (patch)
tree4a8bd5b041b9772a5773f7c64eee08a96ae1537e
parentc5acee4d8da81b915f587586280d84d347b1e7df (diff)
downloadseabios-63977905a05fe36deac4aee9ef28bec8a13be402.zip
seabios-63977905a05fe36deac4aee9ef28bec8a13be402.tar.gz
seabios-63977905a05fe36deac4aee9ef28bec8a13be402.tar.bz2
vgabios: Move standard table definitions to std/vga.h
Move the standard video bios definitions into a new header file. Also, define a struct with the layout for the static functionality table. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r--src/std/vga.h63
-rw-r--r--vgasrc/stdvgamodes.c4
-rw-r--r--vgasrc/vgabios.c44
-rw-r--r--vgasrc/vgabios.h19
-rw-r--r--vgasrc/vgainit.c16
5 files changed, 79 insertions, 67 deletions
diff --git a/src/std/vga.h b/src/std/vga.h
new file mode 100644
index 0000000..de9ec75
--- /dev/null
+++ b/src/std/vga.h
@@ -0,0 +1,63 @@
+#ifndef __VGA_H
+#define __VGA_H
+// Standard structure definitions for vgabios video tables
+
+#include "types.h" // u8
+
+// standard BIOS Video Parameter Table
+struct video_param_s {
+ u8 twidth;
+ u8 theightm1;
+ u8 cheight;
+ u16 slength;
+ u8 sequ_regs[4];
+ u8 miscreg;
+ u8 crtc_regs[25];
+ u8 actl_regs[20];
+ u8 grdc_regs[9];
+} PACKED;
+
+// Standard Video Save Pointer Table
+struct video_save_pointer_s {
+ struct segoff_s videoparam;
+ struct segoff_s paramdynamicsave;
+ struct segoff_s textcharset;
+ struct segoff_s graphcharset;
+ struct segoff_s secsavepointer;
+ u8 reserved[8];
+} PACKED;
+
+// Data returned by int101B
+struct video_func_static {
+ u32 modes;
+ u8 reserved_0x04[3];
+ u8 scanlines;
+ u8 cblocks;
+ u8 active_cblocks;
+ u16 misc_flags;
+ u8 reserved_0x0c[2];
+ u8 save_flags;
+ u8 reserved_0x0f;
+} PACKED;
+
+struct video_func_info {
+ struct segoff_s static_functionality;
+ u8 bda_0x49[30];
+ u8 bda_0x84[3];
+ u8 dcc_index;
+ u8 dcc_alt;
+ u16 colors;
+ u8 pages;
+ u8 scan_lines;
+ u8 primary_char;
+ u8 secondar_char;
+ u8 misc;
+ u8 non_vga_mode;
+ u8 reserved_2f[2];
+ u8 video_mem;
+ u8 save_flags;
+ u8 disp_info;
+ u8 reserved_34[12];
+} PACKED;
+
+#endif // vga.h
diff --git a/vgasrc/stdvgamodes.c b/vgasrc/stdvgamodes.c
index 8436729..53b7463 100644
--- a/vgasrc/stdvgamodes.c
+++ b/vgasrc/stdvgamodes.c
@@ -9,7 +9,7 @@
#include "output.h" // warn_internalerror
#include "stdvga.h" // stdvga_find_mode
#include "string.h" // memcpy_far
-#include "vgabios.h" // struct VideoParamTableEntry_s
+#include "vgabios.h" // video_param_table
/****************************************************************
@@ -363,7 +363,7 @@ stdvga_build_video_param(void)
int mode = GET_GLOBAL(parammodes[i]);
if (! mode)
continue;
- struct VideoParam_s *vparam_g = &video_param_table[i];
+ struct video_param_s *vparam_g = &video_param_table[i];
struct vgamode_s *vmode_g = stdvga_find_mode(mode);
if (!vmode_g)
continue;
diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c
index e17974a..9b94f4d 100644
--- a/vgasrc/vgabios.c
+++ b/vgasrc/vgabios.c
@@ -1076,51 +1076,23 @@ handle_101a(struct bregs *regs)
}
-static u8 static_functionality[0x10] VAR16 = {
- /* 0 */ 0xff, // All modes supported #1
- /* 1 */ 0xe0, // All modes supported #2
- /* 2 */ 0x0f, // All modes supported #3
- /* 3 */ 0x00, 0x00, 0x00, 0x00, // reserved
- /* 7 */ 0x07, // 200, 350, 400 scan lines
- /* 8 */ 0x02, // mamimum number of visible charsets in text mode
- /* 9 */ 0x08, // total number of charset blocks in text mode
- /* a */ 0xe7, // Change to add new functions
- /* b */ 0x0c, // Change to add new functions
- /* c */ 0x00, // reserved
- /* d */ 0x00, // reserved
- /* e */ 0x00, // Change to add new functions
- /* f */ 0x00 // reserved
+static struct video_func_static static_functionality VAR16 = {
+ .modes = 0x0fe0ff,
+ .scanlines = 0x07, // 200, 350, 400 scan lines
+ .cblocks = 0x02, // mamimum number of visible charsets in text mode
+ .active_cblocks = 0x08, // total number of charset blocks in text mode
+ .misc_flags = 0x0ce7,
};
-struct funcInfo {
- struct segoff_s static_functionality;
- u8 bda_0x49[30];
- u8 bda_0x84[3];
- u8 dcc_index;
- u8 dcc_alt;
- u16 colors;
- u8 pages;
- u8 scan_lines;
- u8 primary_char;
- u8 secondar_char;
- u8 misc;
- u8 non_vga_mode;
- u8 reserved_2f[2];
- u8 video_mem;
- u8 save_flags;
- u8 disp_info;
- u8 reserved_34[12];
-} PACKED;
-
static void
handle_101b(struct bregs *regs)
{
u16 seg = regs->es;
- struct funcInfo *info = (void*)(regs->di+0);
+ struct video_func_info *info = (void*)(regs->di+0);
memset_far(seg, info, 0, sizeof(*info));
// Address of static functionality table
SET_FARVAR(seg, info->static_functionality
- , SEGOFF(get_global_seg(), (u32)static_functionality));
+ , SEGOFF(get_global_seg(), (u32)&static_functionality));
// Hard coded copy from BIOS area. Should it be cleaner ?
memcpy_far(seg, info->bda_0x49, SEG_BDA, (void*)0x49
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h
index 0ec4a8e..397225a 100644
--- a/vgasrc/vgabios.h
+++ b/vgasrc/vgabios.h
@@ -3,21 +3,7 @@
#include "types.h" // u8
#include "farptr.h" // struct segoff_s
-
-// standard BIOS Video Parameter Table
-struct VideoParam_s {
- u8 twidth;
- u8 theightm1;
- u8 cheight;
- u16 slength;
- u8 sequ_regs[4];
- u8 miscreg;
- u8 crtc_regs[25];
- u8 actl_regs[20];
- u8 grdc_regs[9];
-} PACKED;
-
-extern struct VideoParam_s video_param_table[29];
+#include "std/vga.h" // struct video_param_s
// Save/Restore flags
#define SR_HARDWARE 0x0001
@@ -103,7 +89,8 @@ extern u8 vgafont14alt[];
extern u8 vgafont16alt[];
// vgainit.c
-extern struct VideoSavePointer_s video_save_pointer_table;
+extern struct video_save_pointer_s video_save_pointer_table;
+extern struct video_param_s video_param_table[29];
// vgabios.c
extern int VgaBDF;
diff --git a/vgasrc/vgainit.c b/vgasrc/vgainit.c
index a16e81c..6ef19e1 100644
--- a/vgasrc/vgainit.c
+++ b/vgasrc/vgainit.c
@@ -15,22 +15,12 @@
#include "std/pmm.h" // struct pmmheader
#include "string.h" // checksum_far
#include "util.h" // VERSION
-#include "vgabios.h" // struct VideoSavePointer_s
+#include "vgabios.h" // video_save_pointer_table
#include "vgahw.h" // vgahw_setup
-// Standard Video Save Pointer Table
-struct VideoSavePointer_s {
- struct segoff_s videoparam;
- struct segoff_s paramdynamicsave;
- struct segoff_s textcharset;
- struct segoff_s graphcharset;
- struct segoff_s secsavepointer;
- u8 reserved[8];
-} PACKED;
+struct video_save_pointer_s video_save_pointer_table VAR16;
-struct VideoSavePointer_s video_save_pointer_table VAR16;
-
-struct VideoParam_s video_param_table[29] VAR16;
+struct video_param_s video_param_table[29] VAR16;
// Type of emulator platform - for dprintf with certain compile options.
int PlatformRunningOn VAR16;