From 4751e234c04f9d92feae5d034a14e52f9e5e505a Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Tue, 3 May 2005 20:33:55 +0000 Subject: [PATCH] Fix CGA color select register writing in machine=vga mode Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2206 --- src/ints/int10_pal.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/ints/int10_pal.cpp b/src/ints/int10_pal.cpp index 456af7ed..39a62333 100644 --- a/src/ints/int10_pal.cpp +++ b/src/ints/int10_pal.cpp @@ -174,12 +174,32 @@ void INT10_SetBackgroundBorder(Bit8u val) { Bitu temp=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL); temp=(temp & 0xe0) | (val & 0x1f); real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,temp); - IO_Write(0x3d9,temp); + if (machine == MCH_CGA || machine == MCH_TANDY) + IO_Write(0x3d9,temp); + else if (machine == MCH_VGA) { + val = ((val << 1) & 0x10) | (val & 0x7); + INT10_SetSinglePaletteRegister( 0, val ); + val = (temp & 0x10) | 2 | ((temp & 0x20) >> 5); + INT10_SetSinglePaletteRegister( 1, val ); + val+=2; + INT10_SetSinglePaletteRegister( 2, val ); + val+=2; + INT10_SetSinglePaletteRegister( 3, val ); + } } void INT10_SetColorSelect(Bit8u val) { Bitu temp=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL); temp=(temp & 0xdf) | ((val & 1) ? 0x20 : 0x0); real_writeb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAL,temp); - IO_Write(0x3d9,temp); + if (machine == MCH_CGA || machine == MCH_TANDY) + IO_Write(0x3d9,temp); + else if (machine == MCH_VGA) { + val = (temp & 0x10) | 2 | val; + INT10_SetSinglePaletteRegister( 1, val ); + val+=2; + INT10_SetSinglePaletteRegister( 2, val ); + val+=2; + INT10_SetSinglePaletteRegister( 3, val ); + } }