From 8453a88223b401b9eb89ad402a7b891c6be0a0ee Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 25 Aug 2018 09:43:33 +0200 Subject: [PATCH] Fixes to ET4000AX and ET4000/W32p, everything should now hopefully correctly on both cards. --- src/video/vid_et4000.c | 41 ++++----------------------------------- src/video/vid_et4000w32.c | 33 +++++-------------------------- 2 files changed, 9 insertions(+), 65 deletions(-) diff --git a/src/video/vid_et4000.c b/src/video/vid_et4000.c index c836b9ec0..bef8fbcf1 100644 --- a/src/video/vid_et4000.c +++ b/src/video/vid_et4000.c @@ -8,7 +8,7 @@ * * Emulation of the Tseng Labs ET4000. * - * Version: @(#)vid_et4000.c 1.0.12 2018/08/24 + * Version: @(#)vid_et4000.c 1.0.14 2018/08/25 * * Authors: Sarah Walker, * Miran Grca, @@ -57,7 +57,7 @@ typedef struct et4000_t int get_korean_font_enabled; int get_korean_font_index; uint16_t get_korean_font_base; - uint32_t vram_mask, key; + uint32_t vram_mask; uint8_t hcr, mcr; } et4000_t; @@ -87,23 +87,12 @@ void et4000_out(uint16_t addr, uint8_t val, void *p) switch (addr) { - case 0x3BF: case 0x3DF: - et4000->hcr = val; - return; - - case 0x3c2: - if (val & 1) - io_sethandler(0x03bf, 0x0001, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000); - else - io_removehandler(0x03bf, 0x0001, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000); - break; - case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9: sc1502x_ramdac_out(addr, val, &et4000->ramdac, svga); return; case 0x3CD: /*Banking*/ - if (et4000->key && !(svga->crtc[0x36] & 0x10)) { + if (!(svga->crtc[0x36] & 0x10) && !(svga->gdcreg[6] & 0x08)) { svga->write_bank = (val & 0xf) * 0x10000; svga->read_bank = ((val >> 4) & 0xf) * 0x10000; } @@ -117,21 +106,12 @@ void et4000_out(uint16_t addr, uint8_t val, void *p) return; if ((svga->crtcreg == 0x35) && (svga->crtc[0x11] & 0x80)) return; - if ((svga->crtcreg > 0x18) && (svga->crtcreg != 0x33) && (svga->crtcreg != 0x35) && !et4000->key) - return; - if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) + if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) val = (svga->crtc[7] & ~0x10) | (val & 0x10); old = svga->crtc[svga->crtcreg]; val &= crtc_mask[svga->crtcreg]; svga->crtc[svga->crtcreg] = val; - if (svga->crtcreg == 0x36) { - if (!(val & 0x10)) { - svga->write_bank = (et4000->banking & 0xf) * 0x10000; - svga->read_bank = ((et4000->banking >> 4) & 0xf) * 0x10000; - } - } - if (old != val) { if (svga->crtcreg < 0xE || svga->crtcreg > 0x10) @@ -185,16 +165,6 @@ void et4000_out(uint16_t addr, uint8_t val, void *p) } } break; - case 0x3D8: - et4000->mcr = val; - if (et4000->hcr == 0x03) { - if ((et4000->mcr & 0xa0) == 0xa0) - et4000->key = 1; - } else { - if ((et4000->mcr & 0xa0) != 0xa0) - et4000->key = 0; - } - break; } svga_out(addr, val, svga); } @@ -409,7 +379,6 @@ void *et4000_isa_init(const device_t *info) rom_init(&et4000->bios_rom, BIOS_ROM_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); - io_sethandler(0x03bf, 0x0001, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000); io_sethandler(0x03c0, 0x0020, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000); svga_init(&et4000->svga, et4000, device_get_config_int("memory") << 10, /*1mb default*/ @@ -430,7 +399,6 @@ void *et4000k_isa_init(const device_t *info) rom_init(&et4000->bios_rom, KOREAN_BIOS_ROM_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); loadfont(KOREAN_FONT_ROM_PATH, 6); - io_sethandler(0x03bf, 0x0001, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000); io_sethandler(0x03c0, 0x0020, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000); io_sethandler(0x22cb, 0x0001, et4000k_in, NULL, NULL, et4000k_out, NULL, NULL, et4000); @@ -492,7 +460,6 @@ void *et4000_mca_init(const device_t *info) NULL); et4000->vram_mask = (1 << 20) - 1; - io_sethandler(0x03bf, 0x0001, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000); io_sethandler(0x03c0, 0x0020, et4000_in, NULL, NULL, et4000_out, NULL, NULL, et4000); return et4000; diff --git a/src/video/vid_et4000w32.c b/src/video/vid_et4000w32.c index 4f2670cbe..fe8882632 100644 --- a/src/video/vid_et4000w32.c +++ b/src/video/vid_et4000w32.c @@ -10,7 +10,7 @@ * * Known bugs: Accelerator doesn't work in planar modes * - * Version: @(#)vid_et4000w32.c 1.0.13 2018/08/24 + * Version: @(#)vid_et4000w32.c 1.0.15 2018/08/25 * * Authors: Sarah Walker, * Miran Grca, @@ -194,34 +194,26 @@ void et4000w32p_out(uint16_t addr, uint8_t val, void *p) switch (addr) { - case 0x3BF: case 0x3DF: - et4000->hcr = val; - return; - - case 0x3c2: - if (val & 1) - io_sethandler(0x03bf, 0x0001, et4000w32p_in, NULL, NULL, et4000w32p_out, NULL, NULL, et4000); - else - io_removehandler(0x03bf, 0x0001, et4000w32p_in, NULL, NULL, et4000w32p_out, NULL, NULL, et4000); #if defined(DEV_BRANCH) && defined(USE_STEALTH32) + case 0x3c2: if (et4000->type == ET4000W32_DIAMOND) icd2061_write(&et4000->icd2061, (val >> 2) & 3); -#endif break; +#endif case 0x3C6: case 0x3C7: case 0x3C8: case 0x3C9: stg_ramdac_out(addr, val, &et4000->ramdac, svga); return; case 0x3CB: /*Banking extension*/ - if (et4000->key && !(svga->crtc[0x36] & 0x10)) { + if (!(svga->crtc[0x36] & 0x10) && !(svga->gdcreg[6] & 0x08)) { svga->write_bank = (svga->write_bank & 0xfffff) | ((val & 1) << 20); svga->read_bank = (svga->read_bank & 0xfffff) | ((val & 0x10) << 16); } et4000->banking2 = val; return; case 0x3CD: /*Banking*/ - if (et4000->key && !(svga->crtc[0x36] & 0x10)) { + if (!(svga->crtc[0x36] & 0x10) && !(svga->gdcreg[6] & 0x08)) { svga->write_bank = (svga->write_bank & 0x100000) | ((val & 0xf) * 65536); svga->read_bank = (svga->read_bank & 0x100000) | (((val >> 4) & 0xf) * 65536); } @@ -244,8 +236,6 @@ void et4000w32p_out(uint16_t addr, uint8_t val, void *p) return; if ((svga->crtcreg == 0x35) && (svga->crtc[0x11] & 0x80)) return; - if ((svga->crtcreg > 0x18) && (svga->crtcreg != 0x33) && (svga->crtcreg != 0x35) && !et4000->key) - return; if ((svga->crtcreg == 7) && (svga->crtc[0x11] & 0x80)) val = (svga->crtc[7] & ~0x10) | (val & 0x10); old = svga->crtc[svga->crtcreg]; @@ -280,16 +270,6 @@ void et4000w32p_out(uint16_t addr, uint8_t val, void *p) if (svga->crtcreg == 0x32 || svga->crtcreg == 0x36) et4000w32p_recalcmapping(et4000); break; - case 0x3D8: - et4000->mcr = val; - if (et4000->hcr == 0x03) { - if ((et4000->mcr & 0xa0) == 0xa0) - et4000->key = 1; - } else { - if ((et4000->mcr & 0xa0) != 0xa0) - et4000->key = 0; - } - break; case 0x210A: case 0x211A: case 0x212A: case 0x213A: case 0x214A: case 0x215A: case 0x216A: case 0x217A: @@ -1142,7 +1122,6 @@ void et4000w32p_hwcursor_draw(svga_t *svga, int displine) static void et4000w32p_io_remove(et4000w32p_t *et4000) { - io_removehandler(0x03bf, 0x0001, et4000w32p_in, NULL, NULL, et4000w32p_out, NULL, NULL, et4000); io_removehandler(0x03c0, 0x0020, et4000w32p_in, NULL, NULL, et4000w32p_out, NULL, NULL, et4000); io_removehandler(0x210A, 0x0002, et4000w32p_in, NULL, NULL, et4000w32p_out, NULL, NULL, et4000); @@ -1159,8 +1138,6 @@ static void et4000w32p_io_set(et4000w32p_t *et4000) { et4000w32p_io_remove(et4000); - if (et4000->svga.miscout & 1) - io_sethandler(0x03bf, 0x0001, et4000w32p_in, NULL, NULL, et4000w32p_out, NULL, NULL, et4000); io_sethandler(0x03c0, 0x0020, et4000w32p_in, NULL, NULL, et4000w32p_out, NULL, NULL, et4000); io_sethandler(0x210A, 0x0002, et4000w32p_in, NULL, NULL, et4000w32p_out, NULL, NULL, et4000);