diff --git a/src/mess/machine/sns_slot.c b/src/mess/machine/sns_slot.c index 61d65403f1b..433d5ac7d7a 100644 --- a/src/mess/machine/sns_slot.c +++ b/src/mess/machine/sns_slot.c @@ -671,6 +671,11 @@ bool base_sns_cart_slot_device::call_load() if (software_entry() == NULL) setup_addon_from_fullpath(); + // in carts with an add-on CPU having internal dump, this speeds up access to the internal rom + // by installing read_bank in address space and mapping m_bios there + m_cart->speedup_addon_bios_access(); + + setup_nvram(); if (m_cart->get_nvram_size() || m_cart->get_rtc_ram_size()) diff --git a/src/mess/machine/sns_slot.h b/src/mess/machine/sns_slot.h index 51f2aa708d0..ad76d1d4ced 100644 --- a/src/mess/machine/sns_slot.h +++ b/src/mess/machine/sns_slot.h @@ -115,6 +115,7 @@ public: virtual DECLARE_WRITE8_MEMBER(write_ram) { UINT32 mask = m_nvram_size - 1; m_nvram[offset & mask] = data; return; } // NVRAM access virtual DECLARE_READ8_MEMBER(chip_read) { return 0xff; } virtual DECLARE_WRITE8_MEMBER(chip_write) {} + virtual void speedup_addon_bios_access() {}; void rom_alloc(running_machine &machine, UINT32 size); void nvram_alloc(running_machine &machine, UINT32 size); diff --git a/src/mess/machine/sns_upd.c b/src/mess/machine/sns_upd.c index f78a5ade6fc..52f4bb52dfa 100644 --- a/src/mess/machine/sns_upd.c +++ b/src/mess/machine/sns_upd.c @@ -76,17 +76,22 @@ sns_rom_seta11dsp_device::sns_rom_seta11dsp_device(const machine_config &mconfig void sns_rom20_necdsp_device::device_start() { + m_dsp_prg = auto_alloc_array(machine(), UINT32, 0x2000/4); + m_dsp_data = auto_alloc_array(machine(), UINT16, 0x800/2); } void sns_rom21_necdsp_device::device_start() { + m_dsp_prg = auto_alloc_array(machine(), UINT32, 0x2000/4); + m_dsp_data = auto_alloc_array(machine(), UINT16, 0x800/2); } void sns_rom_setadsp_device::device_start() { + m_dsp_prg = auto_alloc_array(machine(), UINT32, 0x10000/4); + m_dsp_data = auto_alloc_array(machine(), UINT16, 0x1000/2); } - /*------------------------------------------------- mapper specific handlers -------------------------------------------------*/ @@ -348,6 +353,48 @@ machine_config_constructor sns_rom_seta11dsp_device::device_mconfig_additions() } +// To make faster DSP access to its internal rom, let's install read banks and map m_bios there with correct byte order + +void sns_rom20_necdsp_device::speedup_addon_bios_access() +{ + m_upd7725->space(AS_PROGRAM).install_read_bank(0x0000, 0x07ff, "dsp_prg"); + m_upd7725->space(AS_DATA).install_read_bank(0x0000, 0x03ff, "dsp_data"); + membank("dsp_prg")->set_base(m_dsp_prg); + membank("dsp_data")->set_base(m_dsp_data); + // copy data in the correct format + for (int x = 0; x < 0x800; x++) + m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00; + for (int x = 0; x < 0x400; x++) + m_dsp_data[x] = (m_bios[0x2000 + x * 2] << 8) | m_bios[0x2000 + x * 2 + 1]; +} + +void sns_rom21_necdsp_device::speedup_addon_bios_access() +{ + m_upd7725->space(AS_PROGRAM).install_read_bank(0x0000, 0x07ff, "dsp_prg"); + m_upd7725->space(AS_DATA).install_read_bank(0x0000, 0x03ff, "dsp_data"); + membank("dsp_prg")->set_base(m_dsp_prg); + membank("dsp_data")->set_base(m_dsp_data); + // copy data in the correct format + for (int x = 0; x < 0x800; x++) + m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00; + for (int x = 0; x < 0x400; x++) + m_dsp_data[x] = (m_bios[0x2000 + x * 2] << 8) | m_bios[0x2000 + x * 2 + 1]; +} + +void sns_rom_setadsp_device::speedup_addon_bios_access() +{ + m_upd96050->space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "dsp_prg"); + m_upd96050->space(AS_DATA).install_read_bank(0x0000, 0x07ff, "dsp_data"); + membank("dsp_prg")->set_base(m_dsp_prg); + membank("dsp_data")->set_base(m_dsp_data); + // copy data in the correct format + for (int x = 0; x < 0x3fff; x++) + m_dsp_prg[x] = (m_bios[x * 4] << 24) | (m_bios[x * 4 + 1] << 16) | (m_bios[x * 4 + 2] << 8) | 0x00; + for (int x = 0; x < 0x07ff; x++) + m_dsp_data[x] = (m_bios[0x10000 + x * 2] << 8) | m_bios[0x10000 + x * 2 + 1]; +} + + // Legacy versions including DSP dump roms, in order to support faulty dumps missing DSP data... diff --git a/src/mess/machine/sns_upd.h b/src/mess/machine/sns_upd.h index f937aa0a10c..245f1e82505 100644 --- a/src/mess/machine/sns_upd.h +++ b/src/mess/machine/sns_upd.h @@ -19,6 +19,7 @@ public: virtual void device_start(); virtual void device_config_complete() { m_shortname = "sns_rom_necdsp"; } virtual machine_config_constructor device_mconfig_additions() const; + virtual void speedup_addon_bios_access(); required_device m_upd7725; @@ -28,6 +29,9 @@ public: virtual DECLARE_READ32_MEMBER(necdsp_prg_r); virtual DECLARE_READ16_MEMBER(necdsp_data_r); + + UINT32 *m_dsp_prg; + UINT16 *m_dsp_data; }; // ======================> sns_rom21_necdsp_device @@ -43,6 +47,7 @@ public: virtual void device_start(); virtual void device_config_complete() { m_shortname = "sns_rom21_necdsp"; } virtual machine_config_constructor device_mconfig_additions() const; + virtual void speedup_addon_bios_access(); required_device m_upd7725; @@ -52,6 +57,9 @@ public: virtual DECLARE_READ32_MEMBER(necdsp_prg_r); virtual DECLARE_READ16_MEMBER(necdsp_data_r); + + UINT32 *m_dsp_prg; + UINT16 *m_dsp_data; }; // ======================> sns_rom_setadsp_device @@ -65,6 +73,7 @@ public: // device-level overrides virtual void device_start(); virtual void device_config_complete() { m_shortname = "sns_rom_setadsp"; } + virtual void speedup_addon_bios_access(); required_device m_upd96050; @@ -74,6 +83,9 @@ public: virtual DECLARE_READ32_MEMBER(setadsp_prg_r); virtual DECLARE_READ16_MEMBER(setadsp_data_r); + + UINT32 *m_dsp_prg; + UINT16 *m_dsp_data; }; // ======================> sns_rom_seta10dsp_device