From: Toni Wilen Date: Mon, 4 Dec 2017 18:09:47 +0000 (+0200) Subject: 91078-01 CIA bug emulation. X-Git-Tag: 3600~47 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=4abdefed59342c8204b3422e9adad3b4f563ab53;p=francis%2Fwinuae.git 91078-01 CIA bug emulation. --- diff --git a/cfgfile.cpp b/cfgfile.cpp index 6eca0601..84836d2c 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -242,6 +242,7 @@ static const TCHAR *lacer[] = { _T("off"), _T("i"), _T("p"), 0 }; /* another boolean to choice update.. */ static const TCHAR *cycleexact[] = { _T("false"), _T("memory"), _T("true"), 0 }; static const TCHAR *unmapped[] = { _T("floating"), _T("zero"), _T("one"), 0 }; +static const TCHAR *ciatype[] = { _T("default"), _T("391078-01"), 0 }; struct hdcontrollerconfig { @@ -2160,6 +2161,8 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type) cfgfile_dwrite_bool(f, _T("color_burst"), p->cs_color_burst); cfgfile_dwrite_bool(f, _T("toshiba_gary"), p->cs_toshibagary); cfgfile_dwrite_bool(f, _T("rom_is_slow"), p->cs_romisslow); + cfgfile_dwrite_str(f, _T("ciaa_type"), ciatype[p->cs_ciatype[0]]); + cfgfile_dwrite_str(f, _T("ciab_type"), ciatype[p->cs_ciatype[1]]); cfgfile_dwrite_str(f, _T("unmapped_address_space"), unmapped[p->cs_unmapped_space]); cfgfile_dwrite (f, _T("chipset_hacks"), _T("0x%x"), p->cs_hacks); @@ -5134,6 +5137,8 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH || cfgfile_strval(option, value, _T("boot_rom_uae"), &p->boot_rom, uaebootrom, 0) || cfgfile_strval (option, value, _T("serial_translate"), &p->serial_crlf, serialcrlf, 0) || cfgfile_strval(option, value, _T("unmapped_address_space"), &p->cs_unmapped_space, unmapped, 0) + || cfgfile_strval(option, value, _T("ciaa_type"), &p->cs_ciatype[0], ciatype, 0) + || cfgfile_strval(option, value, _T("ciab_type"), &p->cs_ciatype[1], ciatype, 0) || cfgfile_strboolval (option, value, _T("comp_flushmode"), &p->comp_hardflush, flushmode, 0)) return 1; @@ -7281,6 +7286,8 @@ void default_prefs (struct uae_prefs *p, bool reset, int type) p->cs_ciatodbug = false; p->cs_unmapped_space = 0; p->cs_color_burst = false; + p->cs_ciatype[0] = 0; + p->cs_ciatype[1] = 0; for (int i = APMODE_NATIVE; i <= APMODE_RTG; i++) { struct gfx_filterdata *f = &p->gf[i]; diff --git a/cia.cpp b/cia.cpp index f34a7023..3762381f 100644 --- a/cia.cpp +++ b/cia.cpp @@ -1047,6 +1047,13 @@ static uae_u8 ReadCIAA (unsigned int addr, uae_u32 *flags) v |= (ciaapra | (ciaadra ^ 3)) & 0x03; v = dongle_cia_read (0, reg, ciaadra, v); v = alg_joystick_buttons(ciaapra, ciaadra, v); + + // 391078-01 CIA: output mode bits always return PRA contents + if (currprefs.cs_ciatype[0]) { + v &= ~ciaadra; + v |= ciaapra & ciaadra; + } + #if DONGLE_DEBUG > 0 if (notinrom()) write_log (_T("BFE001 R %02X %s\n"), v, debuginfo(0)); @@ -1104,6 +1111,12 @@ static uae_u8 ReadCIAA (unsigned int addr, uae_u32 *flags) tmp &= ~0x40; tmp |= pb6 ? 0x40 : 00; } + + if (currprefs.cs_ciatype[0]) { + tmp &= ~ciaadrb; + tmp |= ciaaprb & ciaadrb; + } + return tmp; case 2: #if DONGLE_DEBUG > 0 @@ -1229,6 +1242,12 @@ static uae_u8 ReadCIAB (unsigned int addr, uae_u32 *flags) if (notinrom ()) write_log (_T("BFD000 R %02X %s\n"), tmp, debuginfo(0)); #endif + + if (currprefs.cs_ciatype[1]) { + tmp &= ~ciabdra; + tmp |= ciabpra & ciabdra; + } + return tmp; case 1: #if DONGLE_DEBUG > 0 @@ -1252,6 +1271,12 @@ static uae_u8 ReadCIAB (unsigned int addr, uae_u32 *flags) tmp &= ~0x40; tmp |= pb6 ? 0x40 : 00; } + + if (currprefs.cs_ciatype[1]) { + tmp &= ~ciabdrb; + tmp |= ciabprb & ciabdrb; + } + return tmp; case 2: return ciabdra; diff --git a/include/options.h b/include/options.h index 0ce9199b..8de8fd15 100644 --- a/include/options.h +++ b/include/options.h @@ -616,6 +616,7 @@ struct uae_prefs { bool cs_toshibagary; int cs_unmapped_space; int cs_hacks; + int cs_ciatype[2]; struct boardromconfig expansionboard[MAX_EXPANSION_BOARDS];