diff --git a/include/vga.h b/include/vga.h index 55abf2f8..1de2b8c9 100644 --- a/include/vga.h +++ b/include/vga.h @@ -262,7 +262,12 @@ typedef struct { Bit8u color_plane_enable; Bit8u color_select; Bit8u index; - Bit8u enabled; + Bit8u disabled; // Used for disabling the screen. + // Bit0: screen disabled by attribute controller index + // Bit1: screen disabled by sequencer index 1 bit 5 + // These are put together in one variable for performance reasons: + // the line drawing function is called maybe 60*480=28800 times/s, + // and we only need to check one variable for zero this way. } VGA_Attr; typedef struct { diff --git a/src/hardware/vga_attr.cpp b/src/hardware/vga_attr.cpp index 1f1371b0..9f23b509 100644 --- a/src/hardware/vga_attr.cpp +++ b/src/hardware/vga_attr.cpp @@ -46,7 +46,7 @@ void VGA_ATTR_SetPalette(Bit8u index,Bit8u val) { Bitu read_p3c0(Bitu /*port*/,Bitu /*iolen*/) { // Wcharts, Win 3.11 & 95 SVGA Bitu retval = attr(index) & 0x1f; - if (attr(enabled)) retval |= 0x20; + if (!(attr(disabled) & 0x1)) retval |= 0x20; return retval; } @@ -54,7 +54,8 @@ void write_p3c0(Bitu /*port*/,Bitu val,Bitu iolen) { if (!vga.internal.attrindex) { attr(index)=val & 0x1F; vga.internal.attrindex=true; - attr(enabled)=val & 0x20; + if (val & 0x20) attr(disabled) &= ~1; + else attr(disabled) |= 1; /* 0-4 Address of data register to write to port 3C0h or read from port 3C1h 5 If set screen output is enabled and the palette can not be modified, @@ -69,7 +70,7 @@ void write_p3c0(Bitu /*port*/,Bitu val,Bitu iolen) { case 0x04: case 0x05: case 0x06: case 0x07: case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f: - if (!attr(enabled)) VGA_ATTR_SetPalette(attr(index),(Bit8u)val); + if (attr(disabled) & 0x1) VGA_ATTR_SetPalette(attr(index),(Bit8u)val); /* 0-5 Index into the 256 color DAC table. May be modified by 3C0h index 10h and 14h. diff --git a/src/hardware/vga_draw.cpp b/src/hardware/vga_draw.cpp index f24c5d78..a12d9580 100644 --- a/src/hardware/vga_draw.cpp +++ b/src/hardware/vga_draw.cpp @@ -637,15 +637,13 @@ static void VGA_ProcessSplit() { } static void VGA_DrawSingleLine(Bitu /*blah*/) { - if (vga.attr.enabled) { - Bit8u * data=VGA_DrawLine( vga.draw.address, vga.draw.address_line ); - RENDER_DrawLine(data); - } else { - // else draw overscan color line - // TODO: black line should be good enough for now - // (DoWhackaDo) + if (GCC_UNLIKELY(vga.attr.disabled)) { + // draw blanked line (DoWhackaDo, Alien Carnage, TV sports Football) memset(TempLine, 0, sizeof(TempLine)); RENDER_DrawLine(TempLine); + } else { + Bit8u * data=VGA_DrawLine( vga.draw.address, vga.draw.address_line ); + RENDER_DrawLine(data); } vga.draw.address_line++; diff --git a/src/hardware/vga_other.cpp b/src/hardware/vga_other.cpp index 80143d4f..47b47b14 100644 --- a/src/hardware/vga_other.cpp +++ b/src/hardware/vga_other.cpp @@ -522,7 +522,7 @@ Bitu read_herc_status(Bitu /*port*/,Bitu /*iolen*/) { void VGA_SetupOther(void) { Bitu i; memset( &vga.tandy, 0, sizeof( vga.tandy )); - vga.attr.enabled = true; + vga.attr.disabled = 0; vga.config.bytes_skip=0; //Initialize values common for most machines, can be overwritten diff --git a/src/hardware/vga_s3.cpp b/src/hardware/vga_s3.cpp index c656a4d0..3d428788 100644 --- a/src/hardware/vga_s3.cpp +++ b/src/hardware/vga_s3.cpp @@ -355,7 +355,7 @@ Bitu SVGA_S3_ReadCRTC( Bitu reg, Bitu iolen) { switch (reg) { case 0x24: /* attribute controller index (read only) */ case 0x26: - return (vga.attr.enabled?0x20:0x00) | (vga.attr.index&0x1f); + return ((vga.attr.disabled & 1)?0x00:0x20) | (vga.attr.index & 0x1f); case 0x2d: /* Extended Chip ID (high byte of PCI device ID) */ return 0x88; case 0x2e: /* New Chip ID (low byte of PCI device ID) */ diff --git a/src/hardware/vga_seq.cpp b/src/hardware/vga_seq.cpp index 33a6604d..edd400a4 100644 --- a/src/hardware/vga_seq.cpp +++ b/src/hardware/vga_seq.cpp @@ -47,6 +47,8 @@ void write_p3c5(Bitu /*port*/,Bitu val,Bitu iolen) { } else { seq(clocking_mode)=val; } + if (val & 0x20) vga.attr.disabled |= 0x2; + else vga.attr.disabled &= ~0x2; } /* TODO Figure this out :) 0 If set character clocks are 8 dots wide, else 9.