From 8c3e1399ecf742444053a8cf95b0b609b3340672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 3 Nov 2004 15:43:27 +0000 Subject: [PATCH] Thanks to Johannes Fortmann, I learned that the blinking mode can be turned off to enable bright background colors. It's now always done which enabled me to improve the slider colors a bit. Therefore, console_set_color() no longer clears bit 8 from the background color. Now no longer tries to change the palette in non-8-bit modes; that fixes the strange colors I got in high and true color modes (VESA palette changing would fail and the fallback VGA palette changing was responsible for the effect). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9772 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../boot/platform/bios_ia32/console.cpp | 2 +- src/kernel/boot/platform/bios_ia32/console.h | 2 +- src/kernel/boot/platform/bios_ia32/menu.cpp | 6 ++--- src/kernel/boot/platform/bios_ia32/video.cpp | 27 ++++++++++++++++--- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/kernel/boot/platform/bios_ia32/console.cpp b/src/kernel/boot/platform/bios_ia32/console.cpp index 4072fd6eea..401595e816 100644 --- a/src/kernel/boot/platform/bios_ia32/console.cpp +++ b/src/kernel/boot/platform/bios_ia32/console.cpp @@ -125,7 +125,7 @@ console_set_cursor(int32 x, int32 y) void console_set_color(int32 foreground, int32 background) { - sColor = (background & 0x7) << 12 | (foreground & 0xf) << 8; + sColor = (background & 0xf) << 12 | (foreground & 0xf) << 8; } diff --git a/src/kernel/boot/platform/bios_ia32/console.h b/src/kernel/boot/platform/bios_ia32/console.h index 3084c69d5a..a093a373f1 100644 --- a/src/kernel/boot/platform/bios_ia32/console.h +++ b/src/kernel/boot/platform/bios_ia32/console.h @@ -20,7 +20,7 @@ enum console_color { PURPLE, BROWN, GRAY, - // foreground colors only + // foreground colors only if blinking is enabled DARK_GRAY, BRIGHT_BLUE, BRIGHT_GREEN, diff --git a/src/kernel/boot/platform/bios_ia32/menu.cpp b/src/kernel/boot/platform/bios_ia32/menu.cpp index 9a6c63ddd1..dc27a5c2fd 100644 --- a/src/kernel/boot/platform/bios_ia32/menu.cpp +++ b/src/kernel/boot/platform/bios_ia32/menu.cpp @@ -34,9 +34,9 @@ static const console_color kItemBackgroundColor = kBackgroundColor; static const console_color kSelectedItemBackgroundColor = GRAY; static const console_color kDisabledColor = DARK_GRAY; -static const console_color kSliderColor = GRAY; -static const console_color kSliderBackgroundColor = CYAN; -static const console_color kArrowColor = WHITE; +static const console_color kSliderColor = CYAN; +static const console_color kSliderBackgroundColor = DARK_GRAY; +static const console_color kArrowColor = GRAY; static int32 sMenuOffset = 0; diff --git a/src/kernel/boot/platform/bios_ia32/video.cpp b/src/kernel/boot/platform/bios_ia32/video.cpp index 120cbe8768..0b2793d06f 100644 --- a/src/kernel/boot/platform/bios_ia32/video.cpp +++ b/src/kernel/boot/platform/bios_ia32/video.cpp @@ -56,6 +56,21 @@ vga_set_palette(const uint8 *palette, int32 firstIndex, int32 numEntries) } +static void +vga_enable_bright_background_colors(void) +{ + // reset attribute controller + in8(0x03da); + + // select mode control register + out8(0x30, 0x03c0); + + // read mode control register, change it (we need to clear bit 3), and write it back + uint8 mode = in8(0x03c1) & 0xf7; + out8(mode, 0x3c0); +} + + // #pragma mark - // VESA functions @@ -222,11 +237,10 @@ vesa_set_mode(uint16 mode) static status_t vesa_set_palette(const uint8 *palette, int32 firstIndex, int32 numEntries) { -#if 0 // is this an 8 bit indexed color mode? - if (gKernelArgs.fb.bit_depth = modeInfo.bits_per_pixel != 8) + if (gKernelArgs.frame_buffer.depth != 8) return B_BAD_TYPE; -#endif + #if 0 struct bios_regs regs; regs.eax = 0x4f09; @@ -386,13 +400,18 @@ platform_switch_to_logo(void) extern "C" void platform_switch_to_text_mode(void) { - if (!gKernelArgs.frame_buffer.enabled) + + if (!gKernelArgs.frame_buffer.enabled) { + vga_enable_bright_background_colors(); return; + } bios_regs regs; regs.eax = 3; call_bios(0x10, ®s); gKernelArgs.frame_buffer.enabled = 0; + + vga_enable_bright_background_colors(); }