From e14ad2e6e63efc27380763b9cff6a25c73aa6294 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 7 Apr 2018 20:47:34 +0300 Subject: [PATCH] Minimal Casablanca support, loads ROM, decodes it, inits a bit and then it hangs. --- casablanca.cpp | 60 ++++++++++++++++++++++ cfgfile.cpp | 44 +++++++++++++++- include/casablanca.h | 2 + include/options.h | 2 +- memory.cpp | 7 +++ od-win32/resources/resource.h | 1 + od-win32/resources/winuae.rc | 5 +- od-win32/win32gui.cpp | 31 +++++------ od-win32/winuae_msvc15/winuae_msvc.vcxproj | 1 + rommgr.cpp | 7 ++- 10 files changed, 139 insertions(+), 21 deletions(-) create mode 100644 casablanca.cpp create mode 100644 include/casablanca.h diff --git a/casablanca.cpp b/casablanca.cpp new file mode 100644 index 00000000..a67a329c --- /dev/null +++ b/casablanca.cpp @@ -0,0 +1,60 @@ +#include "sysconfig.h" +#include "sysdeps.h" + +#include "options.h" +#include "uae.h" +#include "memory.h" +#include "newcpu.h" +#include "casablanca.h" + +static uae_u32 REGPARAM2 casa_lget(uaecptr addr) +{ + write_log(_T("casa_lget %08x %08x\n"), addr, M68K_GETPC); + return 0; +} +static uae_u32 REGPARAM2 casa_wget(uaecptr addr) +{ + write_log(_T("casa_wget %08x %08x\n"), addr, M68K_GETPC); + return 0; +} + +static uae_u32 REGPARAM2 casa_bget(uaecptr addr) +{ + uae_u8 v = 0; + write_log(_T("casa_bget %08x %08x\n"), addr, M68K_GETPC); + + if (addr == 0x020007c3) + v = 4; + + return v; +} + +static void REGPARAM2 casa_lput(uaecptr addr, uae_u32 l) +{ + write_log(_T("casa_lput %08x %08x %08x\n"), addr, l, M68K_GETPC); +} +static void REGPARAM2 casa_wput(uaecptr addr, uae_u32 w) +{ + write_log(_T("casa_wput %08x %04x %08x\n"), addr, w & 0xffff, M68K_GETPC); +} + +static void REGPARAM2 casa_bput(uaecptr addr, uae_u32 b) +{ + write_log(_T("casa_bput %08x %02x %08x\n"), addr, b & 0xff, M68K_GETPC); +} + +static addrbank casa_ram_bank = { + casa_lget, casa_wget, casa_bget, + casa_lput, casa_wput, casa_bput, + default_xlate, default_check, NULL, NULL, _T("Casablanca IO"), + dummy_lgeti, dummy_wgeti, ABFLAG_IO | ABFLAG_SAFE, S_READ, S_WRITE, +}; + + +void casablanca_map_overlay(void) +{ + // Casablanca has ROM at address zero, no chip ram, no overlay. + map_banks(&kickmem_bank, 524288 >> 16, 524288 >> 16, 0); + map_banks(&extendedkickmem_bank, 0 >> 16, 524288 >> 16, 0); + map_banks(&casa_ram_bank, 0x02000000 >> 16, 0x01000000 >> 16, 0); +} diff --git a/cfgfile.cpp b/cfgfile.cpp index 47fbb232..c088afcf 100644 --- a/cfgfile.cpp +++ b/cfgfile.cpp @@ -177,7 +177,7 @@ 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"), - _T("Velvet"), + _T("Velvet"), _T("Casablanca"), NULL }; static const TCHAR *qsmodes[] = { @@ -8256,6 +8256,41 @@ static int bip_arcadia (struct uae_prefs *p, int config, int compa, int romcheck return 1; } +static int bip_casablanca(struct uae_prefs *p, int config, int compa, int romcheck) +{ + int roms[8]; + + roms[0] = 231; + roms[1] = -1; + + p->bogomem_size = 0; + p->chipmem_size = 0x200000; + switch (config) + { + default: + case 1: + p->cpu_model = 68040; + p->fpu_model = 68040; + p->mmu_model = 68040; + break; + case 2: + p->cpu_model = 68060; + p->fpu_model = 68060; + p->mmu_model = 68040; + break; + } + p->chipset_mask = CSMASK_AGA | CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; + p->cpu_compatible = p->address_space_24 = 0; + p->m68k_speed = -1; + p->immediate_blits = 0; + p->produce_sound = 2; + p->floppyslots[0].dfxtype = DRV_NONE; + p->floppyslots[1].dfxtype = DRV_NONE; + p->cs_compatible = CP_CASABLANCA; + built_in_chipset_prefs(p); + return configure_rom(p, roms, romcheck); +} + int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck) { int v = 0; @@ -8294,9 +8329,12 @@ int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int r v = bip_cdtv (p, config, compa, romcheck); break; case 10: - v = bip_arcadia (p, config , compa, romcheck); + v = bip_arcadia(p, config, compa, romcheck); break; case 11: + v = bip_casablanca(p, config, compa, romcheck); + break; + case 12: v = bip_super (p, config, compa, romcheck); break; } @@ -8495,6 +8533,8 @@ int built_in_chipset_prefs (struct uae_prefs *p) p->cs_z3autoconfig = true; p->cs_unmapped_space = 1; break; + case CP_CASABLANCA: + break; } if (p->cpu_model >= 68040) p->cs_bytecustomwritebug = true; diff --git a/include/casablanca.h b/include/casablanca.h new file mode 100644 index 00000000..b1b15b17 --- /dev/null +++ b/include/casablanca.h @@ -0,0 +1,2 @@ + +void casablanca_map_overlay(void); diff --git a/include/options.h b/include/options.h index 77fef87d..4a4fd96f 100644 --- a/include/options.h +++ b/include/options.h @@ -239,7 +239,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_VELVET }; + CP_A1200, CP_A2000, CP_A3000, CP_A3000T, CP_A4000, CP_A4000T, CP_VELVET, CP_CASABLANCA }; #define IDE_A600A1200 1 #define IDE_A4000 2 diff --git a/memory.cpp b/memory.cpp index c544eeb4..ceab91cf 100644 --- a/memory.cpp +++ b/memory.cpp @@ -41,6 +41,7 @@ #include "uae/ppc.h" #include "devices.h" #include "inputdevice.h" +#include "casablanca.h" bool canbang; static bool rom_write_enabled; @@ -2375,6 +2376,11 @@ void map_overlay (int chip) int size; addrbank *cb; + if (currprefs.cs_compatible == CP_CASABLANCA) { + casablanca_map_overlay(); + return; + } + size = chipmem_bank.allocated_size >= 0x180000 ? (chipmem_bank.allocated_size >> 16) : 32; if (bogomem_aliasing) size = 8; @@ -3505,3 +3511,4 @@ uaecptr strcpyha_safe (uaecptr dst, const uae_char *src) } while (b); return res; } + diff --git a/od-win32/resources/resource.h b/od-win32/resources/resource.h index d110c827..51aa0df0 100644 --- a/od-win32/resources/resource.h +++ b/od-win32/resources/resource.h @@ -422,6 +422,7 @@ #define IDS_QS_MODEL_A3000 1010 #define IDS_QS_MODEL_A4000 1011 #define IDS_QS_MODEL_A4000T 1012 +#define IDS_QS_MODEL_CASABLANCA 1013 #define IDC_RESOLUTION 1021 #define IDC_SERIAL 1022 #define IDC_REFRESHRATE 1022 diff --git a/od-win32/resources/winuae.rc b/od-win32/resources/winuae.rc index be3d7244..c05d7083 100644 --- a/od-win32/resources/winuae.rc +++ b/od-win32/resources/winuae.rc @@ -2023,7 +2023,7 @@ END STRINGTABLE BEGIN - IDS_QS_MODELS "A500\nA500+\nA600\nA1000\nA1200\nA3000\nA4000\nCD32\nCDTV\nArcadia Multi Select system\nExpanded WinUAE example configuration" + IDS_QS_MODELS "A500\nA500+\nA600\nA1000\nA1200\nA3000\nA4000\nCD32\nCDTV\nArcadia Multi Select system\nMacrosystem Casablanca\nExpanded WinUAE example configuration\n" IDS_QS_MODEL_A500 "1.3 ROM, OCS, 512 KB Chip + 512 KB Slow RAM (most common)\nThis configuration is capable of running most games and demos produced for first-generation hardware. Only few exceptions need a different configuration (e.g. the oldest games tend to be incompatible with this configuration).\n1.3 ROM, ECS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nLater hardware revision of the A500. Nearly 100% compatible with the previous configuration.\n1.3 ROM, ECS Agnus, 1 MB Chip RAM\nFew newer games and demos require this configuration.\n1.3 ROM, OCS Agnus, 512 KB Chip RAM\nVery old (e.g. pre-1988) games and demos may require this configuration.\n1.2 ROM, OCS Agnus, 512 KB Chip RAM\nAs available for the A1000, and installed on the first A500 and A2000 series. Some very old programs only work correctly with this configuration. Note: This system ROM version can only boot from floppy disk (no hard disk boot support).\n1.2 ROM, OCS Agnus, 512 KB Chip RAM + 512 KB Slow RAM\nThis configuration adds expansion memory to the first A500 produced. Try this if your game does not work with newer configurations, but works with the previous one. It could add some features to the game, including faster loading times. Note: This system ROM version can only boot from floppy disk (no hard disk boot support)." IDS_QS_MODEL_A500P "Basic non-expanded configuration\nThe A500+ adds an ECS Agnus chip, 1 MB of Chip RAM and a 2.0 ROM to the A500. Many A500 games and demos don't work properly on an A500+.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n" IDS_QS_MODEL_A600 "Basic non-expanded configuration\nThe A600 is smaller than the A500+ and has an updated 2.0 ROM.\n2 MB Chip RAM expanded configuration\n\n4 MB Fast RAM expanded configuration\n" @@ -2039,7 +2039,8 @@ BEGIN IDS_QS_MODEL_ARCADIA "Arcadia\nArcadia Multi Select system is arcade platform developed by Arcadia and Mastertronic. It is based on an A500 mainboard with ROM cage attached to expansion port. Arcadia ROM files go to ""Cartridge ROM File"" in ROM-panel." IDS_QS_MODEL_A3000 "1.4 ROM, 2MB Chip + 8MB Fast\n\n2.04 ROM, 2MB Chip + 8MB Fast\n\n3.1 ROM, 2MB Chip + 8MB Fast\n" IDS_QS_MODEL_A4000 "68030, 3.1 ROM, 2MB Chip + 8MB Fast\n\n68040, 3.1 ROM, 2MB Chip + 8MB Fast\n\nCyberStorm PPC\n" - IDS_QS_MODEL_A4000T "A4000T (test)\nA4000T" + IDS_QS_MODEL_A4000T "A4000T (test)\nA4000T\n" + IDS_QS_MODEL_CASABLANCA "Macrosystem Casablanca\n" END STRINGTABLE diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index f1198258..69860f03 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -7980,24 +7980,25 @@ static INT_PTR CALLBACK ChipsetDlgProc (HWND hDlg, UINT msg, WPARAM wParam, LPAR pages[CHIPSET_ID] = hDlg; currentpage = CHIPSET_ID; - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_RESETCONTENT, 0, 0); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("Custom")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_RESETCONTENT, 0, 0); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("Custom")); WIN32GUI_LoadUIString(IDS_GENERIC, buffer, sizeof buffer / sizeof (TCHAR)); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)buffer); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("CDTV")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("CDTV-CR")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)buffer); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("CDTV")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("CDTV-CR")); SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("CD32")); SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A500")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A500+")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A600")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A1000")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A1200")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A2000")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A3000")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A3000T")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A4000")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A4000T")); - SendDlgItemMessage (hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("Velvet")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A500+")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A600")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A1000")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A1200")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A2000")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A3000")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A3000T")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A4000")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("A4000T")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("Velvet")); + SendDlgItemMessage(hDlg, IDC_CS_EXT, CB_ADDSTRING, 0, (LPARAM)_T("Casablanca")); SendDlgItemMessage(hDlg, IDC_GENLOCKMODE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hDlg, IDC_GENLOCKMODE, CB_ADDSTRING, 0, (LPARAM)_T("-")); diff --git a/od-win32/winuae_msvc15/winuae_msvc.vcxproj b/od-win32/winuae_msvc15/winuae_msvc.vcxproj index d0a7ee5b..90ef1399 100644 --- a/od-win32/winuae_msvc15/winuae_msvc.vcxproj +++ b/od-win32/winuae_msvc15/winuae_msvc.vcxproj @@ -847,6 +847,7 @@ + diff --git a/rommgr.cpp b/rommgr.cpp index f6200134..4e6e4e48 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -95,7 +95,7 @@ struct romdata *getromdatabypath (const TCHAR *path) return NULL; } -#define NEXT_ROM_ID 231 +#define NEXT_ROM_ID 232 #define ALTROM(id,grp,num,size,flags,crc32,a,b,c,d,e) \ { _T("X"), 0, 0, 0, 0, 0, size, id, 0, 0, flags, (grp << 16) | num, 0, NULL, crc32, a, b, c, d, e }, @@ -190,6 +190,11 @@ static struct romdata roms[] = { { _T("KS ROM v3.X (A4000)(Cloanto)"), 3, 10, 45, 57, _T("A4000\0"), 524288, 46, 2 | 4, 1, ROMTYPE_KICK, 0, 0, NULL, 0x3ac99edc, 0x3cbfc9e1,0xfe396360,0x157bd161,0xde74fc90,0x1abee7ec }, + { _T("Casablanca 74095 - 00 717 - 02"), 3, 1, 0, 0, _T("CASABLANCA\0"), 524288 * 2, 231, 2 | 4, 0, ROMTYPE_KICK, 0, 0, NULL, + 0x2ec384e3,0x47f9ee6d, 0x0f8ac5a6,0x5c6eddc3,0x0bcd47c8,0x574d8725 }, + ALTROMPN(231, 1, 1, 524288, ROMTYPE_EVEN, _T("74095 00 717 02 01 U4"), 0x1bdcd18c, 0xabc7b734,0x1f8df24d,0xd4f1d062,0xfc0f7680,0x4d1053b9) + ALTROMPN(231, 1, 2, 524288, ROMTYPE_ODD , _T("74095 00 717 02 02 U5"), 0x6ccb0431, 0xa2a43444,0xbeda38be,0x1fa5cabe,0x75fc4def,0x063bcd7a) + { _T("CD32 KS ROM v3.1"), 3, 1, 40, 60, _T("CD32\0"), 524288, 18, 1, 0, ROMTYPE_KICKCD32, 0, 0, NULL, 0x1e62d4a5, 0x3525BE88,0x87F79B59,0x29E017B4,0x2380A79E,0xDFEE542D }, { _T("CD32 extended ROM"), 3, 1, 40, 60, _T("CD32\0"), 524288, 19, 1, 0, ROMTYPE_EXTCD32, 0, 0, NULL, -- 2.47.3