aboutsummaryrefslogtreecommitdiffstats
path: root/vgasrc/stdvga.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2024-03-31 22:59:06 -0400
committerKevin O'Connor <kevin@koconnor.net>2024-04-05 17:59:42 -0400
commitaa94925d296dc31a38360056227ffb0eea749572 (patch)
tree15ac0ca77c436968f546297d3fe6430d0495a1e7 /vgasrc/stdvga.c
parent8de51a5af213ffd2981876dea737b65be75b1488 (diff)
downloadseabios-aa94925d296dc31a38360056227ffb0eea749572.tar.gz
stdvga: Rework stdvga palette index paging interface functions
Rename the functions to make them a little easier to understand. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'vgasrc/stdvga.c')
-rw-r--r--vgasrc/stdvga.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c
index 63700d41..4e2fb1fd 100644
--- a/vgasrc/stdvga.c
+++ b/vgasrc/stdvga.c
@@ -91,31 +91,36 @@ stdvga_set_palette_blinking(u8 enable_blink)
stdvga_attr_mask(0x10, 0x08, (enable_blink & 0x01) << 3);
}
+// Select 4-bit or 6-bit palette indexes (for "page" switching of colors)
void
-stdvga_select_video_dac_color_page(u8 flag, u8 data)
+stdvga_set_palette_pagesize(u8 pal_pagesize)
{
- if (!(flag & 0x01)) {
- // select paging mode
- stdvga_attr_mask(0x10, 0x80, data << 7);
- return;
- }
- // select page
+ stdvga_attr_mask(0x10, 0x80, pal_pagesize << 7);
+}
+
+// Set palette index offset (enables color switching via "pages")
+void
+stdvga_set_palette_page(u8 pal_page)
+{
+ // Check if using 4-bit or 6-bit "palette index pages"
u8 val = stdvga_attr_read(0x10);
if (!(val & 0x80))
- data <<= 2;
- data &= 0x0f;
- stdvga_attr_write(0x14, data);
+ pal_page <<= 2;
+ // select page
+ pal_page &= 0x0f;
+ stdvga_attr_write(0x14, pal_page);
}
+// Report current palette index pagesize and current page
void
-stdvga_read_video_dac_state(u8 *pmode, u8 *curpage)
+stdvga_get_palette_page(u8 *pal_pagesize, u8 *pal_page)
{
u8 val1 = stdvga_attr_read(0x10) >> 7;
u8 val2 = stdvga_attr_read(0x14) & 0x0f;
if (!(val1 & 0x01))
val2 >>= 2;
- *pmode = val1;
- *curpage = val2;
+ *pal_pagesize = val1;
+ *pal_page = val2;
}