diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2024-03-31 21:58:12 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2024-04-05 17:58:49 -0400 |
commit | 2996819f7df7f5a8fb53528213baa48ab65dad90 (patch) | |
tree | 770c54977f875b30fef5e19b701a631dd9dd5d1a | |
parent | 913680885350f92965d70122f6fd54406c49af7d (diff) | |
download | seabios-2996819f7df7f5a8fb53528213baa48ab65dad90.tar.gz |
stdvga: Rename CGA palette functions
Rename stdvga_set_border_color() to stdvga_set_cga_background_color()
and stdvga_set_palette() to stdvga_set_cga_palette(). These functions
implement compatibility for old CGA cards - rename them so they are
not confused with the functions that manipulte the VGA palette.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | vgasrc/stdvga.c | 23 | ||||
-rw-r--r-- | vgasrc/stdvga.h | 4 | ||||
-rw-r--r-- | vgasrc/vgabios.c | 4 |
3 files changed, 18 insertions, 13 deletions
diff --git a/vgasrc/stdvga.c b/vgasrc/stdvga.c index da67af41..eac0357b 100644 --- a/vgasrc/stdvga.c +++ b/vgasrc/stdvga.c @@ -18,19 +18,32 @@ * Attribute control ****************************************************************/ +// Emulate CGA background setting via VGA palette index registers void -stdvga_set_border_color(u8 color) +stdvga_set_cga_background_color(u8 color) { + // Set the background color (via palette index 0) u8 v1 = color & 0x0f; if (v1 & 0x08) v1 += 0x08; stdvga_attr_write(0x00, v1); + // Dim/brighten foreground (see pal_cga[] in stdvgamodes.c) int i; for (i = 1; i < 4; i++) stdvga_attr_mask(i, 0x10, color & 0x10); } +// Emulate CGA palette setting by altering VGA palette index registers +void +stdvga_set_cga_palette(u8 palid) +{ + // Switch foreground colors (see pal_cga[] in stdvgamodes.c) + int i; + for (i = 1; i < 4; i++) + stdvga_attr_mask(i, 0x01, palid & 0x01); +} + void stdvga_set_overscan_border_color(u8 color) { @@ -44,14 +57,6 @@ stdvga_get_overscan_border_color(void) } void -stdvga_set_palette(u8 palid) -{ - int i; - for (i = 1; i < 4; i++) - stdvga_attr_mask(i, 0x01, palid & 0x01); -} - -void stdvga_set_all_palette_reg(u16 seg, u8 *data_far) { int i; diff --git a/vgasrc/stdvga.h b/vgasrc/stdvga.h index ce797836..a2375c7e 100644 --- a/vgasrc/stdvga.h +++ b/vgasrc/stdvga.h @@ -45,10 +45,10 @@ #define SEG_MTEXT 0xB000 // stdvga.c -void stdvga_set_border_color(u8 color); +void stdvga_set_cga_background_color(u8 color); +void stdvga_set_cga_palette(u8 palid); void stdvga_set_overscan_border_color(u8 color); u8 stdvga_get_overscan_border_color(void); -void stdvga_set_palette(u8 palid); void stdvga_set_all_palette_reg(u16 seg, u8 *data_far); void stdvga_get_all_palette_reg(u16 seg, u8 *data_far); void stdvga_toggle_intensity(u8 flag); diff --git a/vgasrc/vgabios.c b/vgasrc/vgabios.c index 2ca8c3dd..d522f835 100644 --- a/vgasrc/vgabios.c +++ b/vgasrc/vgabios.c @@ -457,13 +457,13 @@ handle_100a(struct bregs *regs) static void handle_100b00(struct bregs *regs) { - stdvga_set_border_color(regs->bl); + stdvga_set_cga_background_color(regs->bl); } static void handle_100b01(struct bregs *regs) { - stdvga_set_palette(regs->bl); + stdvga_set_cga_palette(regs->bl); } static void |