From 5b43787f45ae59d1e3f384769a5e7912c2f66603 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sun, 24 Apr 2022 22:16:07 +0300 Subject: [PATCH] CSMK1 update + SCSI module separation. --- cpuboard.cpp | 88 ++++++++++++++++++++++---------------------- expansion.cpp | 15 ++++++-- include/autoconf.h | 3 +- include/ncr9x_scsi.h | 1 - include/rommgr.h | 1 + rommgr.cpp | 8 ++-- 6 files changed, 62 insertions(+), 54 deletions(-) diff --git a/cpuboard.cpp b/cpuboard.cpp index 2575c522..f1e6fabc 100644 --- a/cpuboard.cpp +++ b/cpuboard.cpp @@ -670,10 +670,6 @@ static uae_u32 REGPARAM2 blizzardf0_bget(uaecptr addr) addr &= 65535; addr += 65536; return flash_read(flashrom, addr); - } else if (is_csmk1(&currprefs)) { - addr &= 65535; - addr += 65536; - return flash_read(flashrom, addr); } else if (is_dkb_wildfire(&currprefs)) { if (flash_unlocked) { if (addr & 1) @@ -728,10 +724,6 @@ static void REGPARAM2 blizzardf0_bput(uaecptr addr, uae_u32 b) addr &= ~3; addr |= csmk2_flashaddressing; flash_write(flashrom, addr, b); - } else if (is_csmk1(&currprefs)) { - addr &= 65535; - addr += 65536; - flash_write(flashrom, addr, b); } else if (is_dkb_wildfire(&currprefs)) { if (flash_unlocked) { if (addr & 1) @@ -803,13 +795,10 @@ static uae_u32 REGPARAM2 blizzardea_bget(uaecptr addr) else v = blizzardea_bank.baseaddr[addr]; } else if (is_csmk1(&currprefs)) { - if (addr >= CYBERSTORM_MK1_SCSI_OFFSET) { + if (addr >= CYBERSTORM_MK1_SCSI_OFFSET) v = cpuboard_ncr9x_scsi_get(addr); - } else if (flash_active(flashrom, addr)) { - v = flash_read(flashrom, addr); - } else { + else v = blizzardea_bank.baseaddr[addr]; - } } else if (is_csmk2(&currprefs)) { if (addr >= CYBERSTORM_MK2_SCSI_OFFSET) { v = cpuboard_ncr9x_scsi_get(addr); @@ -860,8 +849,6 @@ static void REGPARAM2 blizzardea_bput(uaecptr addr, uae_u32 b) } else if (is_csmk1(&currprefs)) { if (addr >= CYBERSTORM_MK1_SCSI_OFFSET) { cpuboard_ncr9x_scsi_put(addr, b); - } else { - flash_write(flashrom, addr, b); } } else if (is_csmk2(&currprefs)) { if (addr >= CYBERSTORM_MK2_SCSI_OFFSET) { @@ -2092,8 +2079,8 @@ static void cpuboard_init_2(void) blizzardf0_bank.mask = blizzardf0_bank.reserved_size - 1; mapped_malloc(&blizzardf0_bank); - blizzardea_bank.reserved_size = 2 * 65536; - blizzardea_bank.mask = 65535 - 1; + blizzardea_bank.reserved_size = 65536; + blizzardea_bank.mask = blizzardea_bank.reserved_size - 1; mapped_malloc(&blizzardea_bank); blizzardmaprom_bank.reserved_size = 524288; @@ -2496,6 +2483,7 @@ bool cpuboard_autoconfig_init(struct autoconfig_info *aci) struct boardromconfig *brc; bool autoconf = true; bool autoconf_stop = false; + bool autoconfig_nomandatory = false; const TCHAR *defaultromname = NULL; const TCHAR *romname = NULL; bool isflashrom = false; @@ -2503,7 +2491,6 @@ bool cpuboard_autoconfig_init(struct autoconfig_info *aci) const TCHAR *boardname; struct uae_prefs *p = aci->prefs; uae_u32 romtype = 0, romtype2 = 0; - bool cpucheck = false; boardname = cpuboards[p->cpuboard_type].subtypes[p->cpuboard_subtype].name; aci->label = boardname; @@ -2651,8 +2638,8 @@ bool cpuboard_autoconfig_init(struct autoconfig_info *aci) { case BOARD_CYBERSTORM_SUB_MK1: romtype = ROMTYPE_CB_CSMK1; - cpucheck = true; - isflashrom = true; + romtype2 = ROMTYPE_CSMK1SCSI; + autoconfig_nomandatory = true; break; case BOARD_CYBERSTORM_SUB_MK2: romtype = ROMTYPE_CB_CSMK2; @@ -2692,7 +2679,6 @@ bool cpuboard_autoconfig_init(struct autoconfig_info *aci) break; case BOARD_BLIZZARD_SUB_PPC: romtype = ROMTYPE_CB_BLIZPPC; - cpucheck = true; isflashrom = true; break; } @@ -2772,18 +2758,20 @@ bool cpuboard_autoconfig_init(struct autoconfig_info *aci) } } - if (!autoconfig_rom && romtype) { - if (aci->doinit) - romwarning(romtype); - write_log (_T("ROM id %08X not found for CPUBoard '%s' emulation\n"), romtype, boardname); - return false; - } - if (!autoconfig_rom) { - write_log(_T("Couldn't open CPUBoard '%s' rom '%s'\n"), boardname, defaultromname); - return false; - } + if (!autoconfig_nomandatory) { + if (!autoconfig_rom && romtype) { + if (aci->doinit) + romwarning(romtype); + write_log(_T("ROM id %08X not found for CPUBoard '%s' emulation\n"), romtype, boardname); + return false; + } + if (!autoconfig_rom) { + write_log(_T("Couldn't open CPUBoard '%s' rom '%s'\n"), boardname, defaultromname); + return false; + } - write_log(_T("CPUBoard '%s' ROM '%s' %lld loaded\n"), boardname, zfile_getname(autoconfig_rom), zfile_size(autoconfig_rom)); + write_log(_T("CPUBoard '%s' ROM '%s' %lld loaded\n"), boardname, zfile_getname(autoconfig_rom), zfile_size(autoconfig_rom)); + } uae_u8 *blizzardea_tmp = blizzardea_bank.baseaddr; uae_u8 *blizzardf0_tmp = blizzardf0_bank.baseaddr; @@ -2901,25 +2889,35 @@ bool cpuboard_autoconfig_init(struct autoconfig_info *aci) blizzardea_bank.baseaddr[i * 2 + 0] = b; } } else if (is_csmk1(p)) { - earom_size = 131072; // really 64k but ea and f0 use same space + earom_size = 65536; f0rom_size = 65536; - for (int i = 0; i < 32768; i++) { - uae_u8 b = 0xff; - zfile_fread(&b, 1, 1, autoconfig_rom); - blizzardea_bank.baseaddr[i * 2 + 0] = b; - blizzardea_bank.baseaddr[i * 2 + 1] = 0xff; - } - zfile_fread(blizzardea_bank.baseaddr + 65536, 65536, 1, autoconfig_rom); - if (zfile_needwrite(autoconfig_rom)) { - flashrom_file = autoconfig_rom; + aci->start = 0xf00000; + aci->size = f0rom_size; + if (autoconfig_rom) { + zfile_fread(blizzardf0_bank.baseaddr, 1, f0rom_size, autoconfig_rom); + zfile_fclose(autoconfig_rom); autoconfig_rom = NULL; } - flashrom = flash_new(blizzardea_bank.baseaddr, earom_size, earom_size, 0x01, 0x20, flashrom_file, 0); - memcpy(blizzardf0_bank.baseaddr, blizzardea_bank.baseaddr + 65536, 65536); + if (romtype2) { + int idx2; + struct boardromconfig *brc2 = get_device_rom(p, romtype2, 0, &idx2); + if (brc2 && brc2->roms[idx2].romfile[0]) + autoconfig_rom = board_rom_open(romtype2, brc2->roms[idx2].romfile); + if (autoconfig_rom) { + memset(blizzardea_bank.baseaddr, 0xff, 65536); + for (int i = 0; i < 32768; i++) { + uae_u8 b = 0xff; + zfile_fread(&b, 1, 1, autoconfig_rom); + blizzardea_bank.baseaddr[i * 2 + 0] = b; + } + } + } else { + autoconf = false; + } } else if (is_csmk2(p)) { earom_size = 131072; f0rom_size = 65536; - zfile_fread(blizzardea_bank.baseaddr, earom_size, 1, autoconfig_rom); + zfile_fread(blizzardea_bank.baseaddr, 1,earom_size, autoconfig_rom); if (zfile_needwrite(autoconfig_rom)) { flashrom_file = autoconfig_rom; autoconfig_rom = NULL; diff --git a/expansion.cpp b/expansion.cpp index 1356d01f..0d2aeaaf 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -5251,6 +5251,12 @@ const struct expansionromtype expansionroms[] = { NULL, 0, false, EXPANSIONTYPE_SCSI }, + { + _T("csmk1cyberscsi"), _T("CyberSCSI module"), _T("Phase 5"), + NULL, NULL, NULL, cpuboard_ncr9x_add_scsi_unit, ROMTYPE_CSMK1SCSI, 0, 0, 0, true, + NULL, 0, + false, EXPANSIONTYPE_SCSI + }, { _T("accessx"), _T("AccessX"), _T("Breitfeld Computersysteme"), NULL, accessx_init, NULL, accessx_add_ide_unit, ROMTYPE_ACCESSX, 0, 0, BOARD_AUTOCONFIG_Z2, false, @@ -6350,10 +6356,13 @@ static const struct cpuboardsubtype cyberstormboard_sub[] = { { _T("CyberStorm MK I"), _T("CyberStormMK1"), - ROMTYPE_CB_CSMK1, 0, 4, - cpuboard_ncr9x_add_scsi_unit, EXPANSIONTYPE_SCSI, + ROMTYPE_CB_CSMK1 | ROMTYPE_NONE, 0, 4, + NULL, 0, BOARD_MEMORY_HIGHMEM, - 128 * 1024 * 1024 + 128 * 1024 * 1024, + 0, + NULL, NULL, 0, 0, + NULL }, { _T("CyberStorm MK II"), diff --git a/include/autoconf.h b/include/autoconf.h index d62d48b6..de95e087 100644 --- a/include/autoconf.h +++ b/include/autoconf.h @@ -247,7 +247,8 @@ struct cpuboardsubtype { const TCHAR *name; const TCHAR *configname; - int romtype, romtype_extra; + uae_u32 romtype; + int romtype_extra; int cputype; DEVICE_ADD add; int deviceflags; diff --git a/include/ncr9x_scsi.h b/include/ncr9x_scsi.h index 8984f4d5..7a56e577 100644 --- a/include/ncr9x_scsi.h +++ b/include/ncr9x_scsi.h @@ -56,7 +56,6 @@ void pcmcia_interrupt_set(int); #define BLIZZARD_SCSI_KIT4_SCSI_OFFSET 0x8000 #define BLIZZARD_SCSI_KIT4_DMA_OFFSET 0x10000 - #define BLIZZARD_SCSI_KIT3_SCSI_OFFSET 0x10000 #define CYBERSTORM_MK2_SCSI_OFFSET 0x1ff03 diff --git a/include/rommgr.h b/include/rommgr.h index a3182943..e46682a9 100644 --- a/include/rommgr.h +++ b/include/rommgr.h @@ -202,6 +202,7 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size); #define ROMTYPE_VOODOO5 0x0010008a #define ROMTYPE_HD20A 0x0010008b #define ROMTYPE_DEVHD 0x0010008c +#define ROMTYPE_CSMK1SCSI 0x0010008d #define ROMTYPE_NOT 0x00800000 #define ROMTYPE_QUAD 0x01000000 diff --git a/rommgr.cpp b/rommgr.cpp index de10658b..f4671cf0 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -657,10 +657,10 @@ static struct romdata roms[] = { { _T("Combitec HD20A/HD40A"), 0, 0, 0, 0, _T("HD20A\0"), 32768, 267, 0, 0, ROMTYPE_HD20A, 0, 0, NULL, 0x0e7391b4, 0x7c365adb,0x3496c479,0x5e94a166,0xd834254a,0x6112d91c, NULL, NULL }, - { _T("CyberStorm MK I 68040"), 0, 0, 0, 0, _T("CSMKI\0"), 32768, 95, 0, 0, ROMTYPE_CB_CSMK1, 0, 0, NULL, - 0, 0, 0, 0, 0, 0, NULL, _T("cyberstormmk1_040.rom") }, - { _T("CyberStorm MK I 68060"), 0, 0, 0, 0, _T("CSMKI\0"), 65536, 101, 0, 0, ROMTYPE_CB_CSMK1, 0, 0, NULL, - 0, 0, 0, 0, 0, 0, NULL, _T("cyberstormmk1_060.rom") }, + { _T("CyberStorm MK I 68060 Support"), 0, 0, 0, 0, _T("CSMKI\0"), 32768, 95, 0, 0, ROMTYPE_CB_CSMK1, 0, 0, NULL, + 0x33a8ff3a, 0x8f4bdda0,0x10338a48,0x51e4a2fb,0xb4aa6d6e,0x202fe98e, NULL, NULL }, + { _T("CyberStorm MK I CyberSCSI Module"), 0, 0, 0, 0, _T("CSMKISCSI\0"), 32768, 101, 0, 0, ROMTYPE_CSMK1SCSI, 0, 0, NULL, + 0x4e71ec63, 0x8e95bc8d,0xa06050fc,0xb596b5b4,0xc8cf9102,0x1ff4aeb3, NULL, NULL }, { _T("CyberStorm MK II"), 0, 0, 0, 0, _T("CSMKII\0"), 131072, 96, 0, 0, ROMTYPE_CB_CSMK2, 0, 0, NULL, 0, 0, 0, 0, 0, 0, NULL, _T("cyberstormmk2.rom") }, { _T("CyberStorm MK III"), 0, 0, 0, 0, _T("CSMKIII\0"), 131072, 97, 0, 0, ROMTYPE_CB_CSMK3, 0, 0, NULL, -- 2.47.3