aboutsummaryrefslogtreecommitdiffstats
path: root/vgasrc/vgabios.h
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2014-10-30 12:09:19 -0400
committerKevin O'Connor <kevin@koconnor.net>2014-11-12 12:17:57 -0500
commit6fed307251e2590e9a999af64cf29ff739b034f9 (patch)
tree64662671047950c5a918be236deaddae1cef6fb8 /vgasrc/vgabios.h
parent09ae7f1b59a18f3b051cc0934efcd09d70fa6171 (diff)
downloadseabios-6fed307251e2590e9a999af64cf29ff739b034f9.tar.gz
vgabios: Support emulating text mode attributes while in graphics mode
Add support for simple text mode attribute emulation while in graphics mode. This improves text highlighting and background color on some boot-loaders. Enable it only for CBVGA vgabios and only when a text mode is requested. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc/vgabios.h')
-rw-r--r--vgasrc/vgabios.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/vgasrc/vgabios.h b/vgasrc/vgabios.h
index d06ebb4c..344b3d9e 100644
--- a/vgasrc/vgabios.h
+++ b/vgasrc/vgabios.h
@@ -1,6 +1,7 @@
#ifndef __VGABIOS_H
#define __VGABIOS_H
+#include "config.h" // CONFIG_VGA_EMULATE_TEXT
#include "types.h" // u8
#include "farptr.h" // struct segoff_s
#include "std/vga.h" // struct video_param_s
@@ -70,12 +71,19 @@ struct vga_bda_s {
u16 vgamode_offset;
} PACKED;
-#define BF_PM_MASK 0x0f
+#define BF_PM_MASK 0x0f
+#define BF_EMULATE_TEXT 0x10
#define GET_BDA_EXT(var) \
GET_FARVAR(SEG_BDA, ((struct vga_bda_s *)VGA_CUSTOM_BDA)->var)
#define SET_BDA_EXT(var, val) \
SET_FARVAR(SEG_BDA, ((struct vga_bda_s *)VGA_CUSTOM_BDA)->var, (val))
+#define MASK_BDA_EXT(var, off, on) \
+ SET_BDA_EXT(var, (GET_BDA_EXT(var) & ~(off)) | (on))
+
+static inline int vga_emulate_text(void) {
+ return CONFIG_VGA_EMULATE_TEXT && GET_BDA_EXT(flags) & BF_EMULATE_TEXT;
+}
// Debug settings
#define DEBUG_VGA_POST 1