diff --git a/src/mame/drivers/gauntlet.cpp b/src/mame/drivers/gauntlet.cpp index 605a8b871bf..608179bd511 100644 --- a/src/mame/drivers/gauntlet.cpp +++ b/src/mame/drivers/gauntlet.cpp @@ -259,7 +259,7 @@ void gauntlet_state::main_map(address_map &map) { map.unmap_value_high(); map(0x000000, 0x037fff).mirror(0x280000).rom(); - map(0x038000, 0x03ffff).mirror(0x280000).rom(); // slapstic maps here + map(0x038000, 0x03ffff).mirror(0x280000).bankr(m_slapstic_bank); // slapstic maps here map(0x040000, 0x07ffff).mirror(0x280000).rom(); // MBUS @@ -1651,10 +1651,24 @@ void gauntlet_state::swap_memory(void *ptr1, void *ptr2, int bytes) } } +void gauntlet_state::slapstic_tweak(offs_t offset, u16 &, u16) +{ + m_slapstic->slapstic_tweak(m_maincpu->space(AS_PROGRAM), (offset >> 1) & 0x3fff); + m_slapstic_bank->set_entry(m_slapstic->slapstic_bank()); +} + +void gauntlet_state::machine_reset() +{ + m_slapstic_bank->set_entry(m_slapstic->slapstic_bank()); +} + void gauntlet_state::common_init(int vindctr2) { - uint8_t *rom = memregion("maincpu")->base(); - m_slapstic->legacy_configure(*m_maincpu, 0x038000, 0, memregion("maincpu")->base() + 0x38000); + u8 *rom = memregion("maincpu")->base(); + m_slapstic_bank->configure_entries(0, 4, rom + 0x38000, 0x2000); + m_maincpu->space(AS_PROGRAM).install_readwrite_tap(0x38000, 0x3ffff, 0x280000, "slapstic", + [this](offs_t offset, u16 &data, u16 mem_mask) { slapstic_tweak(offset, data, mem_mask); }, + [this](offs_t offset, u16 &data, u16 mem_mask) { slapstic_tweak(offset, data, mem_mask); }); // swap the top and bottom halves of the main CPU ROM images swap_memory(rom + 0x000000, rom + 0x008000, 0x8000); diff --git a/src/mame/includes/gauntlet.h b/src/mame/includes/gauntlet.h index adc945a6dfc..0ee7a83a51b 100644 --- a/src/mame/includes/gauntlet.h +++ b/src/mame/includes/gauntlet.h @@ -35,6 +35,7 @@ public: m_tms5220(*this, "tms"), m_soundctl(*this, "soundctl"), m_slapstic(*this, "slapstic"), + m_slapstic_bank(*this, "slapstic_bank"), m_gfxdecode(*this, "gfxdecode"), m_screen(*this, "screen"), m_playfield_tilemap(*this, "playfield"), @@ -53,6 +54,7 @@ public: protected: virtual void video_start() override; + virtual void machine_reset() override; private: void video_int_ack_w(uint16_t data = 0); @@ -86,6 +88,7 @@ private: required_device m_tms5220; required_device m_soundctl; required_device m_slapstic; + required_memory_bank m_slapstic_bank; required_device m_gfxdecode; required_device m_screen; @@ -101,6 +104,8 @@ private: uint8_t m_playfield_color_bank; static const atari_motion_objects_config s_mob_config; + + void slapstic_tweak(offs_t offset, u16 &, u16); }; #endif // MAME_INCLUDES_GAUNTLET_H