diff options
author | Aaron Giles <aaron@aarongiles.com> | 2021-03-22 20:29:26 -0700 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2021-03-22 20:29:26 -0700 |
commit | 1ecd290c97ff6e57af74ff238e1d1c388a893662 (patch) | |
tree | ffcc940ac30cee92344b73e29de0a0165a9f05f8 | |
parent | ab254604afa2a933d57c78bb8f5890f6c90a4732 (diff) |
First round of timer_set conversions.
-rw-r--r-- | src/devices/imagedev/flopdrv.cpp | 6 | ||||
-rw-r--r-- | src/devices/imagedev/flopdrv.h | 1 | ||||
-rw-r--r-- | src/devices/machine/74123.cpp | 4 | ||||
-rw-r--r-- | src/devices/machine/74123.h | 1 | ||||
-rw-r--r-- | src/devices/machine/akiko.cpp | 4 | ||||
-rw-r--r-- | src/devices/machine/akiko.h | 1 | ||||
-rw-r--r-- | src/devices/machine/corvushd.cpp | 1 | ||||
-rw-r--r-- | src/devices/machine/ie15.cpp | 4 | ||||
-rw-r--r-- | src/devices/machine/ie15.h | 2 | ||||
-rw-r--r-- | src/devices/machine/k056230.cpp | 3 | ||||
-rw-r--r-- | src/devices/machine/k056230.h | 1 | ||||
-rw-r--r-- | src/devices/machine/rtc65271.cpp | 4 | ||||
-rw-r--r-- | src/devices/machine/rtc65271.h | 2 | ||||
-rw-r--r-- | src/devices/video/stvvdp1.cpp | 5 | ||||
-rw-r--r-- | src/devices/video/vic4567.cpp | 4 | ||||
-rw-r--r-- | src/devices/video/vic4567.h | 1 | ||||
-rw-r--r-- | src/devices/video/zeus2.cpp | 10 | ||||
-rw-r--r-- | src/devices/video/zeus2.h | 1 | ||||
-rw-r--r-- | src/mame/includes/saturn.h | 1 |
19 files changed, 42 insertions, 14 deletions
diff --git a/src/devices/imagedev/flopdrv.cpp b/src/devices/imagedev/flopdrv.cpp index 6ab5028f2d8..05b213ad18e 100644 --- a/src/devices/imagedev/flopdrv.cpp +++ b/src/devices/imagedev/flopdrv.cpp @@ -658,6 +658,8 @@ legacy_floppy_image_device::~legacy_floppy_image_device() void legacy_floppy_image_device::device_start() { + m_set_wpt.enregister(*this, FUNC(legacy_floppy_image_device::set_wpt)); + floppy_drive_init(); m_active = false; @@ -733,7 +735,7 @@ image_init_result legacy_floppy_image_device::call_load() else next_wpt = 0; - machine().scheduler().timer_set(attotime::from_msec(250), timer_expired_delegate(FUNC(legacy_floppy_image_device::set_wpt),this), next_wpt); + m_set_wpt.call_after(attotime::from_msec(250), next_wpt); return retVal; } @@ -755,7 +757,7 @@ void legacy_floppy_image_device::call_unload() //m_out_wpt_func(m_wpt); /* set timer for disk eject */ - machine().scheduler().timer_set(attotime::from_msec(250), timer_expired_delegate(FUNC(legacy_floppy_image_device::set_wpt),this), 1); + m_set_wpt.call_after(attotime::from_msec(250), 1); } bool legacy_floppy_image_device::is_creatable() const noexcept diff --git a/src/devices/imagedev/flopdrv.h b/src/devices/imagedev/flopdrv.h index 4f893bca965..d51994f1dcd 100644 --- a/src/devices/imagedev/flopdrv.h +++ b/src/devices/imagedev/flopdrv.h @@ -176,6 +176,7 @@ protected: /* callbacks */ devcb_write_line m_out_idx_func; + timer_expired_registered_delegate m_set_wpt; /* state of input lines */ int m_drtn; /* direction */ diff --git a/src/devices/machine/74123.cpp b/src/devices/machine/74123.cpp index 6596bf58bf3..4e7197dcc3e 100644 --- a/src/devices/machine/74123.cpp +++ b/src/devices/machine/74123.cpp @@ -48,6 +48,8 @@ void ttl74123_device::device_start() { m_output_changed_cb.resolve_safe(); + m_output_callback.enregister(*this, FUNC(ttl74123_device::output_callback)); + m_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ttl74123_device::clear_callback),this)); /* register for state saving */ @@ -133,7 +135,7 @@ void ttl74123_device::set_output() { int output = timer_running(); - machine().scheduler().timer_set( attotime::zero, timer_expired_delegate(FUNC(ttl74123_device::output_callback ),this), output); + m_output_callback.synchronize(output); LOG("74123: Output: %d\n", output); } diff --git a/src/devices/machine/74123.h b/src/devices/machine/74123.h index bdff8d29aee..43f865bd0df 100644 --- a/src/devices/machine/74123.h +++ b/src/devices/machine/74123.h @@ -115,6 +115,7 @@ private: int m_b; /* initial/constant value of the B pin */ int m_clear; /* initial/constant value of the Clear pin */ devcb_write_line m_output_changed_cb; + timer_expired_registered_delegate m_output_callback; }; diff --git a/src/devices/machine/akiko.cpp b/src/devices/machine/akiko.cpp index 1505eab2a56..f88a68aa79a 100644 --- a/src/devices/machine/akiko.cpp +++ b/src/devices/machine/akiko.cpp @@ -106,6 +106,8 @@ void akiko_device::device_start() m_sda_r.resolve_safe(1); m_sda_w.resolve_safe(); + m_cd_delayed_cmd.enregister(*this, FUNC(akiko_device::cd_delayed_cmd)); + m_c2p_input_index = 0; m_c2p_output_index = 0; @@ -702,7 +704,7 @@ void akiko_device::update_cdrom() { m_cdrom_cmd_start = (m_cdrom_cmd_start+3) & 0xff; - machine().scheduler().timer_set( attotime::from_msec(1), timer_expired_delegate(FUNC(akiko_device::cd_delayed_cmd ), this), resp[0]); + m_cd_delayed_cmd.call_after(attotime::from_msec(1), resp[0]); break; } diff --git a/src/devices/machine/akiko.h b/src/devices/machine/akiko.h index 8a0ffec8e76..2a8ebd52a24 100644 --- a/src/devices/machine/akiko.h +++ b/src/devices/machine/akiko.h @@ -114,6 +114,7 @@ private: void setup_response( int len, uint8_t *r1 ); TIMER_CALLBACK_MEMBER( cd_delayed_cmd ); + timer_expired_registered_delegate m_cd_delayed_cmd; void update_cdrom(); // interface diff --git a/src/devices/machine/corvushd.cpp b/src/devices/machine/corvushd.cpp index 07b959d9fba..6c10cfe33de 100644 --- a/src/devices/machine/corvushd.cpp +++ b/src/devices/machine/corvushd.cpp @@ -1297,7 +1297,6 @@ void corvus_hdc_device::corvus_process_command_packet(bool invalid_command_flag) // // Set up timers for command completion and timeout from host // - //machine.scheduler().timer_set(attotime::from_usec(m_delay), FUNC(corvus_hdc_callback), CALLBACK_CTH_MODE); m_cmd_timer->adjust(attotime::from_usec(m_delay), CALLBACK_CTH_MODE); m_timeout_timer->enable(0); // We've received enough data, disable the timeout timer diff --git a/src/devices/machine/ie15.cpp b/src/devices/machine/ie15.cpp index 4d9d17a3afc..d22a146acbb 100644 --- a/src/devices/machine/ie15.cpp +++ b/src/devices/machine/ie15.cpp @@ -166,7 +166,7 @@ void ie15_device::beep_w(uint8_t data) { LOG("beep (%s)\n", m_long_beep ? "short" : "long"); } - machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(ie15_device::ie15_beepoff),this)); + m_ie15_beepoff.call_after(attotime::from_msec(length)); m_beeper->set_state(1); } @@ -497,6 +497,8 @@ void ie15_device::device_start() m_hblank_timer = timer_alloc(TIMER_HBLANK); m_hblank_timer->adjust(attotime::never); + m_ie15_beepoff.enregister(*this, FUNC(ie15_device::ie15_beepoff)); + m_video.ptr1 = m_video.ptr2 = m_latch = 0; m_tmpbmp = std::make_unique<uint32_t[]>(IE15_TOTAL_HORZ * IE15_TOTAL_VERT); diff --git a/src/devices/machine/ie15.h b/src/devices/machine/ie15.h index 3bd93567d22..9f2289f914a 100644 --- a/src/devices/machine/ie15.h +++ b/src/devices/machine/ie15.h @@ -154,6 +154,8 @@ private: devcb_write_line m_rs232_conn_dtr_handler; devcb_write_line m_rs232_conn_rts_handler; + timer_expired_registered_delegate m_ie15_beepoff; + // Until the UART is implemented required_ioport m_rs232_txbaud; required_ioport m_rs232_rxbaud; diff --git a/src/devices/machine/k056230.cpp b/src/devices/machine/k056230.cpp index 55d0e22177d..89b01c7d849 100644 --- a/src/devices/machine/k056230.cpp +++ b/src/devices/machine/k056230.cpp @@ -46,6 +46,7 @@ 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.enregister(*this, FUNC(k056230_device::network_irq_clear)); } @@ -89,7 +90,7 @@ void k056230_device::write(offs_t offset, uint8_t data) if (m_cpu) m_cpu->set_input_line(INPUT_LINE_IRQ2, ASSERT_LINE); - machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(k056230_device::network_irq_clear), this)); + m_network_irq_clear.call_after(attotime::from_usec(10)); } } // else diff --git a/src/devices/machine/k056230.h b/src/devices/machine/k056230.h index bfedc22d475..2ef5928d80d 100644 --- a/src/devices/machine/k056230.h +++ b/src/devices/machine/k056230.h @@ -43,6 +43,7 @@ private: bool m_is_thunderh; required_device<cpu_device> m_cpu; + timer_expired_registered_delegate m_network_irq_clear; uint32_t m_ram[0x2000]; }; diff --git a/src/devices/machine/rtc65271.cpp b/src/devices/machine/rtc65271.cpp index 1eb84d89171..91706e20170 100644 --- a/src/devices/machine/rtc65271.cpp +++ b/src/devices/machine/rtc65271.cpp @@ -497,7 +497,7 @@ TIMER_CALLBACK_MEMBER(rtc65271_device::rtc_begin_update_cb) m_regs[reg_A] |= reg_A_UIP; /* schedule end of update cycle */ - machine().scheduler().timer_set(UPDATE_CYCLE_TIME, timer_expired_delegate(FUNC(rtc65271_device::rtc_end_update_cb), this)); + m_rtc_end_update_cb.call_after(UPDATE_CYCLE_TIME); } } @@ -673,6 +673,8 @@ void rtc65271_device::device_start() m_SQW_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(rtc65271_device::rtc_SQW_cb), this)); m_interrupt_cb.resolve(); + m_rtc_end_update_cb.enregister(*this, FUNC(rtc65271_device::rtc_end_update_cb)); + save_item(NAME(m_regs)); save_item(NAME(m_cur_reg)); save_item(NAME(m_xram)); diff --git a/src/devices/machine/rtc65271.h b/src/devices/machine/rtc65271.h index 151344d6e7c..26398a263a6 100644 --- a/src/devices/machine/rtc65271.h +++ b/src/devices/machine/rtc65271.h @@ -63,6 +63,8 @@ private: /* callback called when interrupt pin state changes (may be nullptr) */ devcb_write_line m_interrupt_cb; + + timer_expired_registered_delegate m_rtc_end_update_cb; }; // device type definition diff --git a/src/devices/video/stvvdp1.cpp b/src/devices/video/stvvdp1.cpp index d3fce6d03ba..a3f2ff0184f 100644 --- a/src/devices/video/stvvdp1.cpp +++ b/src/devices/video/stvvdp1.cpp @@ -2056,7 +2056,7 @@ void saturn_state::stv_vdp1_process_list( void ) /* TODO: what's the exact formula? Guess it should be a mix between number of pixels written and actual command data fetched. */ // if spritecount = 10000 don't send a vdp1 draw end // if(spritecount < 10000) - machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(spritecount*16), timer_expired_delegate(FUNC(saturn_state::vdp1_draw_end),this)); + m_vdp1_draw_end.call_after(m_maincpu->cycles_to_attotime(spritecount*16)); if (VDP1_LOG) logerror ("End of list processing!\n"); } @@ -2215,5 +2215,8 @@ int saturn_state::stv_vdp1_start ( void ) save_item(NAME(m_vdp1.local_x)); save_item(NAME(m_vdp1.local_y)); machine().save().register_postload(save_prepost_delegate(FUNC(saturn_state::stv_vdp1_state_save_postload), this)); + + m_vdp1_draw_end.enregister(*this, FUNC(saturn_state::vdp1_draw_end)); + return 0; } diff --git a/src/devices/video/vic4567.cpp b/src/devices/video/vic4567.cpp index 99f2e5af476..8fcf815d50f 100644 --- a/src/devices/video/vic4567.cpp +++ b/src/devices/video/vic4567.cpp @@ -309,6 +309,8 @@ void vic3_device::device_start() save_item(NAME(m_sprites[i].bitmap[6]), i); save_item(NAME(m_sprites[i].bitmap[7]), i); } + + m_timer_timeout.enregister(*this, FUNC(vic3_device::timer_timeout)); } //------------------------------------------------- @@ -1983,7 +1985,7 @@ void vic3_device::raster_interrupt_gen() if (LIGHTPEN_BUTTON) { /* lightpen timer start */ - machine().scheduler().timer_set(attotime(0, 0), timer_expired_delegate(FUNC(vic3_device::timer_timeout),this), 1); + m_timer_timeout.synchronize(1); } } diff --git a/src/devices/video/vic4567.h b/src/devices/video/vic4567.h index 64fedb3da16..f71c527dc9c 100644 --- a/src/devices/video/vic4567.h +++ b/src/devices/video/vic4567.h @@ -173,6 +173,7 @@ private: void draw_bitplanes(); TIMER_CALLBACK_MEMBER(timer_timeout); + timer_expired_registered_delegate m_timer_timeout; vic3_type m_type; diff --git a/src/devices/video/zeus2.cpp b/src/devices/video/zeus2.cpp index 1d3e2dd767c..91a66d5bb2f 100644 --- a/src/devices/video/zeus2.cpp +++ b/src/devices/video/zeus2.cpp @@ -48,16 +48,16 @@ TIMER_CALLBACK_MEMBER(zeus2_device::display_irq_off) // vblank_period = screen().frame_period(); //vblank_timer->adjust(vblank_period); vblank_timer->adjust(screen().time_until_vblank_start()); - //machine().scheduler().timer_set(attotime::from_hz(30000000), timer_expired_delegate(FUNC(zeus2_device::display_irq), this)); + //vblank_timer->adjust(attotime::from_hz(30000000)); } TIMER_CALLBACK_MEMBER(zeus2_device::display_irq) { m_vblank(ASSERT_LINE); /* set a timer for the next off state */ - //machine().scheduler().timer_set(screen().time_until_pos(0), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this), 0, this); - machine().scheduler().timer_set(screen().time_until_vblank_end(), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this)); - //machine().scheduler().timer_set(attotime::from_hz(30000000), timer_expired_delegate(FUNC(zeus2_device::display_irq_off), this)); + //m_display_irq_off.call_after(screen().time_until_pos(0), 0); + m_display_irq_off.call_after(screen().time_until_vblank_end()); + //m_display_irq_off.call_after(attotime::from_hz(30000000)); } TIMER_CALLBACK_MEMBER(zeus2_device::int_timer_callback) @@ -91,6 +91,8 @@ void zeus2_device::device_start() vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(zeus2_device::display_irq), this)); + m_display_irq_off.enregister(*this, FUNC(zeus2_device::display_irq_off)); + //printf("%s\n", machine().system().name); // Set system type if (strcmp(machine().system().name, "thegrid") == 0 || strcmp(machine().system().name, "thegrida") == 0) { diff --git a/src/devices/video/zeus2.h b/src/devices/video/zeus2.h index 3090c08c620..beabed294bc 100644 --- a/src/devices/video/zeus2.h +++ b/src/devices/video/zeus2.h @@ -110,6 +110,7 @@ public: uint32_t zeus2_r(offs_t offset); void zeus2_w(offs_t offset, uint32_t data); TIMER_CALLBACK_MEMBER(display_irq_off); + timer_expired_registered_delegate m_display_irq_off; TIMER_CALLBACK_MEMBER(display_irq); auto vblank_callback() { return m_vblank.bind(); } diff --git a/src/mame/includes/saturn.h b/src/mame/includes/saturn.h index b1a441875cf..2e8750247e9 100644 --- a/src/mame/includes/saturn.h +++ b/src/mame/includes/saturn.h @@ -139,6 +139,7 @@ protected: TIMER_CALLBACK_MEMBER(vdp1_draw_end); + timer_expired_registered_delegate m_vdp1_draw_end; void saturn_soundram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); uint16_t saturn_soundram_r(offs_t offset); void minit_w(uint32_t data); |