From 83abe16d5b02b49f4f03165012d67fa19babe75b Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 9 Dec 2023 12:06:44 +0100 Subject: novag_const: darker button panel background, fdelity clockdiv: remove dummy bg timer --- src/mame/fidelity/clockdiv.cpp | 52 +++++++++++++++++------------------------ src/mame/fidelity/clockdiv.h | 3 ++- src/mame/layout/novag_const.lay | 39 ++++++++++++++++--------------- 3 files changed, 43 insertions(+), 51 deletions(-) diff --git a/src/mame/fidelity/clockdiv.cpp b/src/mame/fidelity/clockdiv.cpp index 67e28190cf8..fbd6125c5fc 100644 --- a/src/mame/fidelity/clockdiv.cpp +++ b/src/mame/fidelity/clockdiv.cpp @@ -2,15 +2,10 @@ // copyright-holders:hap /******************************************************************************* -Fidelity Electronics 6502 dynamic(offset-dependent) CPU clock divider base class. -Used to compensate slow memory chips in chess computer models: SC12, AS12, PC, EAS, EAG. +Fidelity Electronics 6502 dynamic CPU clock divider -TODO: -- improve clock divider? it seems a little bit slower than the real machine. - Currently, a dummy timer workaround is needed, or it's much worse (doing it with - a synchronize() will make it even worse). - Is the problem here due to timing of CPU addressbus changes? We can only 'sense' - the addressbus at read or write accesses. +Offset-dependent CPU clock divider base class. Used to compensate slow memory +chips in chess computer models: SC12, AS12, PC, EAS, EAG. *******************************************************************************/ @@ -18,15 +13,6 @@ TODO: #include "clockdiv.h" -// machine start - -void fidel_clockdiv_state::machine_start() -{ - // dummy timer for cpu divider - m_div_timer = machine().scheduler().timer_alloc(timer_expired_delegate()); -} - - // input ports INPUT_PORTS_START( fidel_clockdiv_2 ) @@ -48,16 +34,24 @@ INPUT_PORTS_END // implementation -void fidel_clockdiv_state::div_set_cpu_freq(offs_t offset) +void fidel_clockdiv_state::machine_start() { - if (offset != m_div_status) - { - // when a13/a14 is high, XTAL goes through divider(s) - // (depending on factory-set jumper, either one or two 7474) - m_maincpu->set_clock_scale(offset ? m_div_scale : 1.0); + // set up trigger for breaking out of 6502 execution (not using synchronize()) + m_div_timer = timer_alloc(FUNC(fidel_clockdiv_state::div_set_cpu_freq), this); +} - m_div_status = offset; - } +TIMER_CALLBACK_MEMBER(fidel_clockdiv_state::div_set_cpu_freq) +{ + // when a13/a14 is high, XTAL goes through divider(s) + // (depending on factory-set jumper, either one or two 7474) + m_maincpu->set_clock_scale(param ? m_div_scale : 1.0); + m_div_status = param; +} + +void fidel_clockdiv_state::div_prep_cpu_freq(offs_t offset) +{ + if (offset != m_div_status) + m_div_timer->adjust(attotime::zero, offset); } void fidel_clockdiv_state::div_refresh(ioport_value val) @@ -76,10 +70,6 @@ void fidel_clockdiv_state::div_refresh(ioport_value val) m_div_status = ~0; 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; - m_div_timer->adjust(period, 0, period); - // set up memory passthroughs m_read_tap.remove(); m_write_tap.remove(); @@ -94,7 +84,7 @@ void fidel_clockdiv_state::div_refresh(ioport_value val) [this] (offs_t offset, u8 &data, u8 mem_mask) { if (!machine().side_effects_disabled()) - div_set_cpu_freq(offset & 0x6000); + div_prep_cpu_freq(offset & 0x6000); }, &m_read_tap); m_write_tap = program.install_write_tap( @@ -102,7 +92,7 @@ void fidel_clockdiv_state::div_refresh(ioport_value val) "program_div_w", [this] (offs_t offset, u8 &data, u8 mem_mask) { - div_set_cpu_freq(offset & 0x6000); + div_prep_cpu_freq(offset & 0x6000); }, &m_write_tap); } diff --git a/src/mame/fidelity/clockdiv.h b/src/mame/fidelity/clockdiv.h index ecb142d455e..5088d8a9895 100644 --- a/src/mame/fidelity/clockdiv.h +++ b/src/mame/fidelity/clockdiv.h @@ -41,7 +41,8 @@ private: double m_div_scale = 0; emu_timer *m_div_timer = nullptr; - inline void div_set_cpu_freq(offs_t offset); + inline void div_prep_cpu_freq(offs_t offset); + TIMER_CALLBACK_MEMBER(div_set_cpu_freq); }; diff --git a/src/mame/layout/novag_const.lay b/src/mame/layout/novag_const.lay index 93c7ec24e1d..94a6cd3c4d2 100644 --- a/src/mame/layout/novag_const.lay +++ b/src/mame/layout/novag_const.lay @@ -65,25 +65,25 @@ license:CC0-1.0 - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + @@ -352,7 +352,8 @@ license:CC0-1.0 - + + @@ -398,7 +399,7 @@ license:CC0-1.0 - + -- cgit v1.2.3