Update Tseng emulation to reflect port 3DAh behavior and CRTC register 33h behavior that is documented by Tseng and expected by VGAKIT

This commit is contained in:
Jonathan Campbell
2025-10-05 20:43:11 -07:00
parent 69e2e358e1
commit 199c065161
3 changed files with 27 additions and 8 deletions

View File

@@ -1,4 +1,10 @@
Next version
- Tseng ET3000/ET4000: Update Status register 3DAh behavior when emulating
Tseng chipsets to reflect Tseng datasheet, and VGAKIT SVGA detection code
expectations. Bit 7 is expected, as documented by Tseng, to be the inverse
of bit 3 (vertical retrace). Extended Start Register CRTC 33h must not
allow setting the upper 4 bits because Tseng only documents the bottom
four, and because VGAKIT requires it for Tseng detection (joncampbell123).
- Fix bug that, for machine=hercules, prevented Hercules palette shortcut
from changing colors when in graphics mode (joncampbell123).
- Remove mixer and VGA capture test modes from integration device. Update

View File

@@ -71,17 +71,27 @@ Bitu vga_read_p3da(Bitu port,Bitu iolen) {
if (timeInFrame >= vga.draw.delay.vdend) {
retval |= 1; // vertical blanking
} else {
double timeInLine=fmod(timeInFrame,vga.draw.delay.htotal);
if (timeInLine >= vga.draw.delay.hblkstart &&
timeInLine <= vga.draw.delay.hblkend) {
const double timeInLine = fmod(timeInFrame,vga.draw.delay.htotal);
if (timeInLine >= vga.draw.delay.hblkstart && timeInLine <= vga.draw.delay.hblkend)
retval |= 1; // horizontal blanking
}
}
if (timeInFrame >= vga.draw.delay.vrstart &&
timeInFrame <= vga.draw.delay.vrend) {
if (timeInFrame >= vga.draw.delay.vrstart && timeInFrame <= vga.draw.delay.vrend)
retval |= 8; // vertical retrace
}
/* Tseng ET3000/ET4000 cards have additional documented bits:
* [http://hackipedia.org/browse.cgi/Computer/Platform/PC%2c%20IBM%20compatible/Video/VGA/SVGA/Tseng%20Labs/Tseng%20ET4000%20Graphics%20Controller%20%281990%29%2epdf]
*
* bit 0 ~display enable (hblank | vblank)
* bit 1-2 zero
* bit 3 vretrace
* bit 4-5 diagnostic feedback from attribute controller(?)
* bi6 6 zero
* bit 7 ~vretrace (invert of bit 3)
*
* VGAKIT must read bit 7 as a complement of bit 3 to test for ET3000/ET4000 */
if (IS_VGA_ARCH && (svgaCard == SVGA_TsengET3K || svgaCard == SVGA_TsengET4K))
retval ^= ((retval & 8u) ^ 8u) << 4u;
vsync_poll_debug_notify();
return retval;

View File

@@ -100,8 +100,11 @@ void write_p3d5_et4k(Bitu reg,Bitu val,Bitu iolen) {
// 3d4 index 33h (R/W): Extended start Address
// 0-1 Display Start Address bits 16-17
// 2-3 Cursor start address bits 16-17
// 4-7 zero, does not exist
// Used by standard Tseng ID scheme
et4k.store_3d4_33 = val;
// The upper 4 bits must remain zero or else VGAKIT based programs will fail to detect ET3000/ET4000.
// See also [http://hackipedia.org/browse.cgi/Computer/Platform/PC%2c%20IBM%20compatible/Video/VGA/SVGA/Tseng%20Labs/Tseng%20ET4000%20Graphics%20Controller%20%281990%29%2epdf] PDF page 131 "Extended Start Address".
et4k.store_3d4_33 = val & 0x0F;
vga.config.display_start = (vga.config.display_start & 0xffff) | ((val & 0x03)<<16);
vga.config.cursor_start = (vga.config.cursor_start & 0xffff) | ((val & 0x0c)<<14);
break;