]> xenbits.xensource.com Git - seabios.git/commitdiff
stdvga: Rename CGA palette functions
authorKevin O'Connor <kevin@koconnor.net>
Mon, 1 Apr 2024 01:58:12 +0000 (21:58 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 5 Apr 2024 21:58:49 +0000 (17:58 -0400)
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>
vgasrc/stdvga.c
vgasrc/stdvga.h
vgasrc/vgabios.c

index da67af41af595be55b884087e217b3cd2ef2c0c0..eac0357bfb6630203d23c1494228a74b1df21fc7 100644 (file)
  * 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)
 {
@@ -43,14 +56,6 @@ stdvga_get_overscan_border_color(void)
     return stdvga_attr_read(0x11);
 }
 
-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)
 {
index ce797836cabaebed5e39acef93588202dc591fbe..a2375c7e93d94a11968243966563283ca816b905 100644 (file)
 #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);
index 2ca8c3dda7bedbb5a82cf2ac3977f0750da351e3..d522f835a01a474ac738d57ba89b74c9e66a7baf 100644 (file)
@@ -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