From 33b0b89e8aaf1823bc8b089207991c0c9bf51686 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Sat, 16 Dec 2017 20:29:55 +0200 Subject: [PATCH] Evesham Micros Reference SCSI controller. --- expansion.cpp | 18 ++++++++++++++++ include/rommgr.h | 1 + include/scsi.h | 3 +++ rommgr.cpp | 4 +++- scsi.cpp | 55 +++++++++++++++++++++++++++++++++++++++++++++--- 5 files changed, 77 insertions(+), 4 deletions(-) diff --git a/expansion.cpp b/expansion.cpp index abaf4b9e..de2c0c26 100644 --- a/expansion.cpp +++ b/expansion.cpp @@ -1553,6 +1553,7 @@ static bool fastmem_autoconfig(struct uae_prefs *p, struct autoconfig_info *aci, struct romconfig *dmc_rc = NULL; uae_u8 ac[16] = { 0 }; int boardnum = aci->devnum; + bool canforceac = false; if (aci->cst) { mid = aci->cst->memory_mid; @@ -1571,6 +1572,7 @@ static bool fastmem_autoconfig(struct uae_prefs *p, struct autoconfig_info *aci, type |= chainedconfig; } } else { + canforceac = true; if (ert->memory_mid) { mid = ert->memory_mid; pid = ert->memory_pid; @@ -1616,6 +1618,15 @@ static bool fastmem_autoconfig(struct uae_prefs *p, struct autoconfig_info *aci, } flags |= care_addr | force_z3 | (allocated > 0x800000 ? ext_size : subsize); } + } else if (canforceac) { + if (zorro <= 2) { + rb = &p->fastmem[boardnum]; + } else if (zorro == 3) { + rb = &p->z3fastmem[boardnum]; + } + if (rb && rb->autoconfig[0]) { + forceac = rb->autoconfig; + } } if (!mid) { mid = uae_id; @@ -4767,6 +4778,13 @@ const struct expansionromtype expansionroms[] = { true, 2, fastata_settings, { 0x90, 0, 0x10, 0x00, 0x08, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00 }, }, + { + _T("eveshamref"), _T("Reference 40/100"), _T("Evesham Micros"), + NULL, eveshamref_init, NULL, eveshamref_add_scsi_unit, ROMTYPE_EVESHAMREF, 0, 0, BOARD_AUTOCONFIG_Z2, false, + NULL, 0, + true, EXPANSIONTYPE_SCSI, + 8504, 2, 0 + }, { _T("dataflyerscsiplus"), _T("DataFlyer SCSI+"), _T("Expansion Systems"), NULL, dataflyer_init, NULL, dataflyer_add_scsi_unit, ROMTYPE_DATAFLYERP | ROMTYPE_NOT, 0, 0, BOARD_NONAUTOCONFIG_BEFORE, true, diff --git a/include/rommgr.h b/include/rommgr.h index 7cc3638f..0e7a7c30 100644 --- a/include/rommgr.h +++ b/include/rommgr.h @@ -162,6 +162,7 @@ extern int decode_cloanto_rom_do (uae_u8 *mem, int size, int real_size); #define ROMTYPE_GOLEMHD3000 0x0010006c #define ROMTYPE_WEDGE 0x0010006d #define ROMTYPE_ARRIBA 0x0010006e +#define ROMTYPE_EVESHAMREF 0x0010006f #define ROMTYPE_NOT 0x00800000 #define ROMTYPE_QUAD 0x01000000 diff --git a/include/scsi.h b/include/scsi.h index 50850510..b3033433 100644 --- a/include/scsi.h +++ b/include/scsi.h @@ -282,6 +282,9 @@ bool wedge_preinit(struct autoconfig_info *aci); bool wedge_init(struct autoconfig_info *aci); void wedge_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc); +bool eveshamref_init(struct autoconfig_info *aci); +void eveshamref_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc); + uae_u8 idescsi_scsi_get(uaecptr addr); void idescsi_scsi_put(uaecptr addr, uae_u8 v); diff --git a/rommgr.cpp b/rommgr.cpp index c8be1e0d..6d88be40 100644 --- a/rommgr.cpp +++ b/rommgr.cpp @@ -95,7 +95,7 @@ struct romdata *getromdatabypath (const TCHAR *path) return NULL; } -#define NEXT_ROM_ID 222 +#define NEXT_ROM_ID 223 #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 }, @@ -547,6 +547,8 @@ static struct romdata roms[] = { 0x93ba65c7, 0x33ba9d1e,0x27e9c210,0xa27ee6d3,0x855d3feb,0x1649ddc2, NULL, NULL }, ALTROMPN(220, 1, 1, 8192, ROMTYPE_ODD | ROMTYPE_8BIT, NULL, 0x2af75b4c, 0xe25be651, 0x56eef3bc, 0xa036d76c, 0xca3903a9, 0x469f0de5) ALTROMPN(220, 1, 2, 8192, ROMTYPE_EVEN | ROMTYPE_8BIT, NULL, 0x8283dc0c, 0xe3820358, 0x1d130b40, 0x9c333f41, 0xdfd6afcd, 0xf3fabb81) + { _T("Evesham Micros Reference"), 1, 1, 1, 1, _T("EVESHAMREF\0"), 65536, 221, 0, 0, ROMTYPE_EVESHAMREF, 0, 0, NULL, + 0xb0225f48, 0x2b170b40, 0x2f60d28c, 0x344fc463, 0x7e99915f, 0x92e0e8f1, 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") }, diff --git a/scsi.cpp b/scsi.cpp index b7b2e082..c036db69 100644 --- a/scsi.cpp +++ b/scsi.cpp @@ -66,7 +66,8 @@ #define NCR5380_EMPLANT 35 #define OMTI_HD3000 36 #define OMTI_WEDGE 37 -#define NCR_LAST 38 +#define NCR5380_EVESHAMREF 38 +#define NCR_LAST 39 extern int log_scsiemu; @@ -2543,6 +2544,17 @@ static int malibureg(uaecptr addr) return reg; } +static int eveshamref_reg(struct soft_scsi *ncr, uaecptr addr) +{ + if (!ncr->configured) + return -1; + if (addr < 0x40) + return (addr >> 1) & 7; + if (addr == 0x41) + return 8; + return -1; +} + static uae_u8 read_684xx_dma(struct soft_scsi *ncr, uaecptr addr) { uae_u8 val = 0; @@ -3211,6 +3223,15 @@ static uae_u32 ncr80_bget2(struct soft_scsi *ncr, uaecptr addr, int size) v = ncr5380_bget(ncr, 8); } + } else if (ncr->type == NCR5380_EVESHAMREF) { + + reg = eveshamref_reg(ncr, addr); + if (reg >= 0) { + v = ncr5380_bget(ncr, reg); + } else { + v = ncr->rom[addr & 0x7fff]; + } + } #if NCR5380_DEBUG > 1 @@ -3585,6 +3606,12 @@ static void ncr80_bput2(struct soft_scsi *ncr, uaecptr addr, uae_u32 val, int si if (ncr->dma_active) ncr5380_bput(ncr, 8, val); } + + } else if (ncr->type == NCR5380_EVESHAMREF) { + + reg = eveshamref_reg(ncr, addr); + if (reg >= 0) + ncr5380_bput(ncr, reg, val); } #if NCR5380_DEBUG > 1 @@ -4856,7 +4883,7 @@ bool hd3000_init(struct autoconfig_info *aci) const struct expansionromtype *ert = get_device_expansion_rom(ROMTYPE_GOLEMHD3000); if (!aci->doinit) { - load_rom_rc(aci->rc, ROMTYPE_GOLEMHD3000, 8192, aci->ert->autoboot_jumper ? 0 : 8192, aci->autoconfig_raw, 128, 0); + load_rom_rc(aci->rc, ROMTYPE_GOLEMHD3000, 8192, !aci->rc->autoboot_disabled ? 0 : 8192, aci->autoconfig_raw, 128, 0); return true; } @@ -4864,7 +4891,7 @@ bool hd3000_init(struct autoconfig_info *aci) if (!scsi) return false; - load_rom_rc(aci->rc, ROMTYPE_GOLEMHD3000, 8192, aci->ert->autoboot_jumper ? 0 : 8192, scsi->rom, 65536, 0); + load_rom_rc(aci->rc, ROMTYPE_GOLEMHD3000, 8192, !aci->rc->autoboot_disabled ? 0 : 8192, scsi->rom, 65536, 0); memcpy(scsi->acmemory, scsi->rom, sizeof scsi->acmemory); aci->addrbank = scsi->bank; return true; @@ -4874,3 +4901,25 @@ void hd3000_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfi { generic_soft_scsi_add(ch, ci, rc, OMTI_HD3000, 65536, 16384, ROMTYPE_GOLEMHD3000); } + +bool eveshamref_init(struct autoconfig_info *aci) +{ + if (!aci->doinit) { + load_rom_rc(aci->rc, ROMTYPE_EVESHAMREF, 65536, aci->rc->autoboot_disabled ? 0x1000 : 0, aci->autoconfig_raw, 128, LOADROM_EVENONLY_ODDONE); + return true; + } + + struct soft_scsi *scsi = getscsi(aci->rc); + if (!scsi) + return false; + + load_rom_rc(aci->rc, ROMTYPE_EVESHAMREF, 65536, aci->rc->autoboot_disabled ? 0x1000 : 0, scsi->rom, 65536, LOADROM_EVENONLY_ODDONE); + memcpy(scsi->acmemory, scsi->rom, sizeof scsi->acmemory); + aci->addrbank = scsi->bank; + return true; +} + +void eveshamref_add_scsi_unit(int ch, struct uaedev_config_info *ci, struct romconfig *rc) +{ + generic_soft_scsi_add(ch, ci, rc, NCR5380_EVESHAMREF, 65536, 65536, ROMTYPE_EVESHAMREF); +} -- 2.47.3