mirror of
https://github.com/holub/mame
synced 2025-06-05 20:33:45 +03:00
slapstic: make the modern interface even nicer, convert rampart and gauntlet
This commit is contained in:
parent
abc3758c0b
commit
7f13cc2de1
@ -117,7 +117,7 @@ void atetris_state::machine_start()
|
||||
|
||||
void atetris_state::machine_reset()
|
||||
{
|
||||
m_current_bank = m_slapstic->slapstic_bank() & 1;
|
||||
m_current_bank = m_slapstic->bank() & 1;
|
||||
reset_bank();
|
||||
|
||||
/* start interrupts going (32V clocked by 16V) */
|
||||
@ -135,7 +135,7 @@ void atetris_state::machine_reset()
|
||||
uint8_t atetris_state::slapstic_r(address_space &space, offs_t offset)
|
||||
{
|
||||
int result = m_slapstic_base[0x2000 + offset];
|
||||
int new_bank = m_slapstic->slapstic_tweak(space, offset) & 1;
|
||||
int new_bank = m_slapstic->tweak(space, offset) & 1;
|
||||
|
||||
/* update for the new bank */
|
||||
if (new_bank != m_current_bank)
|
||||
|
@ -549,6 +549,7 @@ void gauntlet_state::gauntlet(machine_config & config)
|
||||
{
|
||||
gauntlet_base(config);
|
||||
SLAPSTIC(config, m_slapstic, 104, true);
|
||||
m_slapstic->set_bank(m_slapstic_bank);
|
||||
}
|
||||
|
||||
|
||||
@ -556,6 +557,7 @@ void gauntlet_state::gaunt2p(machine_config & config)
|
||||
{
|
||||
gauntlet_base(config);
|
||||
SLAPSTIC(config, m_slapstic, 107, true);
|
||||
m_slapstic->set_bank(m_slapstic_bank);
|
||||
}
|
||||
|
||||
|
||||
@ -563,6 +565,7 @@ void gauntlet_state::gauntlet2(machine_config & config)
|
||||
{
|
||||
gauntlet_base(config);
|
||||
SLAPSTIC(config, m_slapstic, 106, true);
|
||||
m_slapstic->set_bank(m_slapstic_bank);
|
||||
}
|
||||
|
||||
|
||||
@ -570,6 +573,7 @@ void gauntlet_state::vindctr2(machine_config & config)
|
||||
{
|
||||
gauntlet_base(config);
|
||||
SLAPSTIC(config, m_slapstic, 118, true);
|
||||
m_slapstic->set_bank(m_slapstic_bank);
|
||||
}
|
||||
|
||||
|
||||
@ -1651,24 +1655,13 @@ 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)
|
||||
{
|
||||
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); });
|
||||
[this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(m_maincpu->space(), offset >> 1); },
|
||||
[this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(m_maincpu->space(), offset >> 1); });
|
||||
|
||||
// swap the top and bottom halves of the main CPU ROM images
|
||||
swap_memory(rom + 0x000000, rom + 0x008000, 0x8000);
|
||||
|
@ -329,6 +329,7 @@ void rampart_state::rampart(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &rampart_state::main_map);
|
||||
|
||||
SLAPSTIC(config, m_slapstic, 118, true);
|
||||
m_slapstic->set_bank(m_slapstic_bank);
|
||||
|
||||
TIMER(config, "scantimer").configure_scanline(FUNC(rampart_state::scanline_interrupt), m_screen, 0, 32);
|
||||
|
||||
@ -491,23 +492,12 @@ ROM_END
|
||||
*
|
||||
*************************************/
|
||||
|
||||
void rampart_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 rampart_state::machine_start()
|
||||
{
|
||||
m_slapstic_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x40000, 0x2000);
|
||||
m_maincpu->space(AS_PROGRAM).install_readwrite_tap(0x140000, 0x147fff, 0x438000, "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); });
|
||||
}
|
||||
|
||||
void rampart_state::machine_reset()
|
||||
{
|
||||
m_slapstic_bank->set_entry(m_slapstic->slapstic_bank());
|
||||
[this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(m_maincpu->space(), offset >> 1); },
|
||||
[this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(m_maincpu->space(), offset >> 1); });
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ void starwars_state::machine_reset()
|
||||
if (m_slapstic_device.found())
|
||||
{
|
||||
/* reset the slapstic */
|
||||
m_slapstic_current_bank = m_slapstic_device->slapstic_bank();
|
||||
m_slapstic_current_bank = m_slapstic_device->bank();
|
||||
memcpy(m_slapstic_base, &m_slapstic_source[m_slapstic_current_bank * 0x2000], 0x2000);
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ void starwars_state::irq_ack_w(uint8_t data)
|
||||
|
||||
void starwars_state::esb_slapstic_tweak(address_space &space, offs_t offset)
|
||||
{
|
||||
int new_bank = m_slapstic_device->slapstic_tweak(space, offset);
|
||||
int new_bank = m_slapstic_device->tweak(space, offset);
|
||||
|
||||
/* update for the new bank */
|
||||
if (new_bank != m_slapstic_current_bank)
|
||||
|
@ -54,7 +54,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void video_start() override;
|
||||
virtual void machine_reset() override;
|
||||
|
||||
private:
|
||||
void video_int_ack_w(uint16_t data = 0);
|
||||
|
@ -38,7 +38,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void machine_start() override;
|
||||
virtual void machine_reset() override;
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
@ -62,8 +61,6 @@ private:
|
||||
required_shared_ptr<u16> m_bitmap;
|
||||
|
||||
static const atari_motion_objects_config s_mob_config;
|
||||
|
||||
void slapstic_tweak(offs_t offset, u16 &, u16);
|
||||
};
|
||||
|
||||
#endif // MAME_INCLUDES_RAMPART_H
|
||||
|
@ -1699,13 +1699,13 @@ void harddriv_state::hddspcom_control_w(offs_t offset, uint16_t data)
|
||||
|
||||
void harddriv_state::rd68k_slapstic_w(address_space &space, offs_t offset, uint16_t data)
|
||||
{
|
||||
m_slapstic_device->slapstic_tweak(space, offset & 0x3fff);
|
||||
m_slapstic_device->tweak(space, offset & 0x3fff);
|
||||
}
|
||||
|
||||
|
||||
uint16_t harddriv_state::rd68k_slapstic_r(address_space &space, offs_t offset)
|
||||
{
|
||||
int bank = m_slapstic_device->slapstic_tweak(space, offset & 0x3fff) * 0x4000;
|
||||
int bank = m_slapstic_device->tweak(space, offset & 0x3fff) * 0x4000;
|
||||
return m_m68k_slapstic_base[bank + (offset & 0x3fff)];
|
||||
}
|
||||
|
||||
|
@ -209,6 +209,7 @@ atari_slapstic_device::atari_slapstic_device(const machine_config &mconfig, cons
|
||||
bit_bank(0),
|
||||
add_bank(0),
|
||||
bit_xor(0),
|
||||
m_bank(*this, finder_base::DUMMY_TAG),
|
||||
m_legacy_configured(false),
|
||||
m_legacy_space(nullptr),
|
||||
m_legacy_memptr(nullptr),
|
||||
@ -252,7 +253,7 @@ atari_slapstic_device::atari_slapstic_device(const machine_config &mconfig, cons
|
||||
void atari_slapstic_device::device_post_load()
|
||||
{
|
||||
if (m_legacy_configured)
|
||||
legacy_update_bank(slapstic_bank());
|
||||
legacy_update_bank(bank());
|
||||
}
|
||||
|
||||
/*************************************
|
||||
@ -787,8 +788,11 @@ void atari_slapstic_device::device_reset(void)
|
||||
/* the 111 and later chips seem to reset to bank 0 */
|
||||
current_bank = slapstic.bankstart;
|
||||
|
||||
if(m_bank)
|
||||
m_bank->set_entry(current_bank);
|
||||
|
||||
if (m_legacy_configured)
|
||||
legacy_update_bank(slapstic_bank());
|
||||
legacy_update_bank(bank());
|
||||
}
|
||||
|
||||
|
||||
@ -799,7 +803,7 @@ void atari_slapstic_device::device_reset(void)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
int atari_slapstic_device::slapstic_bank(void)
|
||||
int atari_slapstic_device::bank(void)
|
||||
{
|
||||
return current_bank;
|
||||
}
|
||||
@ -859,8 +863,10 @@ int atari_slapstic_device::alt2_kludge(address_space &space, offs_t offset)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
int atari_slapstic_device::slapstic_tweak(address_space &space, offs_t offset)
|
||||
int atari_slapstic_device::tweak(address_space &space, offs_t offset)
|
||||
{
|
||||
offset &= 0x3fff;
|
||||
|
||||
/* reset is universal */
|
||||
if (offset == 0x0000)
|
||||
{
|
||||
@ -1071,6 +1077,9 @@ int atari_slapstic_device::slapstic_tweak(address_space &space, offs_t offset)
|
||||
if (LOG_SLAPSTIC)
|
||||
slapstic_log(offset);
|
||||
|
||||
if(m_bank)
|
||||
m_bank->set_entry(current_bank);
|
||||
|
||||
/* return the active bank */
|
||||
return current_bank;
|
||||
}
|
||||
@ -1161,7 +1170,7 @@ void atari_slapstic_device::slapstic_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
{
|
||||
assert(m_legacy_configured);
|
||||
|
||||
// legacy_update_bank(slapstic_tweak(*m_legacy_space, offset));
|
||||
legacy_update_bank(tweak(*m_legacy_space, offset));
|
||||
}
|
||||
|
||||
|
||||
@ -1180,7 +1189,7 @@ u16 atari_slapstic_device::slapstic_r(offs_t offset, u16 mem_mask)
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
// then determine the new one
|
||||
legacy_update_bank(slapstic_tweak(*m_legacy_space, offset));
|
||||
legacy_update_bank(tweak(*m_legacy_space, offset));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -118,8 +118,10 @@ public:
|
||||
|
||||
atari_slapstic_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
|
||||
|
||||
int slapstic_bank();
|
||||
int slapstic_tweak(address_space &space, offs_t offset);
|
||||
template <typename T> void set_bank(T &&tag) { m_bank.set_tag(std::forward<T>(tag)); }
|
||||
|
||||
int bank();
|
||||
int tweak(address_space &space, offs_t offset);
|
||||
|
||||
int alt2_kludge(address_space &space, offs_t offset);
|
||||
|
||||
@ -158,6 +160,8 @@ private:
|
||||
void slapstic_w(offs_t offset, u16 data, u16 mem_mask);
|
||||
uint16_t slapstic_r(offs_t offset, u16 mem_mask);
|
||||
|
||||
optional_memory_bank m_bank;
|
||||
|
||||
bool m_legacy_configured;
|
||||
address_space * m_legacy_space;
|
||||
u16 * m_legacy_memptr;
|
||||
|
@ -190,20 +190,20 @@ rgb_t atarisy2_state::RRRRGGGGBBBBIIII(uint32_t raw)
|
||||
uint16_t atarisy2_state::slapstic_r(address_space &space, offs_t offset)
|
||||
{
|
||||
int result = m_slapstic_region[offset + 0100000/2];
|
||||
m_slapstic->slapstic_tweak(space, offset);
|
||||
m_slapstic->tweak(space, offset);
|
||||
|
||||
/* an extra tweak for the next opcode fetch */
|
||||
m_vrambank->set_bank(m_slapstic->slapstic_tweak(space, 0x1234));
|
||||
m_vrambank->set_bank(m_slapstic->tweak(space, 0x1234));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void atarisy2_state::slapstic_w(address_space &space, offs_t offset, uint16_t data)
|
||||
{
|
||||
m_slapstic->slapstic_tweak(space, offset);
|
||||
m_slapstic->tweak(space, offset);
|
||||
|
||||
/* an extra tweak for the next opcode fetch */
|
||||
m_vrambank->set_bank(m_slapstic->slapstic_tweak(space, 0x1234));
|
||||
m_vrambank->set_bank(m_slapstic->tweak(space, 0x1234));
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user