From bd0c70c51ea360159690a3b25b727483e98caadb Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Thu, 10 Dec 2020 15:40:37 +0100 Subject: [PATCH] slapstic: between a guess, the opcode going through the memory and and the cycle-perfect 6502 the kludge is not needed anymore. Remove access68k and space as a secondary consequence --- src/mame/drivers/atarig1.cpp | 18 +++++------ src/mame/drivers/atarisy1.cpp | 16 +++++----- src/mame/drivers/atarisy2.cpp | 10 +++--- src/mame/drivers/atetris.cpp | 6 ++-- src/mame/drivers/cyberbal.cpp | 6 ++-- src/mame/drivers/gauntlet.cpp | 12 +++---- src/mame/drivers/harddriv.cpp | 10 +++--- src/mame/drivers/rampart.cpp | 6 ++-- src/mame/drivers/starwars.cpp | 14 ++++---- src/mame/drivers/xybots.cpp | 6 ++-- src/mame/includes/atarisy2.h | 4 +-- src/mame/includes/atetris.h | 2 +- src/mame/includes/harddriv.h | 4 +-- src/mame/includes/starwars.h | 6 ++-- src/mame/machine/harddriv.cpp | 8 ++--- src/mame/machine/slapstic.cpp | 60 ++--------------------------------- src/mame/machine/slapstic.h | 11 ++----- src/mame/video/atarisy2.cpp | 12 +++---- 18 files changed, 76 insertions(+), 135 deletions(-) diff --git a/src/mame/drivers/atarig1.cpp b/src/mame/drivers/atarig1.cpp index 50d8e7ccc19..e0e0abd1212 100644 --- a/src/mame/drivers/atarig1.cpp +++ b/src/mame/drivers/atarig1.cpp @@ -406,7 +406,7 @@ void atarig1_state::hydra(machine_config &config) { hydrap(config); m_maincpu->set_addrmap(AS_PROGRAM, &atarig1_state::hydra_map); - SLAPSTIC(config, m_slapstic, 116, true); + SLAPSTIC(config, m_slapstic, 116); m_slapstic->set_bank(m_slapstic_bank); } @@ -417,7 +417,7 @@ void atarig1_state::pfslap111(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &atarig1_state::pitfight_map); ATARI_RLE_OBJECTS(config, m_rle, 0, modesc_pitfight); - SLAPSTIC(config, m_slapstic, 111, true); + SLAPSTIC(config, m_slapstic, 111); m_slapstic->set_bank(m_slapstic_bank); } @@ -428,7 +428,7 @@ void atarig1_state::pfslap112(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &atarig1_state::pitfight_map); ATARI_RLE_OBJECTS(config, m_rle, 0, modesc_pitfight); - SLAPSTIC(config, m_slapstic, 112, true); + SLAPSTIC(config, m_slapstic, 112); m_slapstic->set_bank(m_slapstic_bank); } @@ -439,7 +439,7 @@ void atarig1_state::pfslap113(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &atarig1_state::pitfight_map); ATARI_RLE_OBJECTS(config, m_rle, 0, modesc_pitfight); - SLAPSTIC(config, m_slapstic, 113, true); + SLAPSTIC(config, m_slapstic, 113); m_slapstic->set_bank(m_slapstic_bank); } @@ -450,7 +450,7 @@ void atarig1_state::pfslap114(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &atarig1_state::pitfight_map); ATARI_RLE_OBJECTS(config, m_rle, 0, modesc_pitfight); - SLAPSTIC(config, m_slapstic, 114, true); + SLAPSTIC(config, m_slapstic, 114); m_slapstic->set_bank(m_slapstic_bank); } @@ -1309,8 +1309,8 @@ void atarig1_state::init_hydra() { m_slapstic_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x78000, 0x2000); m_maincpu->space(AS_PROGRAM).install_readwrite_tap(0x78000, 0x7ffff, 0, "slapstic", - [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); }); + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }, + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }); m_is_pitfight = false; } @@ -1324,8 +1324,8 @@ void atarig1_state::init_pitfight() { m_slapstic_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x38000, 0x2000); m_maincpu->space(AS_PROGRAM).install_readwrite_tap(0x38000, 0x3ffff, 0, "slapstic", - [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); }); + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }, + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }); m_is_pitfight = true; } diff --git a/src/mame/drivers/atarisy1.cpp b/src/mame/drivers/atarisy1.cpp index 603bbf5fec4..cf99a47a4e0 100644 --- a/src/mame/drivers/atarisy1.cpp +++ b/src/mame/drivers/atarisy1.cpp @@ -788,7 +788,7 @@ void atarisy1_state::atarisy1(machine_config &config) void atarisy1_state::marble(machine_config &config) { atarisy1(config); - SLAPSTIC(config, m_slapstic, 103, true); + SLAPSTIC(config, m_slapstic, 103); m_slapstic->set_bank(m_slapstic_bank); } @@ -796,7 +796,7 @@ void atarisy1_state::peterpak(machine_config &config) { atarisy1(config); add_adc(config); - SLAPSTIC(config, m_slapstic, 107, true); + SLAPSTIC(config, m_slapstic, 107); m_slapstic->set_bank(m_slapstic_bank); // Digital joystick read through ADC @@ -811,7 +811,7 @@ void atarisy1_state::indytemp(machine_config &config) atarisy1(config); add_adc(config); add_speech(config); - SLAPSTIC(config, m_slapstic, 105, true); + SLAPSTIC(config, m_slapstic, 105); m_slapstic->set_bank(m_slapstic_bank); // Digital joystick read through ADC @@ -826,7 +826,7 @@ void atarisy1_state::roadrunn(machine_config &config) atarisy1(config); add_adc(config); add_speech(config); - SLAPSTIC(config, m_slapstic, 108, true); + SLAPSTIC(config, m_slapstic, 108); m_slapstic->set_bank(m_slapstic_bank); // Hall-effect analog joystick @@ -839,7 +839,7 @@ void atarisy1_state::roadb109(machine_config &config) atarisy1(config); add_adc(config); add_speech(config); - SLAPSTIC(config, m_slapstic, 109, true); + SLAPSTIC(config, m_slapstic, 109); m_slapstic->set_bank(m_slapstic_bank); // Road Blasters gas pedal @@ -851,7 +851,7 @@ void atarisy1_state::roadb110(machine_config &config) atarisy1(config); add_adc(config); add_speech(config); - SLAPSTIC(config, m_slapstic, 110, true); + SLAPSTIC(config, m_slapstic, 110); m_slapstic->set_bank(m_slapstic_bank); // Road Blasters gas pedal @@ -2489,8 +2489,8 @@ void atarisy1_state::init_slapstic() { m_slapstic_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x80000, 0x2000); m_maincpu->space(AS_PROGRAM).install_readwrite_tap(0x80000, 0x87fff, 0, "slapstic", - [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); }); + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }, + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }); } void atarisy1_state::init_marble() diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp index 45068a3922f..ae79cf61b6e 100644 --- a/src/mame/drivers/atarisy2.cpp +++ b/src/mame/drivers/atarisy2.cpp @@ -1308,7 +1308,7 @@ void atarisy2_state::atarisy2(machine_config &config) void atarisy2_state::paperboy(machine_config &config) { atarisy2(config); - SLAPSTIC(config, m_slapstic, 105, false); + SLAPSTIC(config, m_slapstic, 105); } @@ -1319,14 +1319,14 @@ void atarisy2_state::_720(machine_config &config) issues with the sound CPU; temporarily increasing the sound CPU frequency to ~2.2MHz "fixes" the problem */ - SLAPSTIC(config, m_slapstic, 107, false); + SLAPSTIC(config, m_slapstic, 107); } void atarisy2_state::ssprint(machine_config &config) { atarisy2(config); - SLAPSTIC(config, m_slapstic, 108, false); + SLAPSTIC(config, m_slapstic, 108); // sound hardware config.device_remove("tms"); @@ -1336,7 +1336,7 @@ void atarisy2_state::ssprint(machine_config &config) void atarisy2_state::csprint(machine_config &config) { atarisy2(config); - SLAPSTIC(config, m_slapstic, 109, false); + SLAPSTIC(config, m_slapstic, 109); // sound hardware config.device_remove("tms"); @@ -1346,7 +1346,7 @@ void atarisy2_state::csprint(machine_config &config) void atarisy2_state::apb(machine_config &config) { atarisy2(config); - SLAPSTIC(config, m_slapstic, 110, false); + SLAPSTIC(config, m_slapstic, 110); } diff --git a/src/mame/drivers/atetris.cpp b/src/mame/drivers/atetris.cpp index 53a8c4392af..f01d599b90f 100644 --- a/src/mame/drivers/atetris.cpp +++ b/src/mame/drivers/atetris.cpp @@ -132,10 +132,10 @@ void atetris_state::machine_reset() * *************************************/ -uint8_t atetris_state::slapstic_r(address_space &space, offs_t offset) +uint8_t atetris_state::slapstic_r(offs_t offset) { int result = m_slapstic_base[0x2000 + offset]; - int new_bank = m_slapstic->tweak(space, offset) & 1; + int new_bank = m_slapstic->tweak(offset) & 1; /* update for the new bank */ if (new_bank != m_current_bank) @@ -380,7 +380,7 @@ void atetris_state::atetris_base(machine_config &config) M6502(config, m_maincpu, MASTER_CLOCK/8); m_maincpu->set_addrmap(AS_PROGRAM, &atetris_state::main_map); - SLAPSTIC(config, m_slapstic, 101, false); + SLAPSTIC(config, m_slapstic, 101); WATCHDOG_TIMER(config, "watchdog"); diff --git a/src/mame/drivers/cyberbal.cpp b/src/mame/drivers/cyberbal.cpp index 96f5333e67e..448fab33b85 100644 --- a/src/mame/drivers/cyberbal.cpp +++ b/src/mame/drivers/cyberbal.cpp @@ -420,7 +420,7 @@ void cyberbal_state::cyberbalt(machine_config &config) cyberbal_base(config); EEPROM_2816(config, "eeprom").lock_after_write(true); - SLAPSTIC(config, m_slapstic, 116, true); + SLAPSTIC(config, m_slapstic, 116); m_slapstic->set_bank(m_slapstic_bank); m_maincpu->set_addrmap(AS_PROGRAM, &cyberbal_state::tournament_map); } @@ -1003,8 +1003,8 @@ void cyberbal_state::init_cyberbalt() { m_slapstic_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x18000, 0x2000); m_maincpu->space(AS_PROGRAM).install_readwrite_tap(0x18000, 0x1ffff, 0, "slapstic", - [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); }); + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }, + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }); } diff --git a/src/mame/drivers/gauntlet.cpp b/src/mame/drivers/gauntlet.cpp index bb9d39be089..a116f5ff1e4 100644 --- a/src/mame/drivers/gauntlet.cpp +++ b/src/mame/drivers/gauntlet.cpp @@ -548,7 +548,7 @@ void gauntlet_state::gauntlet_base(machine_config &config) void gauntlet_state::gauntlet(machine_config & config) { gauntlet_base(config); - SLAPSTIC(config, m_slapstic, 104, true); + SLAPSTIC(config, m_slapstic, 104); m_slapstic->set_bank(m_slapstic_bank); } @@ -556,7 +556,7 @@ void gauntlet_state::gauntlet(machine_config & config) void gauntlet_state::gaunt2p(machine_config & config) { gauntlet_base(config); - SLAPSTIC(config, m_slapstic, 107, true); + SLAPSTIC(config, m_slapstic, 107); m_slapstic->set_bank(m_slapstic_bank); } @@ -564,7 +564,7 @@ void gauntlet_state::gaunt2p(machine_config & config) void gauntlet_state::gauntlet2(machine_config & config) { gauntlet_base(config); - SLAPSTIC(config, m_slapstic, 106, true); + SLAPSTIC(config, m_slapstic, 106); m_slapstic->set_bank(m_slapstic_bank); } @@ -572,7 +572,7 @@ void gauntlet_state::gauntlet2(machine_config & config) void gauntlet_state::vindctr2(machine_config & config) { gauntlet_base(config); - SLAPSTIC(config, m_slapstic, 118, true); + SLAPSTIC(config, m_slapstic, 118); m_slapstic->set_bank(m_slapstic_bank); } @@ -1660,8 +1660,8 @@ 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) { 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); }); + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }, + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }); // swap the top and bottom halves of the main CPU ROM images swap_memory(rom + 0x000000, rom + 0x008000, 0x8000); diff --git a/src/mame/drivers/harddriv.cpp b/src/mame/drivers/harddriv.cpp index ed53dd7d415..625b64f518b 100644 --- a/src/mame/drivers/harddriv.cpp +++ b/src/mame/drivers/harddriv.cpp @@ -1455,7 +1455,7 @@ void harddriv_state::driver_nomsp(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &harddriv_state::driver_68k_map); m_maincpu->set_periodic_int(FUNC(harddriv_state::hd68k_irq_gen), attotime::from_hz(HARDDRIV_MASTER_CLOCK/16/16/16/16/2)); - SLAPSTIC(config, m_slapstic_device, 117, true); + SLAPSTIC(config, m_slapstic_device, 117); WATCHDOG_TIMER(config, "watchdog"); @@ -5061,7 +5061,7 @@ void harddriv_state::init_racedriv() init_driver_sound(); /* set up the slapstic */ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16m_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_r)), write16m_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_w))); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16sm_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_r)), write16sm_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_w))); m_m68k_slapstic_base = (uint16_t *)(memregion("maincpu")->base() + 0xe0000); /* synchronization */ @@ -5085,7 +5085,7 @@ void harddriv_state::racedrivc_init_common(offs_t gsp_protection) init_driver_sound(); /* set up the slapstic */ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16m_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_r)), write16m_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_w))); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16sm_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_r)), write16sm_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_w))); m_m68k_slapstic_base = (uint16_t *)(memregion("maincpu")->base() + 0xe0000); /* synchronization */ @@ -5119,7 +5119,7 @@ void harddriv_state::init_racedrivc_panorama_side() init_adsp(); /* set up the slapstic */ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16m_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_r)), write16m_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_w))); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16sm_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_r)), write16sm_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_w))); m_m68k_slapstic_base = (uint16_t *)(memregion("maincpu")->base() + 0xe0000); /* set up protection hacks */ @@ -5218,7 +5218,7 @@ void harddriv_state::init_strtdriv() init_dsk(); /* set up the slapstic */ - m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16m_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_r)), write16m_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_w))); + m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe0000, 0xfffff, read16sm_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_r)), write16sm_delegate(*this, FUNC(harddriv_state::rd68k_slapstic_w))); m_m68k_slapstic_base = (uint16_t *)(memregion("maincpu")->base() + 0xe0000); m_maincpu->space(AS_PROGRAM).install_read_handler(0xa80000, 0xafffff, read16smo_delegate(*this, FUNC(harddriv_state::hda68k_port1_r))); diff --git a/src/mame/drivers/rampart.cpp b/src/mame/drivers/rampart.cpp index 06aaf9d8036..20a6c176d65 100644 --- a/src/mame/drivers/rampart.cpp +++ b/src/mame/drivers/rampart.cpp @@ -328,7 +328,7 @@ void rampart_state::rampart(machine_config &config) M68000(config, m_maincpu, MASTER_CLOCK/2); m_maincpu->set_addrmap(AS_PROGRAM, &rampart_state::main_map); - SLAPSTIC(config, m_slapstic, 118, true); + SLAPSTIC(config, m_slapstic, 118); m_slapstic->set_bank(m_slapstic_bank); TIMER(config, "scantimer").configure_scanline(FUNC(rampart_state::scanline_interrupt), m_screen, 0, 32); @@ -496,8 +496,8 @@ 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) { 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); }); + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }, + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }); } diff --git a/src/mame/drivers/starwars.cpp b/src/mame/drivers/starwars.cpp index d9331bc76a9..1fc85e1f4f0 100644 --- a/src/mame/drivers/starwars.cpp +++ b/src/mame/drivers/starwars.cpp @@ -91,9 +91,9 @@ void starwars_state::irq_ack_w(uint8_t data) * *************************************/ -void starwars_state::esb_slapstic_tweak(address_space &space, offs_t offset) +void starwars_state::esb_slapstic_tweak(offs_t offset) { - int new_bank = m_slapstic_device->tweak(space, offset); + int new_bank = m_slapstic_device->tweak(offset); /* update for the new bank */ if (new_bank != m_slapstic_current_bank) @@ -104,17 +104,17 @@ void starwars_state::esb_slapstic_tweak(address_space &space, offs_t offset) } -uint8_t starwars_state::esb_slapstic_r(address_space &space, offs_t offset) +uint8_t starwars_state::esb_slapstic_r(offs_t offset) { int result = m_slapstic_base[offset]; - esb_slapstic_tweak(space, offset); + esb_slapstic_tweak(offset); return result; } -void starwars_state::esb_slapstic_w(address_space &space, offs_t offset, uint8_t data) +void starwars_state::esb_slapstic_w(offs_t offset, uint8_t data) { - esb_slapstic_tweak(space, offset); + esb_slapstic_tweak(offset); } @@ -370,7 +370,7 @@ void starwars_state::esb(machine_config &config) m_maincpu->set_addrmap(AS_PROGRAM, &starwars_state::esb_main_map); - SLAPSTIC(config, m_slapstic_device, 101, false); + SLAPSTIC(config, m_slapstic_device, 101); subdevice("outlatch")->q_out_cb<4>().append_membank("bank2"); } diff --git a/src/mame/drivers/xybots.cpp b/src/mame/drivers/xybots.cpp index dfd8312fa83..0abfe46ede8 100644 --- a/src/mame/drivers/xybots.cpp +++ b/src/mame/drivers/xybots.cpp @@ -181,7 +181,7 @@ void xybots_state::xybots(machine_config &config) M68000(config, m_maincpu, 14.318181_MHz_XTAL/2); m_maincpu->set_addrmap(AS_PROGRAM, &xybots_state::main_map); - SLAPSTIC(config, m_slapstic, 107, true); + SLAPSTIC(config, m_slapstic, 107); m_slapstic->set_bank(m_slapstic_bank); EEPROM_2804(config, "eeprom").lock_after_write(true); @@ -389,8 +389,8 @@ void xybots_state::machine_start() { m_slapstic_bank->configure_entries(0, 4, memregion("maincpu")->base() + 0x8000, 0x2000); m_maincpu->space(AS_PROGRAM).install_readwrite_tap(0x8000, 0xffff, 0x7c0000, "slapstic", - [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); }); + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }, + [this](offs_t offset, u16 &data, u16 mem_mask) { m_slapstic->tweak(offset >> 1); }); m_h256 = 0x0400; } diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h index 83aa161eafd..f6109af67f1 100644 --- a/src/mame/includes/atarisy2.h +++ b/src/mame/includes/atarisy2.h @@ -146,8 +146,8 @@ private: DECLARE_WRITE_LINE_MEMBER(vblank_int); TIMER_CALLBACK_MEMBER(delayed_int_enable_w); TIMER_CALLBACK_MEMBER(reset_yscroll_callback); - uint16_t slapstic_r(address_space &space, offs_t offset); - void slapstic_w(address_space &space, offs_t offset, uint16_t data); + uint16_t slapstic_r(offs_t offset); + void slapstic_w(offs_t offset, uint16_t data); void yscroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void xscroll_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); void spriteram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); diff --git a/src/mame/includes/atetris.h b/src/mame/includes/atetris.h index 503d44a2e35..914edb9f2cd 100644 --- a/src/mame/includes/atetris.h +++ b/src/mame/includes/atetris.h @@ -55,7 +55,7 @@ protected: tilemap_t *m_bg_tilemap; void irq_ack_w(uint8_t data); - uint8_t slapstic_r(address_space &space, offs_t offset); + uint8_t slapstic_r(offs_t offset); void coincount_w(uint8_t data); void videoram_w(offs_t offset, uint8_t data); TILE_GET_INFO_MEMBER(get_tile_info); diff --git a/src/mame/includes/harddriv.h b/src/mame/includes/harddriv.h index 1e13053556d..53cb84c4f0c 100644 --- a/src/mame/includes/harddriv.h +++ b/src/mame/includes/harddriv.h @@ -235,8 +235,8 @@ protected: /* DSPCOM board */ void hddspcom_control_w(offs_t offset, uint16_t data); - void rd68k_slapstic_w(address_space &space, offs_t offset, uint16_t data); - uint16_t rd68k_slapstic_r(address_space &space, offs_t offset); + void rd68k_slapstic_w(offs_t offset, uint16_t data); + uint16_t rd68k_slapstic_r(offs_t offset); /* Game-specific protection */ void st68k_sloop_w(offs_t offset, uint16_t data); diff --git a/src/mame/includes/starwars.h b/src/mame/includes/starwars.h index 1af8a8b50a3..25955a3e878 100644 --- a/src/mame/includes/starwars.h +++ b/src/mame/includes/starwars.h @@ -74,8 +74,8 @@ private: int16_t m_C; int32_t m_ACC; void irq_ack_w(uint8_t data); - uint8_t esb_slapstic_r(address_space &space, offs_t offset); - void esb_slapstic_w(address_space &space, offs_t offset, uint8_t data); + uint8_t esb_slapstic_r(offs_t offset); + void esb_slapstic_w(offs_t offset, uint8_t data); void starwars_nstore_w(uint8_t data); DECLARE_WRITE_LINE_MEMBER(recall_w); DECLARE_WRITE_LINE_MEMBER(coin1_counter_w); @@ -98,7 +98,7 @@ private: void starwars_mproc_init(); void starwars_mproc_reset(); void run_mproc(); - void esb_slapstic_tweak(address_space &space, offs_t offset); + void esb_slapstic_tweak(offs_t offset); void esb_main_map(address_map &map); void main_map(address_map &map); diff --git a/src/mame/machine/harddriv.cpp b/src/mame/machine/harddriv.cpp index 194a9e7f58f..456642bd0de 100644 --- a/src/mame/machine/harddriv.cpp +++ b/src/mame/machine/harddriv.cpp @@ -1697,15 +1697,15 @@ 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) +void harddriv_state::rd68k_slapstic_w(offs_t offset, uint16_t data) { - m_slapstic_device->tweak(space, offset & 0x3fff); + m_slapstic_device->tweak(offset & 0x3fff); } -uint16_t harddriv_state::rd68k_slapstic_r(address_space &space, offs_t offset) +uint16_t harddriv_state::rd68k_slapstic_r(offs_t offset) { - int bank = m_slapstic_device->tweak(space, offset & 0x3fff) * 0x4000; + int bank = m_slapstic_device->tweak(offset & 0x3fff) * 0x4000; return m_m68k_slapstic_base[bank + (offset & 0x3fff)]; } diff --git a/src/mame/machine/slapstic.cpp b/src/mame/machine/slapstic.cpp index 77716385061..9d4ceed542b 100644 --- a/src/mame/machine/slapstic.cpp +++ b/src/mame/machine/slapstic.cpp @@ -194,7 +194,7 @@ * *************************************/ -#define LOG_SLAPSTIC (0) +#define LOG_SLAPSTIC (1) @@ -260,7 +260,7 @@ static const struct slapstic_data slapstic101 = { 0x0080,0x0090,0x00a0,0x00b0 },/* bank select values */ /* alternate banking */ - { 0x007f,UNKNOWN }, /* 1st mask/value in sequence */ + { 0x1fff,0x1dfe }, /* 1st mask/value in sequence */ { 0x1fff,0x1dff }, /* 2nd mask/value in sequence */ { 0x1ffc,0x1b5c }, /* 3rd mask/value in sequence */ { 0x1fcf,0x0080 }, /* 4th mask/value in sequence */ @@ -797,60 +797,13 @@ int atari_slapstic_device::bank(void) -/************************************* - * - * Kludge to catch alt seqeuences - * - *************************************/ - -int atari_slapstic_device::alt2_kludge(address_space &space, offs_t offset) -{ - /* Of the 3 alternate addresses, only the middle one needs to actually hit - in the slapstic region; the first and third ones can be anywhere in the - address space. For this reason, the read/write handlers usually only - see the 2nd access. For the 68000-based games, we do the following - kludge to examine the opcode that is executing and look for the 1st - and 3rd accesses. */ - - if (access_68k) - { - /* first verify that the prefetched PC matches the first alternate */ - if (MATCHES_MASK_VALUE(space.device().state().pc() >> 1, slapstic.alt1)) - { - /* now look for a move.w (An),(An) or cmpm.w (An)+,(An)+ */ - u16 opcode = space.read_word(space.device().state().pcbase() & 0xffffff); - if ((opcode & 0xf1f8) == 0x3090 || (opcode & 0xf1f8) == 0xb148) - { - /* fetch the value of the register for the second operand, and see */ - /* if it matches the third alternate */ - u32 regval = space.device().state().state_int(M68K_A0 + ((opcode >> 9) & 7)) >> 1; - if (MATCHES_MASK_VALUE(regval, slapstic.alt3)) - { - alt_bank = (regval >> slapstic.altshift) & 3; - return ALTERNATE3; - } - } - } - - /* if there's no second memory hit within this instruction, the next */ - /* opcode fetch will botch the operation, so just fall back to */ - /* the enabled state */ - return ENABLED; - } - - /* kludge for ESB */ - return ALTERNATE2; -} - - - /************************************* * * Call this *after* every access * *************************************/ -int atari_slapstic_device::tweak(address_space &space, offs_t offset) +int atari_slapstic_device::tweak(offs_t offset) { offset &= 0x3fff; @@ -890,13 +843,6 @@ int atari_slapstic_device::tweak(address_space &space, offs_t offset) state = ALTERNATE1; } - /* special kludge for catching the second alternate address if */ - /* the first one was missed (since it's usually an opcode fetch) */ - else if (MATCHES_MASK_VALUE(offset, slapstic.alt2)) - { - state = alt2_kludge(space, offset); - } - /* check for standard bankswitches */ else if (offset == slapstic.bank[0]) { diff --git a/src/mame/machine/slapstic.h b/src/mame/machine/slapstic.h index d898264eebf..27275a7779d 100644 --- a/src/mame/machine/slapstic.h +++ b/src/mame/machine/slapstic.h @@ -109,11 +109,10 @@ class atari_slapstic_device : public device_t { public: // construction/destruction - atari_slapstic_device(const machine_config &mconfig, const char *tag, device_t *owner, int chipnum, bool m68k_mode) + atari_slapstic_device(const machine_config &mconfig, const char *tag, device_t *owner, int chipnum) : atari_slapstic_device(mconfig, tag, owner, u32(0)) { - set_chipnum(chipnum); - set_access68k(m68k_mode ? 1 : 0); + m_chipnum = chipnum; } atari_slapstic_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); @@ -121,11 +120,7 @@ public: template void set_bank(T &&tag) { m_bank.set_tag(std::forward(tag)); } int bank(); - int tweak(address_space &space, offs_t offset); - - int alt2_kludge(address_space &space, offs_t offset); - - void set_access68k(int type) { access_68k = type; } + int tweak(offs_t offset); void set_chipnum(int chipnum) { m_chipnum = chipnum; } diff --git a/src/mame/video/atarisy2.cpp b/src/mame/video/atarisy2.cpp index 1486919e0dc..52029258f87 100644 --- a/src/mame/video/atarisy2.cpp +++ b/src/mame/video/atarisy2.cpp @@ -187,23 +187,23 @@ rgb_t atarisy2_state::RRRRGGGGBBBBIIII(uint32_t raw) * *************************************/ -uint16_t atarisy2_state::slapstic_r(address_space &space, offs_t offset) +uint16_t atarisy2_state::slapstic_r(offs_t offset) { int result = m_slapstic_region[offset + 0100000/2]; - m_slapstic->tweak(space, offset); + m_slapstic->tweak(offset); /* an extra tweak for the next opcode fetch */ - m_vrambank->set_bank(m_slapstic->tweak(space, 0x1234)); + m_vrambank->set_bank(m_slapstic->tweak(0x1234)); return result; } -void atarisy2_state::slapstic_w(address_space &space, offs_t offset, uint16_t data) +void atarisy2_state::slapstic_w(offs_t offset, uint16_t data) { - m_slapstic->tweak(space, offset); + m_slapstic->tweak(offset); /* an extra tweak for the next opcode fetch */ - m_vrambank->set_bank(m_slapstic->tweak(space, 0x1234)); + m_vrambank->set_bank(m_slapstic->tweak(0x1234)); }