1
0
Fork 0

Properly convert the 6 bit of vga to the 8bit output

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3391
This commit is contained in:
Sjoerd van der Berg 2009-05-16 06:40:13 +00:00
parent 05da192ef7
commit 1d71454869

View file

@ -50,16 +50,19 @@ Note: Each read or write of this register will cycle through first the
enum {DAC_READ,DAC_WRITE};
static INLINE void VGA_DAC_UpdateColor( Bitu index ) {
static void VGA_DAC_SendColor( Bitu index, Bitu src ) {
const Bit8u red = vga.dac.rgb[src].red;
const Bit8u green = vga.dac.rgb[src].green;
const Bit8u blue = vga.dac.rgb[src].blue;
//Set entry in 16bit output lookup table
vga.dac.xlat16[index] = ((blue>>1)&0x1f) | (((green)&0x3f)<<5) | (((red>>1)&0x1f) << 11);
RENDER_SetPal( index, (red << 2) | ( red >> 4 ), (green << 2) | ( green >> 4 ), (blue << 2) | ( blue >> 4 ) );
}
static void VGA_DAC_UpdateColor( Bitu index ) {
Bitu maskIndex = index & vga.dac.pel_mask;
vga.dac.xlat16[index] = ((vga.dac.rgb[maskIndex].blue>>1)&0x1f) |
(((vga.dac.rgb[maskIndex].green)&0x3f)<<5)|
(((vga.dac.rgb[maskIndex].red>>1)&0x1f) << 11);
RENDER_SetPal( index,
vga.dac.rgb[maskIndex].red << 2,
vga.dac.rgb[maskIndex].green << 2,
vga.dac.rgb[maskIndex].blue << 2
);
VGA_DAC_SendColor( index, maskIndex );
}
static void write_p3c6(Bitu port,Bitu val,Bitu iolen) {
@ -129,14 +132,7 @@ static void write_p3c9(Bitu port,Bitu val,Bitu iolen) {
/* Check for attributes and DAC entry link */
for (Bitu i=0;i<16;i++) {
if (vga.dac.combine[i]==vga.dac.write_index) {
vga.dac.xlat16[i] = (
(vga.dac.rgb[vga.dac.write_index].blue>>1)&0x1f) |
(((vga.dac.rgb[vga.dac.write_index].green)&0x3f)<<5)|
(((vga.dac.rgb[vga.dac.write_index].red>>1)&0x1f) << 11);
RENDER_SetPal(i,
vga.dac.rgb[vga.dac.write_index].red << 2,
vga.dac.rgb[vga.dac.write_index].green << 2,
vga.dac.rgb[vga.dac.write_index].blue << 2);
VGA_DAC_SendColor( i, vga.dac.write_index );
}
}
}
@ -184,16 +180,8 @@ void VGA_DAC_CombineColor(Bit8u attr,Bit8u pal) {
case M_VGA:
// used by copper demo; almost no video card seems to suport it
if(!IS_VGA_ARCH || (svgaCard!=SVGA_None)) break;
default:
vga.dac.xlat16[attr] = ((vga.dac.rgb[pal].blue>>1)&0x1f) |
(((vga.dac.rgb[pal].green)&0x3f)<<5)|
(((vga.dac.rgb[pal].red>>1)&0x1f) << 11);
RENDER_SetPal(attr,
vga.dac.rgb[pal].red << 2,
vga.dac.rgb[pal].green << 2,
vga.dac.rgb[pal].blue << 2
);
VGA_DAC_SendColor( attr, pal );
}
}
@ -204,7 +192,7 @@ void VGA_DAC_SetEntry(Bitu entry,Bit8u red,Bit8u green,Bit8u blue) {
vga.dac.rgb[entry].blue=blue;
for (Bitu i=0;i<16;i++)
if (vga.dac.combine[i]==entry)
RENDER_SetPal(i,red << 2,green << 2,blue << 2);
VGA_DAC_SendColor( i, i );
}
void VGA_SetupDAC(void) {