From 881df524432d70435c6864e7b4401a1c6fb6a8dc Mon Sep 17 00:00:00 2001 From: hap Date: Tue, 12 Dec 2023 19:47:42 +0100 Subject: misc: no need to always change cpuclock at reset when non-default port_changed takes care of it --- src/devices/bus/saitek_osa/maestro.cpp | 9 +++---- src/devices/bus/saitek_osa/maestro.h | 4 +-- src/devices/bus/saitek_osa/maestroa.cpp | 9 +++---- src/devices/bus/saitek_osa/maestroa.h | 4 +-- src/mame/chess/compuchess.cpp | 12 +++------ src/mame/chess/tasc.cpp | 12 ++++----- src/mame/fidelity/as12.cpp | 23 ++++++----------- src/mame/fidelity/csc.cpp | 40 +++++++----------------------- src/mame/fidelity/elite.cpp | 31 +++++++++-------------- src/mame/fidelity/sc12.cpp | 25 ++++++------------- src/mame/fidelity/sc9.cpp | 44 +++++++++------------------------ src/mame/hegenerglaser/brikett.cpp | 8 +++--- src/mame/hegenerglaser/modular_tm.cpp | 38 ++++++++++++++-------------- src/mame/layout/saitek_sstar28k.lay | 2 +- src/mame/layout/saitek_tstar432.lay | 23 ++--------------- src/mame/novag/cexpert.cpp | 13 ++++------ src/mame/novag/micro2.cpp | 9 ++++--- src/mame/novag/sexpert.cpp | 17 ++++++------- src/mame/saitek/companion2.cpp | 13 +++------- src/mame/saitek/corona.cpp | 2 +- src/mame/saitek/stratos.cpp | 12 ++++----- src/mame/saitek/stratos.h | 3 +-- 22 files changed, 119 insertions(+), 234 deletions(-) diff --git a/src/devices/bus/saitek_osa/maestro.cpp b/src/devices/bus/saitek_osa/maestro.cpp index 5a807ef49f5..8bfc102cf44 100644 --- a/src/devices/bus/saitek_osa/maestro.cpp +++ b/src/devices/bus/saitek_osa/maestro.cpp @@ -80,14 +80,13 @@ void saitekosa_maestro_device::device_start() void saitekosa_maestro_device::device_reset() { - set_cpu_freq(); control_w(0); } -void saitekosa_maestro_device::set_cpu_freq() +INPUT_CHANGED_MEMBER(saitekosa_maestro_device::change_cpu_freq) { static const XTAL xtal[6] = { 4_MHz_XTAL, 5.67_MHz_XTAL, 6_MHz_XTAL, 7.2_MHz_XTAL, 8_MHz_XTAL, 10_MHz_XTAL }; - m_maincpu->set_unscaled_clock(xtal[ioport("FAKE")->read() % 6]); + m_maincpu->set_unscaled_clock(xtal[newval % 6]); } @@ -201,8 +200,8 @@ const tiny_rom_entry *saitekosa_analyst_device::device_rom_region() const //------------------------------------------------- static INPUT_PORTS_START( maestro ) - PORT_START("FAKE") - PORT_CONFNAME( 0x07, 0x04, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, saitekosa_maestro_device, switch_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x07, 0x04, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, saitekosa_maestro_device, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "4MHz" ) PORT_CONFSETTING( 0x01, "5.67MHz" ) PORT_CONFSETTING( 0x02, "6MHz" ) diff --git a/src/devices/bus/saitek_osa/maestro.h b/src/devices/bus/saitek_osa/maestro.h index fb96539d34a..94af0d62571 100644 --- a/src/devices/bus/saitek_osa/maestro.h +++ b/src/devices/bus/saitek_osa/maestro.h @@ -26,7 +26,7 @@ public: // construction/destruction saitekosa_maestro_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); // from host virtual u8 data_r() override; @@ -61,8 +61,6 @@ protected: void xdata_w(u8 data); u8 ack_r(); void control_w(u8 data); - - void set_cpu_freq(); }; class saitekosa_analyst_device : public saitekosa_maestro_device diff --git a/src/devices/bus/saitek_osa/maestroa.cpp b/src/devices/bus/saitek_osa/maestroa.cpp index 9e1640e6ea9..525c828d6c8 100644 --- a/src/devices/bus/saitek_osa/maestroa.cpp +++ b/src/devices/bus/saitek_osa/maestroa.cpp @@ -50,14 +50,13 @@ void saitekosa_maestroa_device::device_start() void saitekosa_maestroa_device::device_reset() { - set_cpu_freq(); control_w(0); } -void saitekosa_maestroa_device::set_cpu_freq() +INPUT_CHANGED_MEMBER(saitekosa_maestroa_device::change_cpu_freq) { static const XTAL xtal[3] = { 4_MHz_XTAL, 5.67_MHz_XTAL, 6_MHz_XTAL }; - m_maincpu->set_unscaled_clock(xtal[ioport("FAKE")->read() % 3]); + m_maincpu->set_unscaled_clock(xtal[newval % 3]); } @@ -89,8 +88,8 @@ const tiny_rom_entry *saitekosa_maestroa_device::device_rom_region() const //------------------------------------------------- static INPUT_PORTS_START( maestroa ) - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x02, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, saitekosa_maestroa_device, switch_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x02, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, saitekosa_maestroa_device, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "4MHz" ) PORT_CONFSETTING( 0x01, "5.67MHz" ) PORT_CONFSETTING( 0x02, "6MHz" ) diff --git a/src/devices/bus/saitek_osa/maestroa.h b/src/devices/bus/saitek_osa/maestroa.h index 5e12703408e..9a1ade57a30 100644 --- a/src/devices/bus/saitek_osa/maestroa.h +++ b/src/devices/bus/saitek_osa/maestroa.h @@ -22,7 +22,7 @@ public: // construction/destruction saitekosa_maestroa_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); // from host virtual u8 data_r() override; @@ -49,8 +49,6 @@ private: void xdata_w(u8 data); u8 ack_r(); void control_w(u8 data); - - void set_cpu_freq(); }; diff --git a/src/mame/chess/compuchess.cpp b/src/mame/chess/compuchess.cpp index 6f0b2ffd1e6..df10ba398b4 100644 --- a/src/mame/chess/compuchess.cpp +++ b/src/mame/chess/compuchess.cpp @@ -131,7 +131,7 @@ public: { } DECLARE_INPUT_CHANGED_MEMBER(reset_switch) { update_reset(newval); } - DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq) { update_cpu_freq(newval); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); // machine configs void cmpchess(machine_config &config); @@ -166,7 +166,6 @@ private: TIMER_DEVICE_CALLBACK_MEMBER(blink) { m_blink = !m_blink; update_display(); } void update_display(); void update_reset(ioport_value state); - void update_cpu_freq(ioport_value state); // I/O handlers void input_w(u8 data); @@ -197,9 +196,6 @@ void cmpchess_state::machine_start() void cmpchess_state::machine_reset() { - if (ioport("FAKE") != nullptr) - update_cpu_freq(ioport("FAKE")->read()); - update_reset(ioport("RESET")->read()); } @@ -213,10 +209,10 @@ void cmpchess_state::update_reset(ioport_value state) m_display->clear(); } -void cmpchess_state::update_cpu_freq(ioport_value state) +INPUT_CHANGED_MEMBER(cmpchess_state::change_cpu_freq) { // 2 MK I versions, 2nd one was a lot faster - const u32 freq = state ? 3'500'000 : 2'250'000; + const u32 freq = (newval & 1) ? 3'500'000 : 2'250'000; m_maincpu->set_unscaled_clock(freq); subdevice("smi")->set_unscaled_clock(freq); } @@ -368,7 +364,7 @@ static INPUT_PORTS_START( mk1 ) PORT_MODIFY("RESET") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_OTHER) PORT_CODE(KEYCODE_F1) PORT_TOGGLE PORT_CHANGED_MEMBER(DEVICE_SELF, cmpchess_state, reset_switch, 0) PORT_NAME("L.S. Switch") - PORT_START("FAKE") + PORT_START("CPU") PORT_CONFNAME( 0x01, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, cmpchess_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "2.25MHz (Spassky packaging)" ) PORT_CONFSETTING( 0x01, "3.5MHz (Karpov packaging)" ) diff --git a/src/mame/chess/tasc.cpp b/src/mame/chess/tasc.cpp index 4c691890be5..4cfc9ad5926 100644 --- a/src/mame/chess/tasc.cpp +++ b/src/mame/chess/tasc.cpp @@ -90,7 +90,7 @@ public: void tasc(machine_config &config); - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); protected: virtual void machine_start() override; @@ -126,7 +126,6 @@ private: u8 nvram_r(offs_t offset) { return m_nvram[offset]; } void nvram_w(offs_t offset, u8 data) { m_nvram[offset] = data; } - void set_cpu_freq(); void install_bootrom(bool enable); TIMER_DEVICE_CALLBACK_MEMBER(disable_bootrom) { install_bootrom(false); } }; @@ -144,16 +143,15 @@ void tasc_state::machine_start() void tasc_state::machine_reset() { install_bootrom(true); - set_cpu_freq(); m_prev_pc = m_maincpu->pc(); m_prev_cycle = m_maincpu->total_cycles(); } -void tasc_state::set_cpu_freq() +INPUT_CHANGED_MEMBER(tasc_state::change_cpu_freq) { // R30 is 30MHz, R40 is 40MHz - m_maincpu->set_unscaled_clock((ioport("FAKE")->read() & 1) ? 40_MHz_XTAL : 30_MHz_XTAL); + m_maincpu->set_unscaled_clock((newval & 1) ? 40_MHz_XTAL : 30_MHz_XTAL); } @@ -288,8 +286,8 @@ static INPUT_PORTS_START( tasc ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DOWN) PORT_NAME("DOWN") PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("Right Clock") - PORT_START("FAKE") - PORT_CONFNAME( 0x01, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, tasc_state, switch_cpu_freq, 0) + PORT_START("CPU") + PORT_CONFNAME( 0x01, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, tasc_state, change_cpu_freq, 0) PORT_CONFSETTING( 0x00, "30MHz (R30)" ) PORT_CONFSETTING( 0x01, "40MHz (R40)" ) INPUT_PORTS_END diff --git a/src/mame/fidelity/as12.cpp b/src/mame/fidelity/as12.cpp index b8d86b3d9bd..8a62e87050b 100644 --- a/src/mame/fidelity/as12.cpp +++ b/src/mame/fidelity/as12.cpp @@ -68,12 +68,10 @@ public: void feleg(machine_config &config); void felega(machine_config &config); - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); protected: virtual void machine_start() override; - virtual void machine_reset() override; - void set_cpu_freq(); private: // devices/pointers @@ -104,18 +102,11 @@ void as12_state::machine_start() save_item(NAME(m_led_data)); } -void as12_state::machine_reset() -{ - set_cpu_freq(); - fidel_clockdiv_state::machine_reset(); -} - -void as12_state::set_cpu_freq() +INPUT_CHANGED_MEMBER(as12_state::change_cpu_freq) { // known official CPU speeds: 3MHz, 3.57MHz, 4MHz static const XTAL xtal[3] = { 3_MHz_XTAL, 3.579545_MHz_XTAL, 4_MHz_XTAL }; - m_maincpu->set_unscaled_clock(xtal[ioport("FAKE")->read() % 3]); - div_refresh(); + m_maincpu->set_unscaled_clock(xtal[newval % 3]); } @@ -209,8 +200,8 @@ static INPUT_PORTS_START( feleg ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("CL") PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_R) PORT_NAME("RE") - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x02, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, as12_state, switch_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x02, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, as12_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "3MHz (original)" ) PORT_CONFSETTING( 0x01, "3.57MHz (AS12)" ) PORT_CONFSETTING( 0x02, "4MHz (6085)" ) @@ -219,8 +210,8 @@ INPUT_PORTS_END static INPUT_PORTS_START( felega ) PORT_INCLUDE( feleg ) - PORT_MODIFY("FAKE") // default to 3.57MHz - PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, as12_state, switch_cpu_freq, 0) // factory set + PORT_MODIFY("CPU") // default to 3.57MHz + PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, as12_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "3MHz (original)" ) PORT_CONFSETTING( 0x01, "3.57MHz (AS12)" ) PORT_CONFSETTING( 0x02, "4MHz (6085)" ) diff --git a/src/mame/fidelity/csc.cpp b/src/mame/fidelity/csc.cpp index 3d0b477a83a..a56732cc374 100644 --- a/src/mame/fidelity/csc.cpp +++ b/src/mame/fidelity/csc.cpp @@ -248,8 +248,10 @@ public: void csc(machine_config &config); void csce(machine_config &config); void cscet(machine_config &config); + void su9(machine_config &config); void rsc(machine_config &config); + DECLARE_INPUT_CHANGED_MEMBER(su9_change_cpu_freq); DECLARE_INPUT_CHANGED_MEMBER(rsc_init_board); protected: @@ -303,35 +305,11 @@ void csc_state::machine_start() save_item(NAME(m_speech_bank)); } -// SU9 - -class su9_state : public csc_state -{ -public: - su9_state(const machine_config &mconfig, device_type type, const char *tag) : - csc_state(mconfig, type, tag) - { } - - void su9(machine_config &config); - - DECLARE_INPUT_CHANGED_MEMBER(su9_cpu_freq) { su9_set_cpu_freq(); } - -protected: - virtual void machine_reset() override; - void su9_set_cpu_freq(); -}; - -void su9_state::machine_reset() -{ - csc_state::machine_reset(); - su9_set_cpu_freq(); -} - -void su9_state::su9_set_cpu_freq() +INPUT_CHANGED_MEMBER(csc_state::su9_change_cpu_freq) { // SU9 CPU is clocked 1.95MHz, DS9 is 2.5MHz, SCC is 3MHz - u8 inp = ioport("FAKE")->read(); - m_maincpu->set_unscaled_clock((inp & 2) ? (3_MHz_XTAL) : ((inp & 1) ? (5_MHz_XTAL/2) : (3.9_MHz_XTAL/2))); + static const XTAL xtal[3] = { 3.9_MHz_XTAL/2, 5_MHz_XTAL/2, 3_MHz_XTAL }; + m_maincpu->set_unscaled_clock(xtal[newval % 3]); } @@ -588,8 +566,8 @@ static INPUT_PORTS_START( su9 ) PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("PV / Queen") PORT_BIT(0x20, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("PB / King") - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, su9_state, su9_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, csc_state, su9_change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "1.95MHz (original)" ) PORT_CONFSETTING( 0x01, "2.5MHz (Deluxe)" ) PORT_CONFSETTING( 0x02, "3MHz (Septennial)" ) @@ -675,7 +653,7 @@ void csc_state::cscet(machine_config &config) m_maincpu->set_clock(5_MHz_XTAL); } -void su9_state::su9(machine_config &config) +void csc_state::su9(machine_config &config) { csc(config); config.set_default_layout(layout_fidel_su9); @@ -862,6 +840,6 @@ SYST( 1981, csc, 0, 0, csc, csc, csc_state, empty_init, "Fi SYST( 1981, csce, 0, 0, csce, csc, csc_state, empty_init, "Fidelity Electronics", "Elite Champion Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) SYST( 1981, cscet, csce, 0, cscet, csc, csc_state, empty_init, "Fidelity Electronics", u8"Elite Champion Challenger (Travemünde TM version)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -SYST( 1983, super9cc, 0, 0, su9, su9, su9_state, empty_init, "Fidelity Electronics", "Super \"9\" Sensory Chess Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +SYST( 1983, super9cc, 0, 0, su9, su9, csc_state, empty_init, "Fidelity Electronics", "Super \"9\" Sensory Chess Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) SYST( 1981, reversic, 0, 0, rsc, rsc, csc_state, empty_init, "Fidelity Electronics", "Reversi Sensory Challenger", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) diff --git a/src/mame/fidelity/elite.cpp b/src/mame/fidelity/elite.cpp index 2c89dc81904..8ffb93a1d4c 100644 --- a/src/mame/fidelity/elite.cpp +++ b/src/mame/fidelity/elite.cpp @@ -119,12 +119,11 @@ public: void ewc(machine_config &config); void easc(machine_config &config); - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); protected: virtual void machine_start() override; - virtual void machine_reset() override; - void set_cpu_freq(); + virtual void machine_reset() override { fidel_clockdiv_state::machine_reset(); } // devices/pointers optional_device m_ppi8255; @@ -169,18 +168,11 @@ void elite_state::machine_start() save_item(NAME(m_speech_bank)); } -void elite_state::machine_reset() -{ - set_cpu_freq(); - fidel_clockdiv_state::machine_reset(); -} - -void elite_state::set_cpu_freq() +INPUT_CHANGED_MEMBER(elite_state::change_cpu_freq) { // known official CPU speeds: 3MHz(EAS), 3.57MHz(PC/EWC/Privat), 4MHz(PC/EAS-C) static const XTAL xtal[3] = { 3_MHz_XTAL, 3.579545_MHz_XTAL, 4_MHz_XTAL }; - m_maincpu->set_unscaled_clock(xtal[ioport("FAKE")->read() % 3]); - div_refresh(); + m_maincpu->set_unscaled_clock(xtal[newval % 3]); } // EAG @@ -216,7 +208,8 @@ void eag_state::init_eag2100() void eag_state::machine_reset() { - fidel_clockdiv_state::machine_reset(); + elite_state::machine_reset(); + if (m_rombank != nullptr) m_rombank->set_entry(0); } @@ -409,8 +402,8 @@ static INPUT_PORTS_START( eas ) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_DEL) PORT_NAME("CL") PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_V) PORT_NAME("RV") - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, elite_state, switch_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, elite_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "3MHz (EAS)" ) PORT_CONFSETTING( 0x01, "3.57MHz (EWC)" ) PORT_CONFSETTING( 0x02, "4MHz (EAS-C)" ) @@ -419,8 +412,8 @@ INPUT_PORTS_END static INPUT_PORTS_START( ewc ) PORT_INCLUDE( eas ) - PORT_MODIFY("FAKE") // default to 3.57MHz - PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, elite_state, switch_cpu_freq, 0) // factory set + PORT_MODIFY("CPU") // default to 3.57MHz + PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, elite_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "3MHz (EAS)" ) PORT_CONFSETTING( 0x01, "3.57MHz (EWC)" ) PORT_CONFSETTING( 0x02, "4MHz (EAS-C)" ) @@ -429,8 +422,8 @@ INPUT_PORTS_END static INPUT_PORTS_START( easc ) PORT_INCLUDE( eas ) - PORT_MODIFY("FAKE") // default to 4MHz - PORT_CONFNAME( 0x03, 0x02, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, elite_state, switch_cpu_freq, 0) // factory set + PORT_MODIFY("CPU") // default to 4MHz + PORT_CONFNAME( 0x03, 0x02, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, elite_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "3MHz (EAS)" ) PORT_CONFSETTING( 0x01, "3.57MHz (EWC)" ) PORT_CONFSETTING( 0x02, "4MHz (EAS-C)" ) diff --git a/src/mame/fidelity/sc12.cpp b/src/mame/fidelity/sc12.cpp index c9d0423693f..3bd21b9c76d 100644 --- a/src/mame/fidelity/sc12.cpp +++ b/src/mame/fidelity/sc12.cpp @@ -89,12 +89,10 @@ public: void sc12(machine_config &config); void sc12b(machine_config &config); - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); protected: virtual void machine_start() override; - virtual void machine_reset() override; - void set_cpu_freq(); private: // devices/pointers @@ -121,18 +119,11 @@ void sc12_state::machine_start() save_item(NAME(m_inp_mux)); } -void sc12_state::machine_reset() -{ - set_cpu_freq(); - fidel_clockdiv_state::machine_reset(); -} - -void sc12_state::set_cpu_freq() +INPUT_CHANGED_MEMBER(sc12_state::change_cpu_freq) { // known official CPU speeds: 3MHz, 3.57MHz, 4MHz static const XTAL xtal[3] = { 3_MHz_XTAL, 3.579545_MHz_XTAL, 4_MHz_XTAL }; - m_maincpu->set_unscaled_clock(xtal[ioport("FAKE")->read() % 3]); - div_refresh(); + m_maincpu->set_unscaled_clock(xtal[newval % 3]); } @@ -214,8 +205,8 @@ static INPUT_PORTS_START( sc12 ) PORT_INCLUDE( fidel_clockdiv_2 ) PORT_INCLUDE( sc12_base ) - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sc12_state, switch_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sc12_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "3MHz (SC12)" ) PORT_CONFSETTING( 0x01, "3.57MHz (SE12)" ) PORT_CONFSETTING( 0x02, "4MHz (6086)" ) @@ -225,8 +216,8 @@ static INPUT_PORTS_START( sc12b ) PORT_INCLUDE( fidel_clockdiv_4 ) PORT_INCLUDE( sc12_base ) - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x02, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sc12_state, switch_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x02, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sc12_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "3MHz (SC12)" ) PORT_CONFSETTING( 0x01, "3.57MHz (SE12)" ) PORT_CONFSETTING( 0x02, "4MHz (6086)" ) @@ -268,8 +259,6 @@ void sc12_state::sc12(machine_config &config) void sc12_state::sc12b(machine_config &config) { sc12(config); - - // basic machine hardware m_maincpu->set_clock(4_MHz_XTAL); // R65C02P4 } diff --git a/src/mame/fidelity/sc9.cpp b/src/mame/fidelity/sc9.cpp index 94322672575..bdc23721407 100644 --- a/src/mame/fidelity/sc9.cpp +++ b/src/mame/fidelity/sc9.cpp @@ -84,6 +84,8 @@ public: void sc9d(machine_config &config); void playmatic(machine_config &config); + DECLARE_INPUT_CHANGED_MEMBER(sc9c_change_cpu_freq); + protected: virtual void machine_start() override; @@ -116,33 +118,11 @@ void sc9_state::machine_start() save_item(NAME(m_led_data)); } -// SC9C - -class sc9c_state : public sc9_state -{ -public: - sc9c_state(const machine_config &mconfig, device_type type, const char *tag) : - sc9_state(mconfig, type, tag) - { } - - DECLARE_INPUT_CHANGED_MEMBER(sc9c_cpu_freq) { sc9c_set_cpu_freq(); } - -protected: - virtual void machine_reset() override; - void sc9c_set_cpu_freq(); -}; - -void sc9c_state::machine_reset() -{ - sc9_state::machine_reset(); - sc9c_set_cpu_freq(); -} - -void sc9c_state::sc9c_set_cpu_freq() +INPUT_CHANGED_MEMBER(sc9_state::sc9c_change_cpu_freq) { // SC9(C01) was released with 1.5MHz, 1.6MHz, or 1.9MHz CPU - u8 inp = ioport("FAKE")->read(); - m_maincpu->set_unscaled_clock((inp & 2) ? 1'900'000 : ((inp & 1) ? 1'600'000 : 1'500'000)); + static const u32 freq[3] = { 1'500'000, 1'600'000, 1'900'000 }; + m_maincpu->set_unscaled_clock(freq[newval % 3]); } @@ -244,8 +224,8 @@ INPUT_PORTS_END static INPUT_PORTS_START( sc9c ) PORT_INCLUDE( sc9 ) - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sc9c_state, sc9c_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sc9_state, sc9c_change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "1.5MHz" ) PORT_CONFSETTING( 0x01, "1.6MHz" ) PORT_CONFSETTING( 0x02, "1.9MHz" ) @@ -342,8 +322,8 @@ ROM_END Drivers *******************************************************************************/ -// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS -SYST( 1982, fscc9, 0, 0, sc9d, sc9, sc9_state, empty_init, "Fidelity Electronics", "Sensory Chess Challenger \"9\" (rev. D)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // aka version "B" -SYST( 1982, fscc9b, fscc9, 0, sc9b, sc9, sc9_state, empty_init, "Fidelity Electronics", "Sensory Chess Challenger \"9\" (rev. B)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -SYST( 1982, fscc9c, fscc9, 0, sc9b, sc9c, sc9c_state, empty_init, "Fidelity Electronics", "Sensory Chess Challenger \"9\" (rev. C)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -SYST( 1983, fscc9ps, fscc9, 0, playmatic, sc9, sc9_state, empty_init, "Fidelity Deutschland", "Sensory 9 Playmatic S", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // 9 is not between quotation marks here +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS +SYST( 1982, fscc9, 0, 0, sc9d, sc9, sc9_state, empty_init, "Fidelity Electronics", "Sensory Chess Challenger \"9\" (rev. D)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // aka version "B" +SYST( 1982, fscc9b, fscc9, 0, sc9b, sc9, sc9_state, empty_init, "Fidelity Electronics", "Sensory Chess Challenger \"9\" (rev. B)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +SYST( 1982, fscc9c, fscc9, 0, sc9b, sc9c, sc9_state, empty_init, "Fidelity Electronics", "Sensory Chess Challenger \"9\" (rev. C)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +SYST( 1983, fscc9ps, fscc9, 0, playmatic, sc9, sc9_state, empty_init, "Fidelity Deutschland", "Sensory 9 Playmatic S", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // 9 is not between quotation marks here diff --git a/src/mame/hegenerglaser/brikett.cpp b/src/mame/hegenerglaser/brikett.cpp index 05bb6a5ecf4..f2de6825cd7 100644 --- a/src/mame/hegenerglaser/brikett.cpp +++ b/src/mame/hegenerglaser/brikett.cpp @@ -111,7 +111,7 @@ public: { } DECLARE_INPUT_CHANGED_MEMBER(reset_button) { if (newval) machine_reset(); } - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq) { set_cpu_freq(); } // machine configs void mephisto(machine_config &config); @@ -369,10 +369,10 @@ static INPUT_PORTS_START( mephisto ) PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_H) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("H / 8") PORT_START("IN.4") // 2nd model main PCB has 2 XTALs on PCB - PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, brikett_state, switch_cpu_freq, 0) PORT_CONDITION("IN.4", 0x30, NOTEQUALS, 0x00) + PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, brikett_state, change_cpu_freq, 0) PORT_CONDITION("IN.4", 0x30, NOTEQUALS, 0x00) PORT_CONFSETTING( 0x00, "3.579MHz (Battery)" ) PORT_CONFSETTING( 0x01, "6.144MHz (Mains)" ) - PORT_CONFNAME( 0x70, 0x40, "Base Hardware" ) PORT_CHANGED_MEMBER(DEVICE_SELF, brikett_state, switch_cpu_freq, 0) + PORT_CONFNAME( 0x70, 0x40, "Base Hardware" ) PORT_CHANGED_MEMBER(DEVICE_SELF, brikett_state, change_cpu_freq, 0) PORT_CONFSETTING( 0x40, "1st Model (1980)" ) PORT_CONFSETTING( 0x70, "2nd Model (1982)" ) @@ -417,7 +417,7 @@ static INPUT_PORTS_START( mephisto3 ) PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_M) PORT_NAME("MEM") PORT_MODIFY("IN.4") - PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, brikett_state, switch_cpu_freq, 0) + PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, brikett_state, change_cpu_freq, 0) PORT_CONFSETTING( 0x00, "3.579MHz (Battery)" ) PORT_CONFSETTING( 0x01, "6.144MHz (Mains)" ) PORT_CONFSETTING( 0x02, "12MHz (Special)" ) diff --git a/src/mame/hegenerglaser/modular_tm.cpp b/src/mame/hegenerglaser/modular_tm.cpp index 1f5522a3f73..3df14aee77b 100644 --- a/src/mame/hegenerglaser/modular_tm.cpp +++ b/src/mame/hegenerglaser/modular_tm.cpp @@ -33,7 +33,7 @@ V(Verkauf?) home version: - 8*8 LEDs, magnets chessboard T(Turnier) tournament version: (differences) -- XC68030RC50B, CPU frequency tuned for tournament (see set_cpu_freq) +- XC68030RC50B, CPU frequency tuned for tournament (see change_cpu_freq) - 3 more 2MB DRAM rows After boot, it copies ROM to RAM, probably to circumvent waitstates on slow ROM. @@ -64,15 +64,14 @@ public: m_rom(*this, "maincpu"), m_mainram(*this, "mainram"), m_nvram(*this, "nvram", 0x2000, ENDIANNESS_BIG), - m_disable_bootrom(*this, "disable_bootrom"), - m_fake(*this, "FAKE") + m_disable_bootrom(*this, "disable_bootrom") { } // machine configs void mmtm_v(machine_config &config); void mmtm_t(machine_config &config); - DECLARE_INPUT_CHANGED_MEMBER(cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); protected: virtual void machine_start() override; @@ -86,7 +85,6 @@ private: required_shared_ptr m_mainram; memory_share_creator m_nvram; required_device m_disable_bootrom; - optional_ioport m_fake; bool m_bootrom_enabled = false; @@ -99,10 +97,14 @@ private: void install_bootrom(bool enable); TIMER_DEVICE_CALLBACK_MEMBER(disable_bootrom) { install_bootrom(false); } - - void set_cpu_freq(); }; + + +/******************************************************************************* + Initialization +*******************************************************************************/ + void mmtm_state::machine_start() { save_item(NAME(m_bootrom_enabled)); @@ -110,8 +112,6 @@ void mmtm_state::machine_start() void mmtm_state::machine_reset() { - set_cpu_freq(); - // disable bootrom after reset install_bootrom(true); m_disable_bootrom->adjust(m_maincpu->cycles_to_attotime(50)); @@ -130,18 +130,16 @@ void mmtm_state::install_bootrom(bool enable) m_bootrom_enabled = enable; } -void mmtm_state::set_cpu_freq() +INPUT_CHANGED_MEMBER(mmtm_state::change_cpu_freq) { // "Mephisto X" were usually overclocked at tournaments // rare versions sold to fans seen overclocked at 60MHz or 66MHz // default frequency of TM version is 50MHz (also matches beeper pitch with V version) - ioport_value val = m_fake.read_safe(0); - - static const XTAL xtal[] = { 36_MHz_XTAL, 50_MHz_XTAL, 60_MHz_XTAL, 66_MHz_XTAL }; - m_maincpu->set_unscaled_clock(xtal[val]); + static const XTAL xtal[3] = { 50_MHz_XTAL, 60_MHz_XTAL, 66_MHz_XTAL }; + m_maincpu->set_unscaled_clock(xtal[newval % 3]); // lcd busy flag timing problem when overclocked - subdevice("display:hd44780")->set_clock_scale((val > 1) ? 1.32 : 1.0); + subdevice("display:hd44780")->set_clock_scale((newval == 0) ? 1.0 : 1.32); } @@ -197,11 +195,11 @@ INPUT_PORTS_END static INPUT_PORTS_START( mmtm_t ) PORT_INCLUDE( mmtm_v ) - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, mmtm_state, cpu_freq, 0) - PORT_CONFSETTING( 0x01, "50MHz" ) - PORT_CONFSETTING( 0x02, "60MHz" ) - PORT_CONFSETTING( 0x03, "66MHz" ) + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, mmtm_state, change_cpu_freq, 0) + PORT_CONFSETTING( 0x00, "50MHz" ) + PORT_CONFSETTING( 0x01, "60MHz" ) + PORT_CONFSETTING( 0x02, "66MHz" ) INPUT_PORTS_END diff --git a/src/mame/layout/saitek_sstar28k.lay b/src/mame/layout/saitek_sstar28k.lay index 5a9d35a1d00..3533313816a 100644 --- a/src/mame/layout/saitek_sstar28k.lay +++ b/src/mame/layout/saitek_sstar28k.lay @@ -339,7 +339,7 @@ license:CC0-1.0 - + diff --git a/src/mame/layout/saitek_tstar432.lay b/src/mame/layout/saitek_tstar432.lay index 814cb955679..9bae91958b4 100644 --- a/src/mame/layout/saitek_tstar432.lay +++ b/src/mame/layout/saitek_tstar432.lay @@ -350,29 +350,10 @@ license:CC0-1.0 - + - - - - - - - - - - - - - - - - - - - - + diff --git a/src/mame/novag/cexpert.cpp b/src/mame/novag/cexpert.cpp index d16041ed674..510d5af2ca5 100644 --- a/src/mame/novag/cexpert.cpp +++ b/src/mame/novag/cexpert.cpp @@ -53,11 +53,10 @@ public: // machine configs void cexpert(machine_config &config); - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); protected: virtual void machine_start() override; - virtual void machine_reset() override { set_cpu_freq(); } private: // devices/pointers @@ -70,8 +69,6 @@ private: u8 m_inp_mux = 0; u8 m_led_select = 0; - void set_cpu_freq(); - // address maps void main_map(address_map &map); @@ -90,10 +87,10 @@ void cexpert_state::machine_start() save_item(NAME(m_led_select)); } -void cexpert_state::set_cpu_freq() +INPUT_CHANGED_MEMBER(cexpert_state::change_cpu_freq) { // old version had a 4MHz CPU - m_maincpu->set_unscaled_clock((ioport("FAKE")->read() & 1) ? (10_MHz_XTAL/2) : (8_MHz_XTAL/2)); + m_maincpu->set_unscaled_clock((newval & 1) ? (10_MHz_XTAL/2) : (8_MHz_XTAL/2)); } @@ -207,8 +204,8 @@ static INPUT_PORTS_START( cexpert ) PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_Q) PORT_NAME("Go") PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_1) PORT_NAME("Take Back / Restore") - PORT_START("FAKE") - PORT_CONFNAME( 0x01, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, cexpert_state, switch_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x01, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, cexpert_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "4MHz" ) PORT_CONFSETTING( 0x01, "5MHz" ) INPUT_PORTS_END diff --git a/src/mame/novag/micro2.cpp b/src/mame/novag/micro2.cpp index f86b85ba75e..0175b9df1c3 100644 --- a/src/mame/novag/micro2.cpp +++ b/src/mame/novag/micro2.cpp @@ -109,9 +109,10 @@ void micro2_state::machine_start() void micro2_state::set_cpu_freq() { // known CPU speeds: 6MHz(XTAL), 6MHz(LC), 12MHz(LC) - u32 clock = (ioport("FAKE")->read() & 1) ? 12'000'000 : 6'000'000; - m_board->set_delay(attotime::from_ticks(2'000'000, clock)); // see TODO - m_maincpu->set_unscaled_clock(clock); + u32 freq = (ioport("CPU")->read() & 1) ? 12'000'000 : 6'000'000; + m_maincpu->set_unscaled_clock(freq); + + m_board->set_delay(attotime::from_ticks(2'000'000, freq)); // see TODO } @@ -181,7 +182,7 @@ static INPUT_PORTS_START( micro2 ) PORT_BIT(0x40, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_CODE(KEYCODE_T) PORT_NAME("Take Back / King") PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_CODE(KEYCODE_G) PORT_NAME("Go") - PORT_START("FAKE") + PORT_START("CPU") PORT_CONFNAME( 0x01, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, micro2_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "6MHz (original)" ) PORT_CONFSETTING( 0x01, "12MHz (Octo)" ) diff --git a/src/mame/novag/sexpert.cpp b/src/mame/novag/sexpert.cpp index 42aa61025e9..ef1598bfa51 100644 --- a/src/mame/novag/sexpert.cpp +++ b/src/mame/novag/sexpert.cpp @@ -84,7 +84,7 @@ public: void init_sexpert(); - DECLARE_INPUT_CHANGED_MEMBER(sexpert_cpu_freq) { sexpert_set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); protected: virtual void machine_start() override; @@ -107,8 +107,6 @@ protected: u8 m_lcd_control = 0; u8 m_lcd_data = 0; - void sexpert_set_cpu_freq(); - // address maps void sexpert_map(address_map &map); @@ -134,15 +132,14 @@ void sexpert_state::machine_start() save_item(NAME(m_lcd_data)); } -void sexpert_state::sexpert_set_cpu_freq() +INPUT_CHANGED_MEMBER(sexpert_state::change_cpu_freq) { // machines were released with either 5MHz or 6MHz CPU - m_maincpu->set_unscaled_clock((ioport("FAKE")->read() & 1) ? (12_MHz_XTAL/2) : (10_MHz_XTAL/2)); + m_maincpu->set_unscaled_clock((newval & 1) ? (12_MHz_XTAL/2) : (10_MHz_XTAL/2)); } void sexpert_state::machine_reset() { - sexpert_set_cpu_freq(); m_rombank->set_entry(0); } @@ -396,8 +393,8 @@ static INPUT_PORTS_START( sexpert ) PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_I) PORT_NAME("Player/Player / Gambit Book / King") PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_8) PORT_NAME("Print Board / Interface") - PORT_START("FAKE") - PORT_CONFNAME( 0x01, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sexpert_state, sexpert_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x01, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sexpert_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "5MHz" ) PORT_CONFSETTING( 0x01, "6MHz" ) INPUT_PORTS_END @@ -405,8 +402,8 @@ INPUT_PORTS_END static INPUT_PORTS_START( sexpertb ) PORT_INCLUDE( sexpert ) - PORT_MODIFY("FAKE") // default CPU for B/C is W65C802P-6 @ 6MHz - PORT_CONFNAME( 0x01, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sexpert_state, sexpert_cpu_freq, 0) // factory set + PORT_MODIFY("CPU") // default CPU for B/C is W65C802P-6 @ 6MHz + PORT_CONFNAME( 0x01, 0x01, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, sexpert_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "5MHz" ) PORT_CONFSETTING( 0x01, "6MHz" ) INPUT_PORTS_END diff --git a/src/mame/saitek/companion2.cpp b/src/mame/saitek/companion2.cpp index 1e4f972de01..0ae6f6b899b 100644 --- a/src/mame/saitek/companion2.cpp +++ b/src/mame/saitek/companion2.cpp @@ -106,12 +106,11 @@ public: void compan2(machine_config &config); DECLARE_INPUT_CHANGED_MEMBER(power_off); - DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); protected: virtual void machine_start() override; virtual void machine_reset() override; - DECLARE_MACHINE_RESET(compan2) { machine_reset(); set_cpu_freq(); } private: // devices/pointers @@ -133,7 +132,6 @@ private: u8 power_r(); void led_w(u8 data); - void set_cpu_freq(); TIMER_CALLBACK_MEMBER(set_pin); }; @@ -147,10 +145,10 @@ void compan2_state::machine_start() save_item(NAME(m_inp_mux)); } -void compan2_state::set_cpu_freq() +INPUT_CHANGED_MEMBER(compan2_state::change_cpu_freq) { // Concord II MCU speed is around twice higher - m_maincpu->set_unscaled_clock((ioport("FAKE")->read() & 1) ? 7'200'000 : 4'000'000); + m_maincpu->set_unscaled_clock((newval & 1) ? 7'200'000 : 4'000'000); } @@ -328,7 +326,7 @@ static INPUT_PORTS_START( compan2 ) PORT_MODIFY("IN.2") PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_CUSTOM) // button config - PORT_START("FAKE") + PORT_START("CPU") PORT_CONFNAME( 0x01, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, compan2_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "4MHz (original)" ) PORT_CONFSETTING( 0x01, "7.2MHz (Concord II)" ) @@ -383,9 +381,6 @@ void compan2_state::expchess(machine_config &config) void compan2_state::compan2(machine_config &config) { expchess(config); - - // basic machine hardware - MCFG_MACHINE_RESET_OVERRIDE(compan2_state, compan2) config.set_default_layout(layout_saitek_companion2); } diff --git a/src/mame/saitek/corona.cpp b/src/mame/saitek/corona.cpp index 450d5d3ed0d..1c515c567cb 100644 --- a/src/mame/saitek/corona.cpp +++ b/src/mame/saitek/corona.cpp @@ -260,7 +260,7 @@ INPUT_PORTS_END void corona_state::corona(machine_config &config) { // basic machine hardware - M65C02(config, m_maincpu, 5_MHz_XTAL); // see set_cpu_freq + M65C02(config, m_maincpu, 5_MHz_XTAL); // see change_cpu_freq m_maincpu->set_addrmap(AS_PROGRAM, &corona_state::main_map); m_maincpu->set_periodic_int(FUNC(corona_state::irq0_line_hold), attotime::from_hz(183)); diff --git a/src/mame/saitek/stratos.cpp b/src/mame/saitek/stratos.cpp index ad2cd5f235b..83d064476eb 100644 --- a/src/mame/saitek/stratos.cpp +++ b/src/mame/saitek/stratos.cpp @@ -144,16 +144,14 @@ void saitek_stratos_state::machine_reset() m_lcd_ready = false; m_lcd_count = 0; clear_lcd(); - - set_cpu_freq(); } -void saitek_stratos_state::set_cpu_freq() +INPUT_CHANGED_MEMBER(saitek_stratos_state::change_cpu_freq) { // known officially* released CPU speeds: 5MHz, 5.626MHz, 5.67MHz // *not including reseller overclocks, user mods, or the "Turbo Kit" static const XTAL xtal[3] = { 5_MHz_XTAL, 5.626_MHz_XTAL, 5.67_MHz_XTAL }; - m_maincpu->set_unscaled_clock(xtal[ioport("FAKE")->read() % 3]); + m_maincpu->set_unscaled_clock(xtal[newval % 3]); } // stratos_state @@ -420,8 +418,8 @@ INPUT_PORTS_START( saitek_stratos ) PORT_START("RESET") PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYPAD) PORT_CODE(KEYCODE_A) PORT_CHANGED_MEMBER(DEVICE_SELF, saitek_stratos_state, go_button, 0) PORT_NAME("Go") - PORT_START("FAKE") - PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, saitek_stratos_state, switch_cpu_freq, 0) // factory set + PORT_START("CPU") + PORT_CONFNAME( 0x03, 0x00, "CPU Frequency" ) PORT_CHANGED_MEMBER(DEVICE_SELF, saitek_stratos_state, change_cpu_freq, 0) // factory set PORT_CONFSETTING( 0x00, "5MHz" ) PORT_CONFSETTING( 0x01, "5.626MHz" ) PORT_CONFSETTING( 0x02, "5.67MHz" ) @@ -490,7 +488,7 @@ INPUT_PORTS_END void stratos_state::stratos(machine_config &config) { // basic machine hardware - M65C02(config, m_maincpu, 5_MHz_XTAL); // see set_cpu_freq + M65C02(config, m_maincpu, 5_MHz_XTAL); // see change_cpu_freq m_maincpu->set_addrmap(AS_PROGRAM, &stratos_state::main_map); m_maincpu->set_periodic_int(FUNC(stratos_state::irq0_line_hold), attotime::from_hz(76)); diff --git a/src/mame/saitek/stratos.h b/src/mame/saitek/stratos.h index 78d475d27cb..25ab5c7732d 100644 --- a/src/mame/saitek/stratos.h +++ b/src/mame/saitek/stratos.h @@ -28,7 +28,7 @@ public: m_out_lcd(*this, "lcd%u.%u.%u", 0U, 0U, 0U) { } - DECLARE_INPUT_CHANGED_MEMBER(switch_cpu_freq) { set_cpu_freq(); } + DECLARE_INPUT_CHANGED_MEMBER(change_cpu_freq); DECLARE_INPUT_CHANGED_MEMBER(go_button); protected: @@ -52,7 +52,6 @@ protected: void clear_lcd() { std::fill(std::begin(m_lcd_data), std::end(m_lcd_data), 0); } void update_lcd(); void power_off(); - void set_cpu_freq(); void lcd_data_w(u8 data); }; -- cgit v1.2.3