From 69e2e358e19a71be7630ce544fc84450c8ca739d Mon Sep 17 00:00:00 2001 From: Jonathan Campbell Date: Sun, 5 Oct 2025 18:44:05 -0700 Subject: [PATCH] Fix Hercules graphics palette selection --- CHANGELOG | 2 ++ src/hardware/vga.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 7e1b69d81..0571c745b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,6 @@ Next version + - Fix bug that, for machine=hercules, prevented Hercules palette shortcut + from changing colors when in graphics mode (joncampbell123). - Remove mixer and VGA capture test modes from integration device. Update integration device version number. Convert hardcoded magic constants used in IG into constants in iglib.h which is now shared explicitly with the diff --git a/src/hardware/vga.cpp b/src/hardware/vga.cpp index 29e305ce5..074ebd236 100644 --- a/src/hardware/vga.cpp +++ b/src/hardware/vga.cpp @@ -350,7 +350,7 @@ void VGA_SetCGA2Table(uint8_t val0,uint8_t val1) { ((Bitu)total[(i >> 0u) & 1u] << 0u ) | ((Bitu)total[(i >> 1u) & 1u] << 8u ) | ((Bitu)total[(i >> 2u) & 1u] << 16u ) | ((Bitu)total[(i >> 3u) & 1u] << 24u ); #else - ((Bitu)total[(i >> 3u) & 1u] << 0u ) | ((Bitu)total[(i >> 2u) & 1u] << 8u ) | + ((Bitu)total[(i >> 3u) & 1u] << 0u ) | ((Bitu)total[(i >> 2u) & 1u] << 8u ) | ((Bitu)total[(i >> 1u) & 1u] << 16u ) | ((Bitu)total[(i >> 0u) & 1u] << 24u ); #endif } @@ -1055,8 +1055,13 @@ void VGA_Reset(Section*) { VGA_SetupXGA(); VGA_SetClock(0,CLK_25); VGA_SetClock(1,CLK_28); + /* Generate tables */ - VGA_SetCGA2Table(0,1); + if (machine == MCH_HERC && hercCard < HERC_InColor) + VGA_SetCGA2Table(0,7); /* make graphics mode use colors 0 and 7 so hercules palette selection works */ + else + VGA_SetCGA2Table(0,1); + VGA_SetCGA4Table(0,1,2,3); if (machine == MCH_HERC || machine == MCH_MDA) {