1
0
Fork 0

Add green/amber hercules mode emulation support. (Thanks ripsaw and h-a-l-9000)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3579
This commit is contained in:
Peter Veenstra 2010-04-15 13:22:21 +00:00
parent d40f71fc45
commit f3c1902dab
4 changed files with 33 additions and 0 deletions

View file

@ -408,6 +408,8 @@ typedef struct {
} VGA_Type;
/* Hercules Palette function */
void Herc_Palette(void);
/* Functions for different resolutions */
void VGA_SetMode(VGAModes mode);

View file

@ -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);

View file

@ -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);

View file

@ -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"