From fb14e1881f0a1da9fe9396c26d9bcdf812994380 Mon Sep 17 00:00:00 2001 From: SarahW Date: Sat, 24 Mar 2018 19:50:26 +0000 Subject: [PATCH] Moved post-rev1065 0x3da code to OTI-037C specific code. Restored pre-rev1065 generic SVGA 0x3da code. Fixes PS/2 VGA self test. --- src/vid_oti037.c | 39 +++++++++++++++++++++++++++++++++++++++ src/vid_svga.c | 32 -------------------------------- 2 files changed, 39 insertions(+), 32 deletions(-) diff --git a/src/vid_oti037.c b/src/vid_oti037.c index 3843c1f..eb06416 100644 --- a/src/vid_oti037.c +++ b/src/vid_oti037.c @@ -109,6 +109,45 @@ uint8_t oti037_in(uint16_t addr, void *p) temp = svga->crtc[svga->crtcreg & 31]; break; + case 0x3DA: + svga->attrff = 0; + + /*The OTI-037C BIOS waits for bits 0 and 3 in 0x3da to go low, then reads 0x3da again + and expects the diagnostic bits to equal the current border colour. As I understand + it, the 0x3da active enable status does not include the border time, so this may be + an area where OTI-037C is not entirely VGA compatible.*/ + svga->cgastat &= ~0x30; + /* copy color diagnostic info from the overscan color register */ + switch (svga->attrregs[0x12] & 0x30) + { + case 0x00: /* P0 and P2 */ + if (svga->attrregs[0x11] & 0x01) + svga->cgastat |= 0x10; + if (svga->attrregs[0x11] & 0x04) + svga->cgastat |= 0x20; + break; + case 0x10: /* P4 and P5 */ + if (svga->attrregs[0x11] & 0x10) + svga->cgastat |= 0x10; + if (svga->attrregs[0x11] & 0x20) + svga->cgastat |= 0x20; + break; + case 0x20: /* P1 and P3 */ + if (svga->attrregs[0x11] & 0x02) + svga->cgastat |= 0x10; + if (svga->attrregs[0x11] & 0x08) + svga->cgastat |= 0x20; + break; + case 0x30: /* P6 and P7 */ + if (svga->attrregs[0x11] & 0x40) + svga->cgastat |= 0x10; + if (svga->attrregs[0x11] & 0x80) + svga->cgastat |= 0x20; + break; + } + return svga->cgastat; + + case 0x3DE: temp = oti037->index; break; diff --git a/src/vid_svga.c b/src/vid_svga.c index 1de0a20..d94606f 100644 --- a/src/vid_svga.c +++ b/src/vid_svga.c @@ -261,43 +261,11 @@ uint8_t svga_in(uint16_t addr, void *p) case 0x3DA: svga->attrff = 0; - /* old diagnostic code if (svga->cgastat & 0x01) svga->cgastat &= ~0x30; else svga->cgastat ^= 0x30; return svga->cgastat; - */ - svga->cgastat &= ~0x30; - /* copy color diagnostic info from the overscan color register */ - switch (svga->attrregs[0x12] & 0x30) - { - case 0x00: /* P0 and P2 */ - if (svga->attrregs[0x11] & 0x01) - svga->cgastat |= 0x10; - if (svga->attrregs[0x11] & 0x04) - svga->cgastat |= 0x20; - break; - case 0x10: /* P4 and P5 */ - if (svga->attrregs[0x11] & 0x10) - svga->cgastat |= 0x10; - if (svga->attrregs[0x11] & 0x20) - svga->cgastat |= 0x20; - break; - case 0x20: /* P1 and P3 */ - if (svga->attrregs[0x11] & 0x02) - svga->cgastat |= 0x10; - if (svga->attrregs[0x11] & 0x08) - svga->cgastat |= 0x20; - break; - case 0x30: /* P6 and P7 */ - if (svga->attrregs[0x11] & 0x40) - svga->cgastat |= 0x10; - if (svga->attrregs[0x11] & 0x80) - svga->cgastat |= 0x20; - break; - } - return svga->cgastat; } // printf("Bad EGA read %04X %04X:%04X\n",addr,cs>>4,pc); return 0xFF;