diff options
author | Aaron Giles <aaron@aarongiles.com> | 2021-08-13 19:27:10 -0700 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2021-08-13 19:27:10 -0700 |
commit | 5c34e3f00cfd5974a0ea36bacacb719186251a3f (patch) | |
tree | f8c6c90df70779e655f22a54ea7c5093724679a2 | |
parent | 83a46d505ccd6dcbbd9c3ea2b8c02f177e1243d4 (diff) |
Update recently modified files to new APIs
30 files changed, 117 insertions, 78 deletions
diff --git a/src/devices/bus/a2bus/a2pic.cpp b/src/devices/bus/a2bus/a2pic.cpp index b6f2d6e0568..b4890a67423 100644 --- a/src/devices/bus/a2bus/a2pic.cpp +++ b/src/devices/bus/a2bus/a2pic.cpp @@ -67,7 +67,6 @@ a2bus_pic_device::a2bus_pic_device(machine_config const &mconfig, char const *ta m_input_sw1(*this, "SW1"), m_input_x(*this, "X"), m_prom(*this, "prom"), - m_strobe_timer(nullptr), m_firmware_base(0x0000U), m_data_latch(0x00U), m_autostrobe_disable(0U), @@ -88,7 +87,7 @@ a2bus_pic_device::a2bus_pic_device(machine_config const &mconfig, char const *ta INPUT_CHANGED_MEMBER(a2bus_pic_device::sw1_strobe) { - m_printer_conn->write_strobe(BIT(m_input_sw1->read(), 3) ^ (m_strobe_timer->enabled() ? 0U : 1U)); + m_printer_conn->write_strobe(BIT(m_input_sw1->read(), 3) ^ (m_strobe_timer.enabled() ? 0U : 1U)); } @@ -181,21 +180,19 @@ void a2bus_pic_device::write_c0nx(u8 offset, u8 data) { // latch output data and start strobe if autostrobe is enabled LOG("Latch data %02X\n", data); - machine().scheduler().synchronize( - timer_expired_delegate(FUNC(a2bus_pic_device::data_write), this), - unsigned(data) | (1 << 8) | ((m_autostrobe_disable ? 0 : 1) << 9)); + m_data_write.synchronize(unsigned(data) | (1 << 8) | ((m_autostrobe_disable ? 0 : 1) << 9)); } else { // just start strobe if autostrobe is enabled LOG("Output disabled, not latching data\n"); if (!m_autostrobe_disable) - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_pic_device::data_write), this), 1 << 9); + m_data_write.synchronize(1 << 9); } break; case 2U: - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_pic_device::data_write), this), 1 << 9); + m_data_write.synchronize(1 << 9); break; case 5U: @@ -276,7 +273,12 @@ ioport_constructor a2bus_pic_device::device_input_ports() const void a2bus_pic_device::device_start() { - m_strobe_timer = timer_alloc(*this, FUNC(a2bus_pic_device::release_strobe)); + m_strobe_timer.init(*this, FUNC(a2bus_pic_device::release_strobe)); + m_set_ack_in.init(*this, FUNC(a2bus_pic_device::set_ack_in)); + m_set_perror_in.init(*this, FUNC(a2bus_pic_device::set_perror_in)); + m_set_select_in.init(*this, FUNC(a2bus_pic_device::set_select_in)); + m_set_fault_in.init(*this, FUNC(a2bus_pic_device::set_fault_in)); + m_data_write.init(*this, FUNC(a2bus_pic_device::data_write)); m_firmware_base = 0x0100U; m_data_latch = 0xffU; @@ -306,7 +308,7 @@ void a2bus_pic_device::device_reset() m_printer_out->write(0x00U); } - m_printer_conn->write_strobe(BIT(sw1, 3) ^ (m_strobe_timer->enabled() ? 0U : 1U)); + m_printer_conn->write_strobe(BIT(sw1, 3) ^ (m_strobe_timer.enabled() ? 0U : 1U)); reset_mode(); } @@ -319,25 +321,25 @@ void a2bus_pic_device::device_reset() WRITE_LINE_MEMBER(a2bus_pic_device::ack_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_pic_device::set_ack_in), this), state ? 1 : 0); + m_set_ack_in.synchronize(state ? 1 : 0); } WRITE_LINE_MEMBER(a2bus_pic_device::perror_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_pic_device::set_perror_in), this), state ? 1 : 0); + m_set_perror_in.synchronize(state ? 1 : 0); } WRITE_LINE_MEMBER(a2bus_pic_device::select_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_pic_device::set_select_in), this), state ? 1 : 0); + m_set_select_in.synchronize(state ? 1 : 0); } WRITE_LINE_MEMBER(a2bus_pic_device::fault_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_pic_device::set_fault_in), this), state ? 1 : 0); + m_set_fault_in.synchronize(state ? 1 : 0); } @@ -419,7 +421,7 @@ void a2bus_pic_device::data_write(void *ptr, s32 param) ioport_value const sw1(m_input_sw1->read()); unsigned const cycles(15U - ((sw1 & 0x07U) << 1)); int const state(BIT(sw1, 3)); - if (!m_strobe_timer->enabled()) + if (!m_strobe_timer.enabled()) { LOG("Output /STROBE=%d for %u cycles\n", state, cycles); clear_ack_latch(); @@ -429,7 +431,7 @@ void a2bus_pic_device::data_write(void *ptr, s32 param) { LOG("Adjust /STROBE=%d remaining to %u cycles\n", state, cycles); } - m_strobe_timer->adjust(attotime::from_ticks(cycles * 7, clock())); + m_strobe_timer.adjust(attotime::from_ticks(cycles * 7, clock())); } } @@ -453,7 +455,7 @@ void a2bus_pic_device::reset_mode() void a2bus_pic_device::set_ack_latch() { - if (m_strobe_timer->enabled()) + if (m_strobe_timer.enabled()) { LOG("Active strobe prevents acknowledge latch from being set\n"); } diff --git a/src/devices/bus/a2bus/a2pic.h b/src/devices/bus/a2bus/a2pic.h index 80a0a247027..3e2ed9d9d40 100644 --- a/src/devices/bus/a2bus/a2pic.h +++ b/src/devices/bus/a2bus/a2pic.h @@ -110,7 +110,12 @@ private: required_ioport m_input_sw1; required_ioport m_input_x; required_region_ptr<u8> m_prom; - emu_timer * m_strobe_timer; + persistent_timer m_strobe_timer; + transient_timer_factory m_set_ack_in; + transient_timer_factory m_set_perror_in; + transient_timer_factory m_set_select_in; + transient_timer_factory m_set_fault_in; + transient_timer_factory m_data_write; u16 m_firmware_base; // controlled by SW6 u8 m_data_latch; // 9B diff --git a/src/devices/bus/a2bus/grappler.cpp b/src/devices/bus/a2bus/grappler.cpp index e842acb21a6..cf515504adf 100644 --- a/src/devices/bus/a2bus/grappler.cpp +++ b/src/devices/bus/a2bus/grappler.cpp @@ -134,6 +134,10 @@ void a2bus_grappler_device_base::device_add_mconfig(machine_config &config) void a2bus_grappler_device_base::device_start() { + m_set_busy_in.init(*this, FUNC(a2bus_grappler_device_base::set_busy_in)); + m_set_pe_in.init(*this, FUNC(a2bus_grappler_device_base::set_pe_in)); + m_set_slct_in.init(*this, FUNC(a2bus_grappler_device_base::set_slct_in)); + save_item(NAME(m_rom_bank)); save_item(NAME(m_busy_in)); save_item(NAME(m_pe_in)); @@ -161,19 +165,19 @@ void a2bus_grappler_device_base::set_rom_bank(u16 rom_bank) WRITE_LINE_MEMBER(a2bus_grappler_device_base::busy_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device_base::set_busy_in), this), state ? 1 : 0); + m_set_busy_in.synchronize(state ? 1 : 0); } WRITE_LINE_MEMBER(a2bus_grappler_device_base::pe_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device_base::set_pe_in), this), state ? 1 : 0); + m_set_pe_in.synchronize(state ? 1 : 0); } WRITE_LINE_MEMBER(a2bus_grappler_device_base::slct_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device_base::set_slct_in), this), state ? 1 : 0); + m_set_slct_in.synchronize(state ? 1 : 0); } @@ -238,9 +242,9 @@ u8 a2bus_grappler_device::read_c0nx(u8 offset) if (!machine().side_effects_disabled()) { if (BIT(offset, 1)) // A1 - assert strobe - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device::set_strobe), this), 0); + m_set_strobe.synchronize(0); else if (BIT(offset, 2)) // A2 - release strobe - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device::set_strobe), this), 1); + m_set_strobe.synchronize(1); } if (BIT(offset, 0)) // A0 - printer status @@ -264,12 +268,12 @@ void a2bus_grappler_device::write_c0nx(u8 offset, u8 data) LOG("Write C0n%01X=%02X\n", offset, data); if (BIT(offset, 0)) // A0 - write data - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device::set_data), this), int(unsigned(data))); + m_set_data.synchronize(int(unsigned(data))); if (BIT(offset, 1)) // A1 - assert strobe - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device::set_strobe), this), 0); + m_set_strobe.synchronize(0); else if (BIT(offset, 2)) // A2 - release strobe - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device::set_strobe), this), 1); + m_set_strobe.synchronize(1); } @@ -308,6 +312,10 @@ void a2bus_grappler_device::device_start() { a2bus_grappler_device_base::device_start(); + m_set_data.init(*this, FUNC(a2bus_grappler_device::set_data)); + m_set_strobe.init(*this, FUNC(a2bus_grappler_device::set_strobe));; + m_set_ack_in.init(*this, FUNC(a2bus_grappler_device::set_ack_in));; + save_item(NAME(m_strobe)); save_item(NAME(m_ack_latch)); save_item(NAME(m_ack_in)); @@ -316,7 +324,7 @@ void a2bus_grappler_device::device_start() void a2bus_grappler_device::device_reset() { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device::set_strobe), this), 1); + m_set_strobe.synchronize(1); } @@ -327,7 +335,7 @@ void a2bus_grappler_device::device_reset() WRITE_LINE_MEMBER(a2bus_grappler_device::ack_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grappler_device::set_ack_in), this), state ? 1 : 0); + m_set_ack_in.synchronize(state ? 1 : 0); } @@ -418,6 +426,8 @@ void a2bus_grapplerplus_device_base::device_start() { a2bus_grappler_device_base::device_start(); + m_set_ack_in.init(*this, FUNC(a2bus_grapplerplus_device_base::set_ack_in)); + save_item(NAME(m_ack_latch)); save_item(NAME(m_ack_in)); } @@ -488,7 +498,7 @@ void a2bus_grapplerplus_device_base::write_cnxx(u8 offset, u8 data) WRITE_LINE_MEMBER(a2bus_grapplerplus_device_base::ack_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_grapplerplus_device_base::set_ack_in), this), state ? 1 : 0); + m_set_ack_in.synchronize(state ? 1 : 0); } @@ -780,6 +790,10 @@ void a2bus_buf_grapplerplus_device::device_start() m_ram = std::make_unique<u8 []>(0x10000); + m_set_buf_data.init(*this, FUNC(a2bus_buf_grapplerplus_device::set_buf_data)); + m_set_buf_ack_in.init(*this, FUNC(a2bus_buf_grapplerplus_device::set_buf_ack_in)); + m_clear_ibusy.init(*this, FUNC(a2bus_buf_grapplerplus_device::clear_ibusy)); + save_pointer(NAME(m_ram), 0x10000); save_item(NAME(m_ram_row)); save_item(NAME(m_ram_mask)); @@ -848,7 +862,7 @@ void a2bus_buf_grapplerplus_device::data_latched(u8 data) m_ibusy = 1U; // these signals cross executable device domains - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_buf_grapplerplus_device::set_buf_data), this), int(unsigned(data))); + m_set_buf_data.synchronize(int(unsigned(data))); m_mcu->set_input_line(MCS48_INPUT_IRQ, ASSERT_LINE); } @@ -860,7 +874,7 @@ void a2bus_buf_grapplerplus_device::data_latched(u8 data) DECLARE_WRITE_LINE_MEMBER(a2bus_buf_grapplerplus_device::buf_ack_w) { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_buf_grapplerplus_device::set_buf_ack_in), this), state ? 1 : 0); + m_set_buf_ack_in.synchronize(state ? 1 : 0); } @@ -955,7 +969,7 @@ u8 a2bus_buf_grapplerplus_device::mcu_bus_r() { LOG("Read data latch %02X\n", m_data_latch); result &= m_data_latch; - machine().scheduler().synchronize(timer_expired_delegate(FUNC(a2bus_buf_grapplerplus_device::clear_ibusy), this)); + m_clear_ibusy.synchronize(); m_mcu->set_input_line(MCS48_INPUT_IRQ, CLEAR_LINE); ack_w(0); ack_w(1); diff --git a/src/devices/bus/a2bus/grappler.h b/src/devices/bus/a2bus/grappler.h index 8e3857414da..dc1b79387c9 100644 --- a/src/devices/bus/a2bus/grappler.h +++ b/src/devices/bus/a2bus/grappler.h @@ -99,6 +99,10 @@ private: u8 m_busy_in; // printer connector pin 21 (synchronised) u8 m_pe_in; // printer connector pin 23 (synchronised) u8 m_slct_in; // printer connector pin 25 (synchronised) + + transient_timer_factory m_set_busy_in; + transient_timer_factory m_set_pe_in; + transient_timer_factory m_set_slct_in; }; @@ -132,6 +136,10 @@ private: u8 m_strobe; // U3 (pin 4) u8 m_ack_latch; // U3 (pin 13) u8 m_ack_in; // printer connector pin 19 (synchronised) + + transient_timer_factory m_set_data; + transient_timer_factory m_set_strobe; + transient_timer_factory m_set_ack_in; }; @@ -173,6 +181,8 @@ private: u8 m_ack_latch; // U2C (pin 9) u8 m_ack_in; // printer connector pin 19 (synchronised) + + transient_timer_factory m_set_ack_in; }; @@ -262,6 +272,10 @@ private: u8 m_ibusy; // U12 u8 m_buf_ack_latch; // U12 u8 m_buf_ack_in; // printer connector pin 19 (synchronised) + + transient_timer_factory m_set_buf_data; + transient_timer_factory m_set_buf_ack_in; + transient_timer_factory m_clear_ibusy; }; diff --git a/src/devices/bus/nes/bootleg.cpp b/src/devices/bus/nes/bootleg.cpp index c66be02a738..5ea7cfb9302 100644 --- a/src/devices/bus/nes/bootleg.cpp +++ b/src/devices/bus/nes/bootleg.cpp @@ -1415,7 +1415,7 @@ void nes_0353_device::write_h(offs_t offset, u8 data) -------------------------------------------------*/ -void nes_09034a_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void nes_09034a_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { if (id == TIMER_IRQ) { @@ -1480,7 +1480,7 @@ u8 nes_09034a_device::read_m(offs_t offset) -------------------------------------------------*/ -void nes_batmanfs_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void nes_batmanfs_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { if (id == TIMER_IRQ) { @@ -2145,7 +2145,7 @@ uint8_t nes_rt01_device::read_h(offs_t offset) -------------------------------------------------*/ -void nes_yung08_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void nes_yung08_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { if (id == TIMER_IRQ) { diff --git a/src/devices/bus/nes/bootleg.h b/src/devices/bus/nes/bootleg.h index 6c8e4845941..4ce952fc305 100644 --- a/src/devices/bus/nes/bootleg.h +++ b/src/devices/bus/nes/bootleg.h @@ -284,7 +284,7 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; private: u16 m_irq_count; @@ -310,7 +310,7 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; private: u16 m_irq_count; @@ -683,7 +683,7 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; private: void write_45(offs_t offset, u8 data); diff --git a/src/devices/bus/thomson/cd90_015.cpp b/src/devices/bus/thomson/cd90_015.cpp index d62b0c0e338..8acdb91f00e 100644 --- a/src/devices/bus/thomson/cd90_015.cpp +++ b/src/devices/bus/thomson/cd90_015.cpp @@ -61,7 +61,7 @@ void cd90_015_device::device_add_mconfig(machine_config &config) FLOPPY_CONNECTOR(config, m_floppy[3], floppy_drives, nullptr, floppy_formats).enable_sound(true); } -void cd90_015_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void cd90_015_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { m_floppy[id]->get_device()->mon_w(1); } diff --git a/src/devices/bus/thomson/cd90_015.h b/src/devices/bus/thomson/cd90_015.h index 7d2c963f7f6..90663093647 100644 --- a/src/devices/bus/thomson/cd90_015.h +++ b/src/devices/bus/thomson/cd90_015.h @@ -26,7 +26,7 @@ protected: virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; virtual void device_reset() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; private: required_device<mc6843_device> m_fdc; diff --git a/src/devices/bus/thomson/cd90_351.cpp b/src/devices/bus/thomson/cd90_351.cpp index ca543d2b596..062abfc0760 100644 --- a/src/devices/bus/thomson/cd90_351.cpp +++ b/src/devices/bus/thomson/cd90_351.cpp @@ -122,7 +122,7 @@ void cd90_351_device::device_reset() m_cur_floppy = nullptr; } -void cd90_351_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void cd90_351_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { switch(id) { case ID_MOTOROFF: diff --git a/src/devices/bus/thomson/cd90_351.h b/src/devices/bus/thomson/cd90_351.h index 2afba932b49..e09042bb5ce 100644 --- a/src/devices/bus/thomson/cd90_351.h +++ b/src/devices/bus/thomson/cd90_351.h @@ -26,7 +26,7 @@ protected: virtual void device_add_mconfig(machine_config &config) override; virtual void device_start() override; virtual void device_reset() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; virtual void device_post_load() override; private: diff --git a/src/devices/bus/thomson/nanoreseau.cpp b/src/devices/bus/thomson/nanoreseau.cpp index 51f11c65761..55562280b09 100644 --- a/src/devices/bus/thomson/nanoreseau.cpp +++ b/src/devices/bus/thomson/nanoreseau.cpp @@ -166,7 +166,7 @@ ioport_constructor nanoreseau_device::device_input_ports() const */ -void nanoreseau_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void nanoreseau_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { m_answer_step ++; m_mc6854->set_cts(m_answer_step & 1); diff --git a/src/devices/bus/thomson/nanoreseau.h b/src/devices/bus/thomson/nanoreseau.h index b50f8618556..93937501dbf 100644 --- a/src/devices/bus/thomson/nanoreseau.h +++ b/src/devices/bus/thomson/nanoreseau.h @@ -25,7 +25,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual ioport_constructor device_input_ports() const override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; private: required_device<mc6854_device> m_mc6854; diff --git a/src/devices/machine/at28c64b.cpp b/src/devices/machine/at28c64b.cpp index 5abd3e3485f..d8a0b90b7ed 100644 --- a/src/devices/machine/at28c64b.cpp +++ b/src/devices/machine/at28c64b.cpp @@ -268,7 +268,7 @@ WRITE_LINE_MEMBER( at28c64b_device::set_oe_12v ) } -void at28c64b_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void at28c64b_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { switch( id ) { diff --git a/src/devices/machine/at28c64b.h b/src/devices/machine/at28c64b.h index 994625bf42d..1fac979acb7 100644 --- a/src/devices/machine/at28c64b.h +++ b/src/devices/machine/at28c64b.h @@ -35,7 +35,7 @@ public: protected: // device-level overrides virtual void device_start() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; // device_memory_interface overrides virtual space_config_vector memory_space_config() const override; diff --git a/src/devices/machine/k056230.cpp b/src/devices/machine/k056230.cpp index a408d01efda..c14458c99f5 100644 --- a/src/devices/machine/k056230.cpp +++ b/src/devices/machine/k056230.cpp @@ -45,7 +45,6 @@ k056230_device::k056230_device(const machine_config &mconfig, const char *tag, d void k056230_device::device_start() { save_item(NAME(m_ram)); - m_network_irq_clear.init(*this, FUNC(k056230_device::network_irq_clear)); } diff --git a/src/devices/machine/k056230.h b/src/devices/machine/k056230.h index c53b31d6d1d..55643632b38 100644 --- a/src/devices/machine/k056230.h +++ b/src/devices/machine/k056230.h @@ -37,7 +37,6 @@ protected: private: required_device<cpu_device> m_cpu; - transient_timer_factory m_network_irq_clear; uint32_t m_ram[0x2000]; }; diff --git a/src/devices/machine/mc6843.cpp b/src/devices/machine/mc6843.cpp index 695c26a1500..388632f8e05 100644 --- a/src/devices/machine/mc6843.cpp +++ b/src/devices/machine/mc6843.cpp @@ -300,7 +300,7 @@ void mc6843_device::ready_callback(floppy_image_device *floppy, int state) } } -void mc6843_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void mc6843_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { live_sync(); run(true, false, false); diff --git a/src/devices/machine/swim3.cpp b/src/devices/machine/swim3.cpp index 1be0e9937f6..aded19402e1 100644 --- a/src/devices/machine/swim3.cpp +++ b/src/devices/machine/swim3.cpp @@ -300,7 +300,7 @@ void swim3_device::index_callback(floppy_image_device *floppy, int state) run(false, true); } } -void swim3_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void swim3_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { sync(); run(true, false); diff --git a/src/devices/sound/ym2154.cpp b/src/devices/sound/ym2154.cpp index 83613506833..18b03431de6 100644 --- a/src/devices/sound/ym2154.cpp +++ b/src/devices/sound/ym2154.cpp @@ -240,7 +240,7 @@ void ym2154_device::device_clock_changed() // sound_stream_update - generate sound data //------------------------------------------------- -void ym2154_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void ym2154_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { update_irq_state(1); m_timer->adjust((2048 - m_timer_count) * attotime::from_hz(sample_rate())); diff --git a/src/devices/sound/ym2154.h b/src/devices/sound/ym2154.h index 58976f0177b..bb5d39fdb51 100644 --- a/src/devices/sound/ym2154.h +++ b/src/devices/sound/ym2154.h @@ -37,7 +37,7 @@ protected: virtual void device_start() override; virtual void device_reset() override; virtual void device_clock_changed() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; // sound overrides virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; diff --git a/src/devices/sound/ymfm_mame.h b/src/devices/sound/ymfm_mame.h index d55be4f35f2..a2d1f257215 100644 --- a/src/devices/sound/ymfm_mame.h +++ b/src/devices/sound/ymfm_mame.h @@ -33,7 +33,6 @@ public: ym_generic_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, device_type type) : device_t(mconfig, type, tag, owner, clock), device_sound_interface(mconfig, *this), - m_timer{ nullptr, nullptr }, m_update_irq(*this), m_io_read{ *this, *this }, m_io_write{ *this, *this } @@ -61,7 +60,7 @@ protected: // engine_mode_write() method virtual void ymfm_sync_mode_write(uint8_t data) override { - machine().scheduler().synchronize(timer_expired_delegate(FUNC(ym_generic_device::fm_mode_write), this), data); + m_mode_write.synchronize(data); } // the chip implementation calls this when the chip's status has changed, @@ -72,9 +71,8 @@ protected: { // if we're currently executing a CPU, schedule the interrupt check; // otherwise, do it directly - auto &scheduler = machine().scheduler(); - if (scheduler.currently_executing()) - scheduler.synchronize(timer_expired_delegate(FUNC(ym_generic_device::fm_check_interrupts), this)); + if (machine().scheduler().currently_executing()) + m_check_interrupts.synchronize(); else m_engine->engine_check_interrupts(); } @@ -86,9 +84,9 @@ protected: virtual void ymfm_set_timer(uint32_t tnum, int32_t duration_in_clocks) override { if (duration_in_clocks >= 0) - m_timer[tnum]->adjust(attotime::from_ticks(duration_in_clocks, device_t::clock()), tnum); + m_timer[tnum].adjust(attotime::from_ticks(duration_in_clocks, device_t::clock()), tnum); else - m_timer[tnum]->enable(false); + m_timer[tnum].enable(false); } // the chip implementation calls this when the state of the IRQ signal has @@ -137,8 +135,10 @@ protected: virtual void device_start() override { // allocate our timers - for (int tnum = 0; tnum < 2; tnum++) - m_timer[tnum] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ym_generic_device::fm_timer_handler), this)); + m_timer[0].init(*this, FUNC(ym_generic_device::fm_timer_handler)); + m_timer[1].init(*this, FUNC(ym_generic_device::fm_timer_handler)); + m_mode_write.init(*this, FUNC(ym_generic_device::fm_mode_write)); + m_check_interrupts.init(*this, FUNC(ym_generic_device::fm_check_interrupts)); // resolve the handlers m_update_irq.resolve(); @@ -152,16 +152,18 @@ protected: } // timer callbacks - void fm_mode_write(void *ptr, int param) { m_engine->engine_mode_write(param); } - void fm_check_interrupts(void *ptr, int param) { m_engine->engine_check_interrupts(); } - void fm_timer_handler(void *ptr, int param) { m_engine->engine_timer_expired(param); } + void fm_mode_write(timer_instance const &timer) { m_engine->engine_mode_write(timer.param()); } + void fm_check_interrupts(timer_instance const &timer) { m_engine->engine_check_interrupts(); } + void fm_timer_handler(timer_instance const &timer) { m_engine->engine_timer_expired(timer.param()); } // internal state attotime m_busy_end; // busy end time - emu_timer *m_timer[2]; // two timers devcb_write_line m_update_irq; // IRQ update callback devcb_read8 m_io_read[2]; // up to 2 input port handlers devcb_write8 m_io_write[2]; // up to 2 output port handlers + persistent_timer m_timer[2]; // two timers + transient_timer_factory m_mode_write; + transient_timer_factory m_check_interrupts; }; diff --git a/src/mame/audio/acan.cpp b/src/mame/audio/acan.cpp index 0df726ad8c9..5d64562018b 100644 --- a/src/mame/audio/acan.cpp +++ b/src/mame/audio/acan.cpp @@ -71,7 +71,7 @@ void acan_sound_device::device_reset() m_dma_irq_handler(0); } -void acan_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void acan_sound_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { if (m_regs[0x14] & 0x40) { diff --git a/src/mame/audio/acan.h b/src/mame/audio/acan.h index 0f6ac312a2d..e68acf5a2ee 100644 --- a/src/mame/audio/acan.h +++ b/src/mame/audio/acan.h @@ -27,7 +27,7 @@ protected: // device-level overrides virtual void device_start() override; virtual void device_reset() override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; // sound stream update overrides virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override; diff --git a/src/mame/drivers/subhuntr.cpp b/src/mame/drivers/subhuntr.cpp index 991b07684c0..c239479e230 100644 --- a/src/mame/drivers/subhuntr.cpp +++ b/src/mame/drivers/subhuntr.cpp @@ -60,7 +60,7 @@ public: protected: enum { TIMER_VIDEO }; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; virtual void machine_start() override; virtual void machine_reset() override; @@ -107,7 +107,7 @@ private: ***************************************************************************/ -void subhuntr_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void subhuntr_state::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { switch (id) { diff --git a/src/mame/drivers/turbo.cpp b/src/mame/drivers/turbo.cpp index 4c5f6b0d82f..59ce6f5b587 100644 --- a/src/mame/drivers/turbo.cpp +++ b/src/mame/drivers/turbo.cpp @@ -196,6 +196,8 @@ void buckrog_state::machine_start() { turbo_base_state::machine_start(); + m_delayed_i8255_w.init(*this, FUNC(buckrog_state::delayed_i8255_w)); + save_item(NAME(m_fchg)); save_item(NAME(m_mov)); save_item(NAME(m_obch)); diff --git a/src/mame/drivers/ympsr60.cpp b/src/mame/drivers/ympsr60.cpp index a5c1d010f38..4c2a60c92ee 100644 --- a/src/mame/drivers/ympsr60.cpp +++ b/src/mame/drivers/ympsr60.cpp @@ -234,7 +234,7 @@ attoseconds_t psr60_state::cv_handler(attotime const &cvtime) if (BIT(m_bbd_config, 1) && !BIT(m_bbd_config, 2)) { // Stereo symphonic off: min freq 35 kHz, max freq 107 kHz, varies at 0,3 Hz - curtime.m_seconds %= 3; + curtime.set_seconds(curtime.seconds() % 3); double pos = curtime.as_double() / 3; pos = (pos < 0.5) ? (2 * pos) : 2 * (1.0 - pos); bbd_freq = 35000 + (107000 - 35000) * pos; @@ -242,7 +242,7 @@ attoseconds_t psr60_state::cv_handler(attotime const &cvtime) else { // Stereo symphonic on: min freq 48 kHz, max freq 61 kHz, varies at 6 Hz - curtime.m_seconds = 0; + curtime.set_seconds(0); double pos = curtime.as_double() * 6; pos -= floor(pos); pos = (pos < 0.5) ? (2 * pos) : 2 * (1.0 - pos); diff --git a/src/mame/includes/turbo.h b/src/mame/includes/turbo.h index a14929b7e5e..62c97e74e8e 100644 --- a/src/mame/includes/turbo.h +++ b/src/mame/includes/turbo.h @@ -151,6 +151,8 @@ private: void main_prg_map(address_map &map); void sub_prg_map(address_map &map); void sub_portmap(address_map &map); + + transient_timer_factory m_delayed_i8255_w; }; class subroc3d_state : public turbo_base_state diff --git a/src/mame/machine/k573kara.cpp b/src/mame/machine/k573kara.cpp index b2663f196f3..7b6f31c2807 100644 --- a/src/mame/machine/k573kara.cpp +++ b/src/mame/machine/k573kara.cpp @@ -112,7 +112,7 @@ void k573kara_device::device_add_mconfig(machine_config &config) duart_chan0.out_rts_callback().set("rs232_chan0", FUNC(rs232_port_device::write_rts)); } -void k573kara_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +void k573kara_device::device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) { } diff --git a/src/mame/machine/k573kara.h b/src/mame/machine/k573kara.h index 57e53e16223..af77f93edb5 100644 --- a/src/mame/machine/k573kara.h +++ b/src/mame/machine/k573kara.h @@ -20,7 +20,7 @@ protected: virtual void device_reset() override; virtual const tiny_rom_entry *device_rom_region() const override; virtual void device_add_mconfig(machine_config &config) override; - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_timer(timer_instance const &timer, device_timer_id id, int param, void *ptr) override; private: uint16_t uart_r(offs_t offset); diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp index 68eb0929178..9017111a7a4 100644 --- a/src/mame/machine/thomson.cpp +++ b/src/mame/machine/thomson.cpp @@ -1597,7 +1597,7 @@ MACHINE_START_MEMBER( mo5_state, mo5 ) to7_game_init(); to7_modem_init(); to7_midi_init(); - m_mo5_periodic_timer = timer_alloc(*this, FUNC(thomson_state::mo5_periodic_cb)); + m_mo5_periodic_timer = timer_alloc(*this, FUNC(mo5_state::mo5_periodic_cb)); m_extension->rom_map(m_maincpu->space(AS_PROGRAM), 0xa000, 0xa7bf); m_extension->io_map (m_maincpu->space(AS_PROGRAM), 0xa7d0, 0xa7df); @@ -2423,7 +2423,7 @@ void to9_state::to9_kbd_reset() void to9_state::to9_kbd_init() { LOG(( "to9_kbd_init called\n" )); - m_to9_kbd_timer = timer_alloc(*this, FUNC(thomson_state::to9_kbd_timer_cb)); + m_to9_kbd_timer = timer_alloc(*this, FUNC(to9_state::to9_kbd_timer_cb)); save_item(NAME(m_to9_kbd_parity)); save_item(NAME(m_to9_kbd_intr)); save_item(NAME(m_to9_kbd_in)); @@ -2877,7 +2877,7 @@ void to9_state::to8_kbd_reset() void to9_state::to8_kbd_init() { - m_to8_kbd_timer = timer_alloc(*this, FUNC(thomson_state::to8_kbd_timer_cb)); + m_to8_kbd_timer = timer_alloc(*this, FUNC(to9_state::to8_kbd_timer_cb)); m_to8_kbd_signal = timer_alloc(); save_item(NAME(m_to8_kbd_ack)); save_item(NAME(m_to8_kbd_data)); @@ -4001,7 +4001,7 @@ TIMER_CALLBACK_MEMBER(mo6_state::mo6_game_update_cb) void mo6_state::mo6_game_init() { LOG (( "mo6_game_init called\n" )); - m_to7_game_timer = timer_alloc(*this, FUNC(thomson_state::mo6_game_update_cb)); + m_to7_game_timer = timer_alloc(*this, FUNC(mo6_state::mo6_game_update_cb)); m_to7_game_timer->adjust(TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD); save_item(NAME(m_to7_game_sound)); save_item(NAME(m_to7_game_mute)); @@ -4420,7 +4420,7 @@ void mo5nr_state::mo5nr_sys_porta_out(uint8_t data) void mo5nr_state::mo5nr_game_init() { LOG (( "mo5nr_game_init called\n" )); - m_to7_game_timer = timer_alloc(*this, FUNC(thomson_state::mo6_game_update_cb)); + m_to7_game_timer = timer_alloc(*this, FUNC(mo5nr_state::mo6_game_update_cb)); m_to7_game_timer->adjust( TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD ); save_item(NAME(m_to7_game_sound)); save_item(NAME(m_to7_game_mute)); @@ -4502,7 +4502,7 @@ MACHINE_START_MEMBER( mo5nr_state, mo5nr ) to9_palette_init(); to7_modem_init(); to7_midi_init(); - m_mo5_periodic_timer = timer_alloc(*this, FUNC(thomson_state::mo5_periodic_cb)); + m_mo5_periodic_timer = timer_alloc(*this, FUNC(mo5nr_state::mo5_periodic_cb)); m_extension->rom_map(m_extension_view[0], 0xa000, 0xa7bf); m_extension->io_map (m_extension_view[0], 0xa7d0, 0xa7df); |