]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
91078-01 CIA bug emulation.
authorToni Wilen <twilen@winuae.net>
Mon, 4 Dec 2017 18:09:47 +0000 (20:09 +0200)
committerToni Wilen <twilen@winuae.net>
Mon, 4 Dec 2017 18:09:47 +0000 (20:09 +0200)
cfgfile.cpp
cia.cpp
include/options.h

index 6eca06015e3ab8cfca3d9e743ad7d25900c7ea76..84836d2c43f2189cef1196b28ecd2264f8e0e483 100644 (file)
@@ -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 f34a7023519624c075a6564fb3eb0e2091fa31da..3762381f2ca3fd6997785bb94f8c0ac3d4917fe3 100644 (file)
--- 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;
index 0ce9199bf140b26bed60706d973daf775857efe3..8de8fd15138a374fe15605638231f3ba34101563 100644 (file)
@@ -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];