From 81a4d2953b6aaf8eafe5c309080c2b6d8f32bb71 Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 9 Feb 2021 00:19:39 +0100 Subject: fidel_clockdiv: remove unneeded code --- src/mame/machine/fidel_clockdiv.cpp | 22 +++------------------- src/mame/machine/fidel_clockdiv.h | 8 ++++---- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/mame/machine/fidel_clockdiv.cpp b/src/mame/machine/fidel_clockdiv.cpp index 26dcd9a78fa..13ec96c2ee1 100644 --- a/src/mame/machine/fidel_clockdiv.cpp +++ b/src/mame/machine/fidel_clockdiv.cpp @@ -18,29 +18,14 @@ TODO: #include "machine/fidel_clockdiv.h" -// machine start/reset +// machine start void fidel_clockdiv_state::machine_start() { - // zerofill - m_div_config = 0; - m_read_tap = nullptr; - m_write_tap = nullptr; - - // register for savestates - save_item(NAME(m_div_status)); - save_item(NAME(m_div_config)); - save_item(NAME(m_div_scale)); - // dummy timer for cpu divider m_div_timer = machine().scheduler().timer_alloc(timer_expired_delegate(), this); } -void fidel_clockdiv_state::machine_reset() -{ - div_refresh(); -} - // input ports @@ -89,8 +74,7 @@ void fidel_clockdiv_state::div_refresh(ioport_value val) m_maincpu->set_clock_scale(1.0); m_div_status = ~0; - m_div_config = val; - m_div_scale = (m_div_config & 1) ? 0.25 : 0.5; + m_div_scale = (val & 1) ? 0.25 : 0.5; // stop high frequency background timer if cpu divider is disabled attotime period = (val) ? attotime::from_hz(m_maincpu->clock()) : attotime::never; @@ -105,7 +89,7 @@ void fidel_clockdiv_state::div_refresh(ioport_value val) m_write_tap = nullptr; } - if (m_div_config) + if (val) { address_space &program = m_maincpu->space(AS_PROGRAM); diff --git a/src/mame/machine/fidel_clockdiv.h b/src/mame/machine/fidel_clockdiv.h index aa08e0c9552..c068b69afad 100644 --- a/src/mame/machine/fidel_clockdiv.h +++ b/src/mame/machine/fidel_clockdiv.h @@ -24,7 +24,8 @@ public: protected: virtual void machine_start() override; - virtual void machine_reset() override; + virtual void machine_reset() override { div_refresh(); } + virtual void device_post_load() override { div_refresh(); } // devices/pointers required_device m_maincpu; @@ -35,11 +36,10 @@ protected: private: inline void div_set_cpu_freq(offs_t offset); - memory_passthrough_handler *m_read_tap; - memory_passthrough_handler *m_write_tap; + memory_passthrough_handler *m_read_tap = nullptr; + memory_passthrough_handler *m_write_tap = nullptr; u16 m_div_status; - ioport_value m_div_config; double m_div_scale; emu_timer *m_div_timer; }; -- cgit v1.2.3