From 5a67079ead91407cbad634f543ccf046e5f93d99 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Fri, 27 Feb 2015 18:16:30 +0200 Subject: [PATCH] Preliminary prototype A1000 support. --- cfgfile.cpp | 28 +++++++- cia.cpp | 162 ++++++++++++++++++++++++++++++++++++---------- include/memory.h | 1 + include/options.h | 3 +- 4 files changed, 158 insertions(+), 36 deletions(-) diff --git a/cfgfile.cpp b/cfgfile.cpp index 77ee0d2b..a7618f9b 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -166,7 +166,9 @@ static const TCHAR *ciaatodmode[] = { _T("vblank"), _T("50hz"), _T("60hz"), 0 }; static const TCHAR *ksmirrortype[] = { _T("none"), _T("e0"), _T("a8+e0"), 0 }; static const TCHAR *cscompa[] = { _T("-"), _T("Generic"), _T("CDTV"), _T("CDTV-CR"), _T("CD32"), _T("A500"), _T("A500+"), _T("A600"), - _T("A1000"), _T("A1200"), _T("A2000"), _T("A3000"), _T("A3000T"), _T("A4000"), _T("A4000T"), 0 + _T("A1000"), _T("A1200"), _T("A2000"), _T("A3000"), _T("A3000T"), _T("A4000"), _T("A4000T"), + _T("Velvet"), + NULL }; static const TCHAR *qsmodes[] = { _T("A500"), _T("A500+"), _T("A600"), _T("A1000"), _T("A1200"), _T("A3000"), _T("A4000"), _T(""), _T("CD32"), _T("CDTV"), _T("CDTV-CR"), _T("ARCADIA"), NULL }; @@ -6224,6 +6226,28 @@ static int bip_a4000t (struct uae_prefs *p, int config, int compa, int romcheck) return configure_rom (p, roms, romcheck); } +static int bip_velvet(struct uae_prefs *p, int config, int compa, int romcheck) +{ + int roms[2]; + + roms[0] = 125; + roms[1] = -1; + p->chipset_mask = 0; + p->bogomem_size = 0; + p->sound_filter = FILTER_SOUND_ON; + set_68000_compa (p, compa); + p->floppyslots[1].dfxtype = DRV_NONE; + p->cs_compatible = CP_VELVET; + p->cs_slowmemisfast = 1; + p->cs_dipagnus = 1; + p->cs_agnusbltbusybug = 1; + built_in_chipset_prefs (p); + p->cs_denisenoehb = 1; + p->cs_cia6526 = 1; + p->chipmem_size = 0x40000; + return configure_rom (p, roms, romcheck); +} + static int bip_a1000 (struct uae_prefs *p, int config, int compa, int romcheck) { int roms[2]; @@ -6244,6 +6268,8 @@ static int bip_a1000 (struct uae_prefs *p, int config, int compa, int romcheck) p->cs_denisenoehb = 1; if (config > 1) p->chipmem_size = 0x40000; + if (config > 2) + bip_velvet(p, config, compa, romcheck); return configure_rom (p, roms, romcheck); } diff --git a/cia.cpp b/cia.cpp index f1a71373..a73f7b9e 100644 --- a/cia.cpp +++ b/cia.cpp @@ -946,6 +946,35 @@ static void bfe001_change (void) } } +static uae_u32 getciatod(uae_u32 tod) +{ + if (!currprefs.cs_cia6526) + return tod; + uae_u32 bcdtod = 0; + for (int i = 0; i < 4; i++) { + int val = tod % 10; + bcdtod *= 16; + bcdtod += val; + tod /= 10; + } + return bcdtod; +} +static void setciatod(unsigned long *tod, uae_u32 v) +{ + if (!currprefs.cs_cia6526) { + *tod = v; + return; + } + uae_u32 bintod = 0; + for (int i = 0; i < 4; i++) { + int val = v / 16; + bintod *= 10; + bintod += val; + v /= 16; + } + *tod = bintod; +} + static uae_u8 ReadCIAA (unsigned int addr) { unsigned int tmp; @@ -1045,22 +1074,44 @@ static uae_u8 ReadCIAA (unsigned int addr) case 8: if (ciaatlatch) { ciaatlatch = 0; - return (uae_u8)ciaatol; + return getciatod(ciaatol); } else - return (uae_u8)ciaatod; + return getciatod(ciaatod); case 9: if (ciaatlatch) - return (uae_u8)(ciaatol >> 8); + return getciatod(ciaatol) >> 8; else - return (uae_u8)(ciaatod >> 8); + return getciatod(ciaatod) >> 8; case 10: - if (!ciaatlatch) { /* only if not already latched. A1200 confirmed. (TW) */ - /* no latching if ALARM is set */ - if (!(ciaacrb & 0x80)) - ciaatlatch = 1; - ciaatol = ciaatod; + /* only if not already latched. A1200 confirmed. (TW) */ + if (!currprefs.cs_cia6526) { + if (!ciaatlatch) { + /* no latching if ALARM is set */ + if (!(ciaacrb & 0x80)) + ciaatlatch = 1; + ciaatol = ciaatod; + } + return getciatod(ciaatol) >> 16; + } else { + if (ciaatlatch) + return getciatod(ciaatol) >> 16; + else + return getciatod(ciaatod) >> 16; + } + break; + case 11: + if (currprefs.cs_cia6526) { + if (!ciaatlatch) { + if (!(ciaacrb & 0x80)) + ciaatlatch = 1; + ciaatol = ciaatod; + } + if (ciaatlatch) + return getciatod(ciaatol) >> 24; + else + return getciatod(ciaatod) >> 24; } - return (uae_u8)(ciaatol >> 16); + break; case 12: #if KB_DEBUG write_log (_T("CIAA serial port: %02x %08x\n"), ciaasdr, M68K_GETPC); @@ -1164,24 +1215,44 @@ static uae_u8 ReadCIAB (unsigned int addr) CIAB_tod_check (); if (ciabtlatch) { ciabtlatch = 0; - return (uae_u8)ciabtol; + return getciatod(ciabtol); } else - return (uae_u8)ciabtod; + return getciatod(ciabtod); case 9: CIAB_tod_check (); if (ciabtlatch) - return (uae_u8)(ciabtol >> 8); + return getciatod(ciabtol) >> 8; else - return (uae_u8)(ciabtod >> 8); + return getciatod(ciabtod) >> 8; case 10: CIAB_tod_check (); - if (!ciabtlatch) { - /* no latching if ALARM is set */ - if (!(ciabcrb & 0x80)) - ciabtlatch = 1; - ciabtol = ciabtod; + if (!currprefs.cs_cia6526) { + if (!ciabtlatch) { + /* no latching if ALARM is set */ + if (!(ciabcrb & 0x80)) + ciabtlatch = 1; + ciabtol = ciabtod; + } + return getciatod(ciabtol) >> 16; + } else { + if (ciabtlatch) + return getciatod(ciabtol) >> 16; + else + return getciatod(ciabtod) >> 16; + } + case 11: + if (currprefs.cs_cia6526) { + if (!ciabtlatch) { + if (!(ciabcrb & 0x80)) + ciabtlatch = 1; + ciabtol = ciabtod; + } + if (ciabtlatch) + return getciatod(ciabtol) >> 24; + else + return getciatod(ciabtod) >> 24; } - return (uae_u8)(ciabtol >> 16); + break; case 12: return ciabsdr; case 13: @@ -1308,26 +1379,37 @@ static void WriteCIAA (uae_u16 addr, uae_u8 val) break; case 8: if (ciaacrb & 0x80) { - ciaaalarm = (ciaaalarm & ~0xff) | val; + setciatod(&ciaaalarm , (getciatod(ciaaalarm) & ~0xff) | val); } else { - ciaatod = (ciaatod & ~0xff) | val; + setciatod(&ciaatod, (getciatod(ciaatod) & ~0xff) | val); ciaatodon = 1; ciaa_checkalarm (false); } break; case 9: if (ciaacrb & 0x80) { - ciaaalarm = (ciaaalarm & ~0xff00) | (val << 8); + setciatod(&ciaaalarm, (getciatod(ciaaalarm) & ~0xff00) | (val << 8)); } else { - ciaatod = (ciaatod & ~0xff00) | (val << 8); + setciatod(&ciaatod, (getciatod(ciaatod) & ~0xff00) | (val << 8)); } break; case 10: if (ciaacrb & 0x80) { - ciaaalarm = (ciaaalarm & ~0xff0000) | (val << 16); + setciatod(&ciaaalarm, (getciatod(ciaaalarm) & ~0xff0000) | (val << 16)); } else { - ciaatod = (ciaatod & ~0xff0000) | (val << 16); - ciaatodon = 0; + setciatod(&ciaatod, (getciatod(ciaatod) & ~0xff0000) | (val << 16)); + if (!currprefs.cs_cia6526) + ciaatodon = 0; + } + break; + case 11: + if (currprefs.cs_cia6526) { + if (ciaacrb & 0x80) { + setciatod(&ciaaalarm, (getciatod(ciaaalarm) & ~0xff000000) | (val << 24)); + } else { + setciatod(&ciaatod, (getciatod(ciaatod) & ~0xff000000) | (val << 24)); + ciaatodon = 0; + } } break; case 12: @@ -1476,9 +1558,9 @@ static void WriteCIAB (uae_u16 addr, uae_u8 val) case 8: CIAB_tod_check (); if (ciabcrb & 0x80) { - ciabalarm = (ciabalarm & ~0xff) | val; + setciatod(&ciabalarm, (getciatod(ciabalarm) & ~0xff) | val); } else { - ciabtod = (ciabtod & ~0xff) | val; + setciatod(&ciabtod, (getciatod(ciabtod) & ~0xff) | val); ciabtodon = 1; ciab_checkalarm (false, true); } @@ -1486,18 +1568,30 @@ static void WriteCIAB (uae_u16 addr, uae_u8 val) case 9: CIAB_tod_check (); if (ciabcrb & 0x80) { - ciabalarm = (ciabalarm & ~0xff00) | (val << 8); + setciatod(&ciabalarm, (getciatod(ciabalarm) & ~0xff00) | (val << 8)); } else { - ciabtod = (ciabtod & ~0xff00) | (val << 8); + setciatod(&ciabtod, (getciatod(ciabtod) & ~0xff00) | (val << 8)); } break; case 10: CIAB_tod_check (); if (ciabcrb & 0x80) { - ciabalarm = (ciabalarm & ~0xff0000) | (val << 16); + setciatod(&ciabalarm, (getciatod(ciabalarm) & ~0xff0000) | (val << 16)); } else { - ciabtod = (ciabtod & ~0xff0000) | (val << 16); - ciabtodon = 0; + setciatod(&ciabtod, (getciatod(ciabtod) & ~0xff0000) | (val << 16)); + if (!currprefs.cs_cia6526) + ciabtodon = 0; + } + break; + case 11: + if (currprefs.cs_cia6526) { + CIAB_tod_check (); + if (ciabcrb & 0x80) { + setciatod(&ciabalarm, (getciatod(ciabalarm) & ~0xff000000) | (val << 24)); + } else { + setciatod(&ciabtod, (getciatod(ciabtod) & ~0xff000000) | (val << 24)); + ciabtodon = 0; + } } break; case 12: diff --git a/include/memory.h b/include/memory.h index 44c12785..c9162fd9 100644 --- a/include/memory.h +++ b/include/memory.h @@ -62,6 +62,7 @@ extern void wait_cpu_cycle_write_ce020 (uaecptr addr, int mode, uae_u32 v); #define ROM_SIZE_512 524288 #define ROM_SIZE_256 262144 +#define ROM_SIZE_128 131072 extern bool ersatzkickfile; extern bool cloanto_rom, kickstart_rom; diff --git a/include/options.h b/include/options.h index c9240287..5d172e0e 100644 --- a/include/options.h +++ b/include/options.h @@ -182,7 +182,7 @@ struct uaedev_config_data }; enum { CP_GENERIC = 1, CP_CDTV, CP_CDTVCR, CP_CD32, CP_A500, CP_A500P, CP_A600, CP_A1000, - CP_A1200, CP_A2000, CP_A3000, CP_A3000T, CP_A4000, CP_A4000T }; + CP_A1200, CP_A2000, CP_A3000, CP_A3000T, CP_A4000, CP_A4000T, CP_VELVET }; #define IDE_A600A1200 1 #define IDE_A4000 2 @@ -485,6 +485,7 @@ struct uae_prefs { bool cs_ciatodbug; bool cs_z3autoconfig; bool cs_1mchipjumper; + bool cs_cia6526; int cs_hacks; struct boardromconfig expansionboard[MAX_EXPANSION_BOARDS]; -- 2.47.3