diff --git a/include/vga.h b/include/vga.h index af268786..a3d02c20 100644 --- a/include/vga.h +++ b/include/vga.h @@ -408,6 +408,8 @@ typedef struct { } VGA_Type; +/* Hercules Palette function */ +void Herc_Palette(void); /* Functions for different resolutions */ void VGA_SetMode(VGAModes mode); diff --git a/src/hardware/vga_other.cpp b/src/hardware/vga_other.cpp index c4b9b70e..98d29395 100644 --- a/src/hardware/vga_other.cpp +++ b/src/hardware/vga_other.cpp @@ -156,6 +156,7 @@ static Bitu read_crtc_data_other(Bitu /*port*/,Bitu /*iolen*/) { static double hue_offset = 0.0; static Bit8u cga16_val = 0; static void update_cga16_color(void); +static Bit8u herc_pal = 0; static void cga16_color_select(Bit8u val) { cga16_val = val; @@ -456,6 +457,30 @@ static void write_pcjr(Bitu port,Bitu val,Bitu /*iolen*/) { } } +static void CycleHercPal(bool pressed) { + if (!pressed) return; + if (++herc_pal>2) herc_pal=0; + Herc_Palette(); + VGA_DAC_CombineColor(1,7); +} + +void Herc_Palette(void) { + switch (herc_pal) { + case 0: // White + VGA_DAC_SetEntry(0x7,0x2a,0x2a,0x2a); + VGA_DAC_SetEntry(0xf,0x3f,0x3f,0x3f); + break; + case 1: // Amber + VGA_DAC_SetEntry(0x7,0x37,0x28,0x00); + VGA_DAC_SetEntry(0xf,0x3f,0x34,0x00); + break; + case 2: // Green + VGA_DAC_SetEntry(0x7,0x00,0x26,0x00); + VGA_DAC_SetEntry(0xf,0x00,0x3f,0x00); + break; + } +} + static void write_hercules(Bitu port,Bitu val,Bitu /*iolen*/) { switch (port) { case 0x3b8: { @@ -551,6 +576,7 @@ void VGA_SetupOther(void) { extern Bit8u int10_font_14[256 * 14]; for (i=0;i<256;i++) memcpy(&vga.draw.font[i*32],&int10_font_14[i*14],14); vga.draw.font_tables[0]=vga.draw.font_tables[1]=vga.draw.font; + MAPPER_AddHandler(CycleHercPal,MK_f11,0,"hercpal","Herc Pal"); } if (machine==MCH_CGA) { IO_RegisterWriteHandler(0x3d8,write_cga,IO_MB); diff --git a/src/ints/int10_modes.cpp b/src/ints/int10_modes.cpp index e7777e17..54fdaccb 100644 --- a/src/ints/int10_modes.cpp +++ b/src/ints/int10_modes.cpp @@ -517,6 +517,7 @@ bool INT10_SetVideoMode_OTHER(Bit16u mode,bool clearmem) { case MCH_HERC: IO_WriteB(0x3b8,0x28); // TEXT mode and blinking characters + Herc_Palette(); VGA_DAC_CombineColor(0,0); VGA_DAC_CombineColor(1,7); diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 41d98cb0..90649c05 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -302,6 +302,7 @@ void DOS_Shell::Run(void) { WriteOut(MSG_Get("SHELL_STARTUP_DEBUG")); #endif if (machine == MCH_CGA) WriteOut(MSG_Get("SHELL_STARTUP_CGA")); + if (machine == MCH_HERC) WriteOut(MSG_Get("SHELL_STARTUP_HERC")); WriteOut(MSG_Get("SHELL_STARTUP_END")); if (cmd->FindString("/INIT",line,true)) { @@ -508,6 +509,9 @@ void SHELL_Init() { "\xBA Use \033[31m(alt-)F11\033[37m to change the colours when in this mode. \xBA\n" "\xBA \xBA\n" ); + MSG_Add("SHELL_STARTUP_HERC","\xBA Use \033[31mF11\033[37m to cycle through white, amber, and green monochrome color. \xBA\n" + "\xBA \xBA\n" + ); MSG_Add("SHELL_STARTUP_DEBUG", "\xBA Press \033[31malt-Pause\033[37m to enter the debugger or start the exe with \033[33mDEBUG\033[37m. \xBA\n" "\xBA \xBA\n"