diff options
author | Aaron Giles <aaron@aarongiles.com> | 2021-09-11 21:40:00 -0700 |
---|---|---|
committer | Aaron Giles <aaron@aarongiles.com> | 2021-09-11 21:40:00 -0700 |
commit | a1dde21708f6764211f7d6f0a41caef7682b2693 (patch) | |
tree | 64b87b5c1bd5190728062e7f63521eaf2ad92da9 | |
parent | e94edaf482f4fb5644703599108ee7ce3b5ebbd1 (diff) |
Add adjust_periodic() to persistent_timer. Update obvious situations where it can be used. Convert a few drivers from timer devices to plain timers to avoid adding adjust_persistent() to the timer device as well.
292 files changed, 642 insertions, 687 deletions
diff --git a/src/devices/bus/a2bus/a2sd.cpp b/src/devices/bus/a2bus/a2sd.cpp index d17b1f133c7..f0c0b51ad70 100644 --- a/src/devices/bus/a2bus/a2sd.cpp +++ b/src/devices/bus/a2bus/a2sd.cpp @@ -172,11 +172,11 @@ u8 a2bus_a2sd_device::read_c0nx(u8 offset) if (m_c0n1 & C0N1_ECE) { - m_shift_timer->adjust(attotime::from_hz(14.318181_MHz_XTAL / 4), 0, attotime::from_hz(14.318181_MHz_XTAL / 4)); + m_shift_timer->adjust_periodic(attotime::from_hz(14.318181_MHz_XTAL / 4)); } else { - m_shift_timer->adjust(attotime::from_hz(500_kHz_XTAL), 0, attotime::from_hz(500_kHz_XTAL)); + m_shift_timer->adjust_periodic(attotime::from_hz(500_kHz_XTAL)); } } return m_datain; @@ -217,11 +217,11 @@ void a2bus_a2sd_device::write_c0nx(u8 offset, u8 data) // if ECE is set, clock is 3.58 MHz from the A2 bus, otherwise internally generated 500 kHz if (m_c0n1 & C0N1_ECE) { - m_shift_timer->adjust(attotime::from_hz(14.318181_MHz_XTAL / 4), 0, attotime::from_hz(14.318181_MHz_XTAL/4)); + m_shift_timer->adjust_periodic(attotime::from_hz(14.318181_MHz_XTAL / 4)); } else { - m_shift_timer->adjust(attotime::from_hz(500_kHz_XTAL), 0, attotime::from_hz(500_kHz_XTAL)); + m_shift_timer->adjust_periodic(attotime::from_hz(500_kHz_XTAL)); } break; diff --git a/src/devices/bus/a2bus/agat840k_hle.cpp b/src/devices/bus/a2bus/agat840k_hle.cpp index 2cf22ed4f05..4d753fb9931 100644 --- a/src/devices/bus/a2bus/agat840k_hle.cpp +++ b/src/devices/bus/a2bus/agat840k_hle.cpp @@ -122,7 +122,7 @@ void a2bus_agat840k_hle_device::index_callback(int unit, int state) m_count_write = 0; m_d15->pc4_w(0); // latch data into port A m_d15->pc4_w(1); - m_timer_wait->adjust(attotime::from_usec(m_waittime), 0, attotime::from_usec(m_waittime)); + m_timer_wait->adjust_periodic(attotime::from_usec(m_waittime)); } #endif } @@ -386,7 +386,7 @@ void a2bus_agat840k_hle_device::d14_o_c(uint8_t data) { m_d15->pc4_w(0); m_d15->pc4_w(1); - m_timer_wait->adjust(attotime::from_usec(m_waittime), 0, attotime::from_usec(m_waittime)); + m_timer_wait->adjust_periodic(attotime::from_usec(m_waittime)); } LOG("D14 C <- %02X (unit %d side %d drtn %d wtg %d mon %d)\n", diff --git a/src/devices/bus/a2bus/agat_fdc.cpp b/src/devices/bus/a2bus/agat_fdc.cpp index ad90a251af6..8069c613e19 100644 --- a/src/devices/bus/a2bus/agat_fdc.cpp +++ b/src/devices/bus/a2bus/agat_fdc.cpp @@ -159,7 +159,7 @@ void a2bus_agat_fdc_device::device_reset() // Just a timer to be sure that the lss is updated from time to // time, so that there's no hiccup when it's talked to again. - m_timer_lss->adjust(attotime::from_msec(10), 0, attotime::from_msec(10)); + m_timer_lss->adjust_periodic(attotime::from_msec(10)); } void a2bus_agat_fdc_device::device_timer(timer_instance const &timer) diff --git a/src/devices/bus/abckb/abc77.cpp b/src/devices/bus/abckb/abc77.cpp index 0d48b4fe7c8..43b8815d625 100644 --- a/src/devices/bus/abckb/abc77.cpp +++ b/src/devices/bus/abckb/abc77.cpp @@ -443,7 +443,7 @@ void abc77_device::device_start() { // allocate timers m_serial_timer = timer_alloc(TIMER_SERIAL); - m_serial_timer->adjust(attotime::from_hz(19200), 0, attotime::from_hz(19200)); // ALE/32 + m_serial_timer->adjust_periodic(attotime::from_hz(19200)); // ALE/32 m_reset_timer = timer_alloc(TIMER_RESET); } diff --git a/src/devices/bus/abckb/abc800kb.cpp b/src/devices/bus/abckb/abc800kb.cpp index abea024a5f5..77142322fb6 100644 --- a/src/devices/bus/abckb/abc800kb.cpp +++ b/src/devices/bus/abckb/abc800kb.cpp @@ -338,7 +338,7 @@ void abc800_keyboard_device::device_start() { // allocate timers m_serial_timer = timer_alloc(); - m_serial_timer->adjust(attotime::from_hz(XTAL(5'990'400)/(3*5)/20), 0, attotime::from_hz(XTAL(5'990'400)/(3*5)/20)); // ??? + m_serial_timer->adjust_periodic(attotime::from_hz(XTAL(5'990'400)/(3*5)/20)); // ??? // state saving save_item(NAME(m_row)); diff --git a/src/devices/bus/c64/c128_partner.cpp b/src/devices/bus/c64/c128_partner.cpp index 428b17e9058..62a224a3024 100644 --- a/src/devices/bus/c64/c128_partner.cpp +++ b/src/devices/bus/c64/c128_partner.cpp @@ -99,7 +99,7 @@ void c128_partner_cartridge_device::device_start() { // simulate the 16.7ms pulse from CIA1 PB2 that would arrive thru the joystick port dongle t_joyb2 = timer_alloc(); - t_joyb2->adjust(attotime::from_msec(16), 0, attotime::from_msec(16)); + t_joyb2->adjust_periodic(attotime::from_msec(16)); // state saving save_item(NAME(m_ram_a12_a7)); diff --git a/src/devices/bus/cbus/pc9801_86.cpp b/src/devices/bus/cbus/pc9801_86.cpp index 267b1a2c55b..c47ae9ae618 100644 --- a/src/devices/bus/cbus/pc9801_86.cpp +++ b/src/devices/bus/cbus/pc9801_86.cpp @@ -337,7 +337,7 @@ void pc9801_86_device::pcm_w(offs_t offset, u8 data) break; case 2: if(((data & 7) != (m_pcm_ctrl & 7)) || !m_init) - m_dac_timer->adjust(attotime::from_ticks(divs[data & 7], rate), 0, attotime::from_ticks(divs[data & 7], rate)); + m_dac_timer->adjust_periodic(attotime::from_ticks(divs[data & 7], rate)); if(data & 8) m_head = m_tail = m_count = 0; if(!(data & 0x10)) diff --git a/src/devices/bus/compucolor/floppy.cpp b/src/devices/bus/compucolor/floppy.cpp index f5a5da7b567..8ea7de09752 100644 --- a/src/devices/bus/compucolor/floppy.cpp +++ b/src/devices/bus/compucolor/floppy.cpp @@ -128,7 +128,7 @@ void compucolor_floppy_device::device_start() { // allocate timer m_timer = timer_alloc(); - m_timer->adjust(attotime::from_hz(9600*8), 0, attotime::from_hz(9600*8)); + m_timer->adjust_periodic(attotime::from_hz(9600*8)); // state saving save_item(NAME(m_rw)); diff --git a/src/devices/bus/hp9845_io/98035.cpp b/src/devices/bus/hp9845_io/98035.cpp index ec6082a0f1f..a0bf5548b2f 100644 --- a/src/devices/bus/hp9845_io/98035.cpp +++ b/src/devices/bus/hp9845_io/98035.cpp @@ -198,11 +198,9 @@ void hp98035_io_card_device::device_reset() sts_w(true); set_flg(true); - attotime period(attotime::from_msec(1)); - m_msec_timer->adjust(period , 0 , period); + m_msec_timer->adjust_periodic(attotime::from_msec(1)); - period = attotime::from_hz(DIGIT_MUX_FREQ); - m_clock_timer->adjust(period , 0 , period); + m_clock_timer->adjust_periodic(attotime::from_hz(DIGIT_MUX_FREQ)); half_init(); } diff --git a/src/devices/bus/ieee488/remote488.cpp b/src/devices/bus/ieee488/remote488.cpp index 21b937ac30d..b677586eaf4 100644 --- a/src/devices/bus/ieee488/remote488.cpp +++ b/src/devices/bus/ieee488/remote488.cpp @@ -336,7 +336,7 @@ void remote488_device::bus_reset() m_sh_state = REM_SH_SIDS; m_ah_state = REM_AH_ACRS; m_rx_state = REM_RX_WAIT_CH; - m_poll_timer->adjust(attotime::from_usec(POLL_PERIOD_US) , 0 , attotime::from_usec(POLL_PERIOD_US)); + m_poll_timer->adjust_periodic(attotime::from_usec(POLL_PERIOD_US)); m_pp_data = 0; m_pp_requested = false; update_ah_fsm(); @@ -399,7 +399,7 @@ void remote488_device::process_input_msgs() } } if (!m_poll_timer->enabled()) { - m_poll_timer->adjust(attotime::from_usec(POLL_PERIOD_US) , 0 , attotime::from_usec(POLL_PERIOD_US)); + m_poll_timer->adjust_periodic(attotime::from_usec(POLL_PERIOD_US)); } } @@ -446,7 +446,7 @@ void remote488_device::set_connection(bool state) send_update(MSG_SIGNAL_CLEAR , tmp); } } - m_hb_timer->adjust(attotime::from_msec(HEARTBEAT_MS) , 0 , attotime::from_msec(HEARTBEAT_MS)); + m_hb_timer->adjust_periodic(attotime::from_msec(HEARTBEAT_MS)); m_connect_cnt = MAX_MISSED_HB; } else { if (m_connected) { @@ -454,7 +454,7 @@ void remote488_device::set_connection(bool state) m_connected = false; LOG("Connection lost!\n"); update_ah_fsm(); - m_hb_timer->adjust(attotime::from_msec(HEARTBEAT_MS) , 0 , attotime::from_msec(HEARTBEAT_MS)); + m_hb_timer->adjust_periodic(attotime::from_msec(HEARTBEAT_MS)); } } } diff --git a/src/devices/bus/isa/s3virge.cpp b/src/devices/bus/isa/s3virge.cpp index 62777eec564..6bc660a1822 100644 --- a/src/devices/bus/isa/s3virge.cpp +++ b/src/devices/bus/isa/s3virge.cpp @@ -972,7 +972,7 @@ void s3virge_vga_device::command_start() s3virge.s3d.clip_b = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_CLIP_T_B] & 0x000007ff; s3virge.s3d.clip_t = (s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_CLIP_T_B] & 0x07ff0000) >> 16; if(!(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000080)) - m_draw_timer->adjust(attotime::from_nsec(250),0,attotime::from_nsec(250)); + m_draw_timer->adjust_periodic(attotime::from_nsec(250)); s3virge.s3d.bitblt_step_count = 0; s3virge.s3d.bitblt_mono_pattern = s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_MONO_PAT_0] | (uint64_t)(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_MONO_PAT_1]) << 32; diff --git a/src/devices/bus/isa/sb16.cpp b/src/devices/bus/isa/sb16.cpp index 8cea7d20697..92de67d2ef9 100644 --- a/src/devices/bus/isa/sb16.cpp +++ b/src/devices/bus/isa/sb16.cpp @@ -109,7 +109,7 @@ void sb16_lle_device::control_timer(bool start) if(start && m_freq) { double rate = ((46.61512_MHz_XTAL).dvalue()/1024/256) * m_freq; - m_timer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); + m_timer->adjust_periodic(attotime::from_hz(rate)); } else m_timer->adjust(attotime::never); diff --git a/src/devices/bus/isa/sblaster.cpp b/src/devices/bus/isa/sblaster.cpp index cd6f6e43cc0..07a7e3ebd9c 100644 --- a/src/devices/bus/isa/sblaster.cpp +++ b/src/devices/bus/isa/sblaster.cpp @@ -1476,7 +1476,7 @@ void sb16_device::dack16_w(int line, uint16_t data) // set the transfer timer on the 1st byte if (!m_dsp.dma_timer_started) { - m_timer->adjust(attotime::from_hz((double)m_dsp.frequency), 0, attotime::from_hz((double)m_dsp.frequency)); + m_timer->adjust_periodic(attotime::from_hz((double)m_dsp.frequency)); m_dsp.d_rptr = m_dsp.d_wptr = 0; m_dsp.dma_timer_started = true; } @@ -1523,7 +1523,7 @@ void sb_device::dack_w(int line, uint8_t data) // set the transfer timer on the 1st byte if (!m_dsp.dma_timer_started) { - m_timer->adjust(attotime::from_hz((double)m_dsp.frequency), 0, attotime::from_hz((double)m_dsp.frequency)); + m_timer->adjust_periodic(attotime::from_hz((double)m_dsp.frequency)); m_dsp.d_rptr = m_dsp.d_wptr = 0; m_dsp.dma_timer_started = true; } diff --git a/src/devices/bus/isa/sc499.cpp b/src/devices/bus/isa/sc499.cpp index a49d52a5d2a..8d796b3d2be 100644 --- a/src/devices/bus/isa/sc499.cpp +++ b/src/devices/bus/isa/sc499.cpp @@ -552,7 +552,7 @@ void sc499_device::device_timer(timer_instance const &timer) if (++m_underrun_counter >= 5000) { // stop tape (after 30 seconds) - probably the DMA handshake failed. - m_timer1->adjust(attotime::never, param, attotime::never); + m_timer1->adjust(attotime::never, param); m_status &= ~SC499_STAT_EXC; m_status &= ~SC499_STAT_DIR; tape_status_clear(SC499_ST_CLEAR_ALL); @@ -572,7 +572,7 @@ void sc499_device::device_timer(timer_instance const &timer) { LOG1(("timer_func param=%d status=%x tape_pos=%d - end-of-tape or not ready", param, m_status, m_tape_pos)); - m_timer1->adjust(attotime::never, param, attotime::never); + m_timer1->adjust(attotime::never, param); m_status &= ~SC499_STAT_EXC; m_status &= ~SC499_STAT_DIR; tape_status_clear(SC499_ST_CLEAR_ALL); @@ -594,7 +594,7 @@ void sc499_device::device_timer(timer_instance const &timer) m_underrun_counter = 0; if (block_is_filemark()) { - m_timer1->adjust(attotime::never, param, attotime::never); + m_timer1->adjust(attotime::never, param); } else if (m_current_command == SC499_CMD_READ_DATA) { @@ -801,7 +801,7 @@ void sc499_device::do_command(uint8_t data) set_interrupt(CLEAR_LINE); set_dma_drq(CLEAR_LINE); - m_timer1->adjust( attotime::never, SC499_TIMER_6, attotime::never); + m_timer1->adjust( attotime::never, SC499_TIMER_6); m_data_index = 0; m_timer->adjust( attotime::from_usec(100), SC499_TIMER_4); @@ -845,7 +845,7 @@ void sc499_device::do_reset() set_interrupt(CLEAR_LINE); set_dma_drq(CLEAR_LINE); - m_timer1->adjust( attotime::never, SC499_TIMER_6, attotime::never); + m_timer1->adjust( attotime::never, SC499_TIMER_6 ); } // ------------------------------------- diff --git a/src/devices/bus/isa/stereo_fx.cpp b/src/devices/bus/isa/stereo_fx.cpp index d8b8f3f28fb..13c1ede430f 100644 --- a/src/devices/bus/isa/stereo_fx.cpp +++ b/src/devices/bus/isa/stereo_fx.cpp @@ -216,7 +216,7 @@ void stereo_fx_device::device_start() m_isa->install_device(0x0388, 0x0389, read8sm_delegate(ym3812, FUNC(ym3812_device::read)), write8sm_delegate(ym3812, FUNC(ym3812_device::write))); m_isa->install_device(0x0228, 0x0229, read8sm_delegate(ym3812, FUNC(ym3812_device::read)), write8sm_delegate(ym3812, FUNC(ym3812_device::write))); m_timer = timer_alloc(); - m_timer->adjust(attotime::from_hz(2000000), 0, attotime::from_hz(2000000)); + m_timer->adjust_periodic(attotime::from_hz(2000000)); m_isa->set_dma_channel(1, this, false); } diff --git a/src/devices/bus/pc_kbd/hle_mouse.cpp b/src/devices/bus/pc_kbd/hle_mouse.cpp index 1521560d913..5a2743efbfb 100644 --- a/src/devices/bus/pc_kbd/hle_mouse.cpp +++ b/src/devices/bus/pc_kbd/hle_mouse.cpp @@ -151,7 +151,7 @@ void hle_ps2_mouse_device::resume() // start serial communication if (!m_serial->enabled()) - m_serial->adjust(serial_cycle, 0, serial_cycle); + m_serial->adjust_periodic(serial_cycle); } } @@ -442,7 +442,7 @@ void hle_ps2_mouse_device::command(u8 const command) case 0xf4: // enable data reporting LOGMASKED(LOG_COMMAND, "enable data reporting\n"); m_mode |= ENABLE; - m_sample->adjust(attotime::from_hz(m_sample_rate), 0, attotime::from_hz(m_sample_rate)); + m_sample->adjust_periodic(attotime::from_hz(m_sample_rate)); m_tx_buf[m_tx_len++] = 0xfa; break; diff --git a/src/devices/bus/pet/c2n.cpp b/src/devices/bus/pet/c2n.cpp index 88f33f03f46..dd053e8b91b 100644 --- a/src/devices/bus/pet/c2n.cpp +++ b/src/devices/bus/pet/c2n.cpp @@ -85,7 +85,7 @@ void c2n_device::device_start() { // allocate timers m_read_timer = timer_alloc(); - m_read_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); + m_read_timer->adjust_periodic(attotime::from_hz(44100)); } diff --git a/src/devices/bus/qbus/pc11.cpp b/src/devices/bus/qbus/pc11.cpp index 714c5633c38..e561a82627c 100644 --- a/src/devices/bus/qbus/pc11.cpp +++ b/src/devices/bus/qbus/pc11.cpp @@ -82,7 +82,7 @@ void pc11_device::device_start() // about 300 cps emu_timer *timer = timer_alloc(); - timer->adjust(attotime::from_usec(333), 0, attotime::from_usec(333)); + timer->adjust_periodic(attotime::from_usec(333)); } diff --git a/src/devices/bus/ti8x/bitsocket.cpp b/src/devices/bus/ti8x/bitsocket.cpp index 69ce649cefb..c16b66cd823 100644 --- a/src/devices/bus/ti8x/bitsocket.cpp +++ b/src/devices/bus/ti8x/bitsocket.cpp @@ -40,7 +40,7 @@ void bit_socket_device::device_start() m_tip_in = m_ring_in = true; - m_poll_timer->adjust(attotime::from_hz(200000), 0, attotime::from_hz(200000)); + m_poll_timer->adjust_periodic(attotime::from_hz(200000)); } diff --git a/src/devices/bus/ti99/joyport/mecmouse.cpp b/src/devices/bus/ti99/joyport/mecmouse.cpp index 27dc147b73d..cf71fbb837c 100644 --- a/src/devices/bus/ti99/joyport/mecmouse.cpp +++ b/src/devices/bus/ti99/joyport/mecmouse.cpp @@ -167,7 +167,7 @@ void mecmouse_device::device_start() // The poll time cannot depend on the console settings, since the TI-99/4A // has no clock line on the joystick port. The rate is not mentioned in // the specs; however, if it is too low, the mouse pointer will do jumps - m_poll_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); + m_poll_timer->adjust_periodic(attotime::from_hz(100)); save_item(NAME(m_last_select)); save_item(NAME(m_read_y_axis)); diff --git a/src/devices/bus/vcs/dpc.cpp b/src/devices/bus/vcs/dpc.cpp index a1facbbd2d4..1e8802665a0 100644 --- a/src/devices/bus/vcs/dpc.cpp +++ b/src/devices/bus/vcs/dpc.cpp @@ -58,7 +58,7 @@ void dpc_device::device_reset() elem.flag = 0; elem.music_mode = 0; } - m_oscillator->adjust(attotime::from_hz(18400), 0, attotime::from_hz(18400)); + m_oscillator->adjust_periodic(attotime::from_hz(18400)); } diff --git a/src/devices/bus/vip/vp550.cpp b/src/devices/bus/vip/vp550.cpp index 3250e10a286..b28d8c0e2ef 100644 --- a/src/devices/bus/vip/vp550.cpp +++ b/src/devices/bus/vip/vp550.cpp @@ -91,7 +91,7 @@ void vp550_device::device_start() { // allocate timers m_sync_timer = timer_alloc(); - m_sync_timer->adjust(attotime::from_hz(50), 0, attotime::from_hz(50)); + m_sync_timer->adjust_periodic(attotime::from_hz(50)); m_sync_timer->enable(0); } diff --git a/src/devices/cpu/hd61700/hd61700.cpp b/src/devices/cpu/hd61700/hd61700.cpp index 177929084ff..a27cc106a76 100644 --- a/src/devices/cpu/hd61700/hd61700.cpp +++ b/src/devices/cpu/hd61700/hd61700.cpp @@ -138,7 +138,7 @@ void hd61700_cpu_device::device_start() m_program = &space(AS_PROGRAM); m_sec_timer = timer_alloc(SEC_TIMER); - m_sec_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_sec_timer->adjust_periodic(attotime::from_seconds(1)); m_lcd_ctrl_cb.resolve_safe(); m_lcd_read_cb.resolve_safe(0xff); diff --git a/src/devices/cpu/lc8670/lc8670.cpp b/src/devices/cpu/lc8670/lc8670.cpp index 6a3723239e6..3b646a65fc6 100644 --- a/src/devices/cpu/lc8670/lc8670.cpp +++ b/src/devices/cpu/lc8670/lc8670.cpp @@ -208,7 +208,7 @@ void lc8670_cpu_device::device_start() // setup timers m_basetimer = timer_alloc(BASE_TIMER); - m_basetimer->adjust(attotime::from_hz(m_clocks[unsigned(clock_source::SUB)]), 0, attotime::from_hz(m_clocks[unsigned(clock_source::SUB)])); + m_basetimer->adjust_periodic(attotime::from_hz(m_clocks[unsigned(clock_source::SUB)])); m_clocktimer = timer_alloc(CLOCK_TIMER); // register state for debugger @@ -1185,7 +1185,7 @@ inline void lc8670_cpu_device::change_clock_source() set_unscaled_clock(new_clock); set_clock_scale(1.0 / (REG_OCR & 0x80 ? 6.0 : 12.0)); - m_clocktimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_clocktimer->adjust_periodic(attotime::from_hz(clock())); m_clock_changed = false; } diff --git a/src/devices/cpu/m6502/m5074x.cpp b/src/devices/cpu/m6502/m5074x.cpp index 8ea41ff2258..29124378f3d 100644 --- a/src/devices/cpu/m6502/m5074x.cpp +++ b/src/devices/cpu/m6502/m5074x.cpp @@ -236,13 +236,13 @@ void m5074x_device::recalc_timer(int timer) case 0: hz = clock() / 16; hz /= (m_tmr12pre + 2); - m_timers[TIMER_1]->adjust(attotime::from_hz(hz), 0, attotime::from_hz(hz)); + m_timers[TIMER_1]->adjust_periodic(attotime::from_hz(hz)); break; case 1: hz = clock() / 16; hz /= (m_tmr12pre + 2); - m_timers[TIMER_2]->adjust(attotime::from_hz(hz), 0, attotime::from_hz(hz)); + m_timers[TIMER_2]->adjust_periodic(attotime::from_hz(hz)); break; case 2: @@ -253,13 +253,13 @@ void m5074x_device::recalc_timer(int timer) // stop bit? if (m_tmrctrl & TMRC_TMRXHLT) { - m_timers[TIMER_X]->adjust(attotime::never, 0, attotime::never); + m_timers[TIMER_X]->adjust(attotime::never); } else { hz = clock() / 16; hz /= (m_tmrxpre + 2); - m_timers[TIMER_X]->adjust(attotime::from_hz(hz), 0, attotime::from_hz(hz)); + m_timers[TIMER_X]->adjust_periodic(attotime::from_hz(hz)); } } else diff --git a/src/devices/cpu/m6502/st2xxx.cpp b/src/devices/cpu/m6502/st2xxx.cpp index 68164c60dc3..1c6cb1e5bc5 100644 --- a/src/devices/cpu/m6502/st2xxx.cpp +++ b/src/devices/cpu/m6502/st2xxx.cpp @@ -747,7 +747,7 @@ void st2xxx_device::lfr_recalculate_period() assert(clocks != 0); attotime period = cycles_to_attotime(clocks); LOGMASKED(LOG_LCDC, "LCD frame rate = %f Hz (PC = $%04X)\n", period.as_hz(), PPC); - m_lcd_timer->adjust(period, 0, period); + m_lcd_timer->adjust_periodic(period); } else m_lcd_timer->adjust(attotime::never); diff --git a/src/devices/cpu/m6800/m6801.cpp b/src/devices/cpu/m6800/m6801.cpp index b31159e2f84..0db753db253 100644 --- a/src/devices/cpu/m6800/m6801.cpp +++ b/src/devices/cpu/m6800/m6801.cpp @@ -692,7 +692,7 @@ void m6801_cpu_device::set_rmcr(uint8_t data) int divisor = M6801_RMCR_SS[m_rmcr & M6801_RMCR_SS_MASK]; attotime period = cycles_to_attotime(divisor); LOGSER("SCI: Setting serial rate, Divisor: %d Hz: %d\n", divisor, period.as_hz()); - m_sci_timer->adjust(period, 0, period); + m_sci_timer->adjust_periodic(period); m_use_ext_serclock = false; } break; @@ -730,7 +730,7 @@ void hd6301x_cpu_device::set_rmcr(uint8_t data) int divisor = M6801_RMCR_SS[m_rmcr & M6801_RMCR_SS_MASK]; attotime period = cycles_to_attotime(divisor); LOGSER("SCI: Setting serial rate, Divisor: %d Hz: %d\n", divisor, period.as_hz()); - m_sci_timer->adjust(period, 0, period); + m_sci_timer->adjust_periodic(period); } m_use_ext_serclock = false; break; diff --git a/src/devices/cpu/mb88xx/mb88xx.cpp b/src/devices/cpu/mb88xx/mb88xx.cpp index aff96787497..75da89065bc 100644 --- a/src/devices/cpu/mb88xx/mb88xx.cpp +++ b/src/devices/cpu/mb88xx/mb88xx.cpp @@ -385,7 +385,7 @@ void mb88_cpu_device::update_pio_enable( uint8_t newpio ) if ((newpio & 0x30) == 0) m_serial->adjust(attotime::never); else if ((newpio & 0x30) == 0x20) - m_serial->adjust(attotime::from_hz(clock() / SERIAL_PRESCALE), 0, attotime::from_hz(clock() / SERIAL_PRESCALE)); + m_serial->adjust_periodic(attotime::from_hz(clock() / SERIAL_PRESCALE)); else fatalerror("mb88xx: update_pio_enable set serial enable to unsupported value %02X\n", newpio & 0x30); } @@ -744,7 +744,7 @@ void mb88_cpu_device::execute_run() { /* re-enable the timer if we disabled it previously */ if (m_SBcount >= SERIAL_DISABLE_THRESH) - m_serial->adjust(attotime::from_hz(clock() / SERIAL_PRESCALE), 0, attotime::from_hz(clock() / SERIAL_PRESCALE)); + m_serial->adjust_periodic(attotime::from_hz(clock() / SERIAL_PRESCALE)); m_SBcount = 0; } m_sf = 0; diff --git a/src/devices/cpu/nec/v25.cpp b/src/devices/cpu/nec/v25.cpp index 50c8fe30a83..599b6246b5d 100644 --- a/src/devices/cpu/nec/v25.cpp +++ b/src/devices/cpu/nec/v25.cpp @@ -224,7 +224,7 @@ void v25_common_device::device_reset() unsigned tmp = m_PCK << m_TB; attotime time = clocks_to_attotime(tmp); - m_timers[3]->adjust(time, INTTB, time); + m_timers[3]->adjust_periodic(time, INTTB); m_timers[0]->adjust(attotime::never); m_timers[1]->adjust(attotime::never); diff --git a/src/devices/cpu/nec/v25sfr.cpp b/src/devices/cpu/nec/v25sfr.cpp index 81d9d5569b0..e1fff1a3c0b 100644 --- a/src/devices/cpu/nec/v25sfr.cpp +++ b/src/devices/cpu/nec/v25sfr.cpp @@ -413,7 +413,7 @@ void v25_common_device::tmc0_w(uint8_t d) { unsigned tmp = m_PCK * m_MD0 * (BIT(d, 6) ? 128 : 6); attotime time = clocks_to_attotime(tmp); - m_timers[0]->adjust(time, INTTU0, time); + m_timers[0]->adjust_periodic(time, INTTU0); m_timers[1]->adjust(attotime::never); m_TM0 = m_MD0; } @@ -432,7 +432,7 @@ void v25_common_device::tmc1_w(uint8_t d) { unsigned tmp = m_PCK * m_MD1 * (BIT(d, 6) ? 128 : 6); attotime time = clocks_to_attotime(tmp); - m_timers[2]->adjust(time, INTTU2, time); + m_timers[2]->adjust_periodic(time, INTTU2); m_TM1 = m_MD1; } else @@ -563,7 +563,7 @@ void v25_common_device::prc_w(uint8_t d) unsigned tmp = m_PCK << m_TB; attotime time = clocks_to_attotime(tmp); - m_timers[3]->adjust(time, INTTB, time); + m_timers[3]->adjust_periodic(time, INTTB); notify_clock_changed(); // make device_execute_interface pick up the new clocks_to_cycles() logerror(" Internal RAM %sabled\n", (m_RAMEN ? "en" : "dis")); diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp index b96eebeae31..faabb69949e 100644 --- a/src/devices/cpu/powerpc/ppccom.cpp +++ b/src/devices/cpu/powerpc/ppccom.cpp @@ -2687,7 +2687,7 @@ void ppc_device::ppc4xx_spu_timer_reset() int divisor = ((m_spu.regs[SPU4XX_BAUD_DIVISOR_H] * 256 + m_spu.regs[SPU4XX_BAUD_DIVISOR_L]) & 0xfff) + 1; int bpc = 7 + ((m_spu.regs[SPU4XX_CONTROL] & 8) >> 3) + 1 + (m_spu.regs[SPU4XX_CONTROL] & 1); attotime charperiod = clockperiod * (divisor * 16 * bpc); - m_spu.timer->adjust(charperiod, 0, charperiod); + m_spu.timer->adjust_periodic(charperiod); if (PRINTF_SPU) printf("ppc4xx_spu_timer_reset: baud rate = %.0f\n", charperiod.as_hz() * bpc); } diff --git a/src/devices/cpu/sc61860/sc61860.cpp b/src/devices/cpu/sc61860/sc61860.cpp index a171c275b46..688963120a9 100644 --- a/src/devices/cpu/sc61860/sc61860.cpp +++ b/src/devices/cpu/sc61860/sc61860.cpp @@ -107,7 +107,7 @@ void sc61860_device::device_reset() void sc61860_device::device_start() { m_2ms_tick_timer = timer_alloc(*this, FUNC(sc61860_device::sc61860_2ms_tick)); - m_2ms_tick_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500)); + m_2ms_tick_timer->adjust_periodic(attotime::from_hz(500)); space(AS_PROGRAM).cache(m_cache); space(AS_PROGRAM).specific(m_program); diff --git a/src/devices/cpu/sm510/sm510base.cpp b/src/devices/cpu/sm510/sm510base.cpp index 27fe81e5161..307df3c1a9f 100644 --- a/src/devices/cpu/sm510/sm510base.cpp +++ b/src/devices/cpu/sm510/sm510base.cpp @@ -218,7 +218,7 @@ void sm510_base_device::init_lcd_driver() // note: in reality, this timer runs at high frequency off the main divider, strobing one segment at a time m_lcd_timer = timer_alloc(*this, FUNC(sm510_base_device::lcd_timer_cb)); attotime period = attotime::from_ticks(0x20, unscaled_clock()); // default 1kHz - m_lcd_timer->adjust(period, 0, period); + m_lcd_timer->adjust_periodic(period); } @@ -267,7 +267,7 @@ TIMER_CALLBACK_MEMBER(sm510_base_device::div_timer_cb) void sm510_base_device::init_divider() { m_div_timer = timer_alloc(*this, FUNC(sm510_base_device::div_timer_cb)); - m_div_timer->adjust(attotime::from_ticks(1, unscaled_clock()), 0, attotime::from_ticks(1, unscaled_clock())); + m_div_timer->adjust_periodic(attotime::from_ticks(1, unscaled_clock())); } diff --git a/src/devices/cpu/tlcs90/tlcs90.cpp b/src/devices/cpu/tlcs90/tlcs90.cpp index 1f6e60331d3..3728de785bd 100644 --- a/src/devices/cpu/tlcs90/tlcs90.cpp +++ b/src/devices/cpu/tlcs90/tlcs90.cpp @@ -2720,7 +2720,7 @@ void tlcs90_device::t90_start_timer(int i) period = m_timer_period * prescaler; - m_timer[i]->adjust(period, i, period); + m_timer[i]->adjust_periodic(period, i); logerror("%04X: CPU Timer %d started at %f Hz\n", m_pc.w.l, i, 1.0 / period.as_double()); } @@ -2742,7 +2742,7 @@ void tlcs90_device::t90_start_timer4() period = m_timer_period * prescaler; - m_timer[4]->adjust(period, 4, period); + m_timer[4]->adjust_periodic(period, 4); logerror("%04X: CPU Timer 4 started at %f Hz\n", m_pc.w.l, 1.0 / period.as_double()); } diff --git a/src/devices/imagedev/avivideo.cpp b/src/devices/imagedev/avivideo.cpp index 4cd1c2fcf5c..44de7d8b486 100644 --- a/src/devices/imagedev/avivideo.cpp +++ b/src/devices/imagedev/avivideo.cpp @@ -97,7 +97,7 @@ image_init_result avivideo_image_device::call_load() const avi_file::movie_info &aviinfo = m_avi->get_movie_info(); float frame_rate = (float)aviinfo.video_timescale / (float)aviinfo.video_sampletime; attotime frame_time = attotime::from_hz((int)round(frame_rate)); - m_frame_timer->adjust(frame_time, 0, frame_time); + m_frame_timer->adjust_periodic(frame_time); m_frame_count = aviinfo.video_numsamples; m_frame_num = 0; return image_init_result::PASS; diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp index 2b701eef22a..9065c82435b 100644 --- a/src/devices/imagedev/mfmhd.cpp +++ b/src/devices/imagedev/mfmhd.cpp @@ -361,7 +361,7 @@ void mfm_harddisk_device::device_start() m_cache_timer = timer_alloc(CACHE_TM); m_rev_time = attotime::from_hz(m_rpm/60); - m_index_timer->adjust(attotime::from_hz(m_rpm/60), 0, attotime::from_hz(m_rpm/60)); + m_index_timer->adjust_periodic(attotime::from_hz(m_rpm/60)); m_current_cylinder = m_landing_zone; // Park position m_spinup_timer->adjust(attotime::from_msec(m_spinupms)); @@ -369,7 +369,7 @@ void mfm_harddisk_device::device_start() m_cache = std::make_unique<mfmhd_trackimage_cache>(machine()); // In 5 second periods, check whether the cache has dirty lines - m_cache_timer->adjust(attotime::from_msec(5000), 0, attotime::from_msec(5000)); + m_cache_timer->adjust_periodic(attotime::from_msec(5000)); save_item(NAME(m_max_cylinders)); save_item(NAME(m_phys_cylinders)); diff --git a/src/devices/imagedev/midiin.cpp b/src/devices/imagedev/midiin.cpp index 3c8e71f30d1..e78e01b3b9a 100644 --- a/src/devices/imagedev/midiin.cpp +++ b/src/devices/imagedev/midiin.cpp @@ -152,7 +152,7 @@ image_init_result midiin_device::call_load() return image_init_result::FAIL; } - m_timer->adjust(attotime::from_hz(1500), 0, attotime::from_hz(1500)); + m_timer->adjust_periodic(attotime::from_hz(1500)); return image_init_result::PASS; } } diff --git a/src/devices/machine/68230pit.cpp b/src/devices/machine/68230pit.cpp index 16b25955048..fe60cb1c07e 100644 --- a/src/devices/machine/68230pit.cpp +++ b/src/devices/machine/68230pit.cpp @@ -674,13 +674,13 @@ void pit68230_device::wr_pitreg_tcr(uint8_t data) if (clk == 1) { int rate = clock() / (psc == 1 ? 32 : 1); - pit_timer->adjust(attotime::from_hz(rate), TIMER_ID_PIT, attotime::from_hz(rate)); + pit_timer->adjust_periodic(attotime::from_hz(rate), TIMER_ID_PIT); LOG("PIT timer started @ rate: %d and CLK: %d,\n", rate, clock()); } } else { - pit_timer->adjust(attotime::never, TIMER_ID_PIT, attotime::never); + pit_timer->adjust(attotime::never, TIMER_ID_PIT); } } diff --git a/src/devices/machine/8042kbdc.cpp b/src/devices/machine/8042kbdc.cpp index 2789da21dfd..b0b7265486d 100644 --- a/src/devices/machine/8042kbdc.cpp +++ b/src/devices/machine/8042kbdc.cpp @@ -100,7 +100,7 @@ void kbdc8042_device::device_reset() m_mouse_y = 0; m_mouse_btn = 0; - m_update_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); + m_update_timer->adjust_periodic(attotime::from_hz(100)); } void kbdc8042_device::at_8042_set_outport(uint8_t data, int initial) diff --git a/src/devices/machine/8530scc.cpp b/src/devices/machine/8530scc.cpp index f90fa48734a..7096c8b791d 100644 --- a/src/devices/machine/8530scc.cpp +++ b/src/devices/machine/8530scc.cpp @@ -146,11 +146,11 @@ void scc8530_legacy_device::device_timer(timer_instance const &timer) if (rate) { attotime attorate = attotime::from_hz(rate); - pChan->baudtimer->adjust(attorate, 0, attorate); + pChan->baudtimer->adjust_periodic(attorate); } else { - pChan->baudtimer->adjust(attotime::never, 0, attotime::never); + pChan->baudtimer->adjust(attotime::never); } } @@ -401,7 +401,7 @@ void scc8530_legacy_device::putreg(int ch, uint8_t data) int brconst = pChan->reg_val[13]<<8 | pChan->reg_val[14]; int rate = clock() / brconst; - pChan->baudtimer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); + pChan->baudtimer->adjust_periodic(attotime::from_hz(rate)); } break; diff --git a/src/devices/machine/aicartc.cpp b/src/devices/machine/aicartc.cpp index fea8ac9f127..862d8900427 100644 --- a/src/devices/machine/aicartc.cpp +++ b/src/devices/machine/aicartc.cpp @@ -55,7 +55,7 @@ void aicartc_device::device_validity_check(validity_checker &valid) const void aicartc_device::device_start() { m_clock_timer = timer_alloc(); - m_clock_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_clock_timer->adjust_periodic(attotime::from_hz(clock())); } diff --git a/src/devices/machine/am2910.cpp b/src/devices/machine/am2910.cpp index 048c6d580e2..8e3607bd6c4 100644 --- a/src/devices/machine/am2910.cpp +++ b/src/devices/machine/am2910.cpp @@ -83,7 +83,7 @@ void am2910_device::device_reset() memset(m_stack, 0, sizeof(uint16_t) * 5); if (m_execute_timer) - m_execute_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_execute_timer->adjust_periodic(attotime::from_hz(clock())); } void am2910_device::device_timer(timer_instance const &timer) diff --git a/src/devices/machine/am79c90.cpp b/src/devices/machine/am79c90.cpp index d7ce069ed42..08dc1695a98 100644 --- a/src/devices/machine/am79c90.cpp +++ b/src/devices/machine/am79c90.cpp @@ -88,7 +88,7 @@ void am7990_device_base::device_start() m_dma_out_cb.resolve_safe(); m_transmit_poll = timer_alloc(*this, FUNC(am7990_device_base::transmit_poll)); - m_transmit_poll->adjust(TX_POLL_PERIOD, 0, TX_POLL_PERIOD); + m_transmit_poll->adjust_periodic(TX_POLL_PERIOD); save_item(NAME(m_rap)); save_item(NAME(m_csr)); diff --git a/src/devices/machine/arm_iomd.cpp b/src/devices/machine/arm_iomd.cpp index dcb5d4cac87..bb2d8f69ff4 100644 --- a/src/devices/machine/arm_iomd.cpp +++ b/src/devices/machine/arm_iomd.cpp @@ -502,7 +502,7 @@ inline void arm_iomd_device::trigger_timer(unsigned Which) if(val==0) m_timer[Which]->adjust(attotime::never); else - m_timer[Which]->adjust(attotime::from_usec(val), 0, attotime::from_usec(val)); + m_timer[Which]->adjust_periodic(attotime::from_usec(val)); } // TODO: live updates aren't really supported here diff --git a/src/devices/machine/bq4847.cpp b/src/devices/machine/bq4847.cpp index 11420baf1a0..44cd6aee434 100644 --- a/src/devices/machine/bq4847.cpp +++ b/src/devices/machine/bq4847.cpp @@ -410,7 +410,7 @@ void bq4847_device::set_periodic_timer() if (rateval == 0) m_periodic_timer->reset(); else - m_periodic_timer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); + m_periodic_timer->adjust_periodic(attotime::from_hz(rate)); } void bq4847_device::set_watchdog_timer(bool on) @@ -488,7 +488,7 @@ void bq4847_device::connect_osc(bool conn) if (conn) { // The internal update cycle is 1 sec - m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_clock_timer->adjust_periodic(attotime::from_seconds(1)); set_periodic_timer(); } else diff --git a/src/devices/machine/bq48x2.cpp b/src/devices/machine/bq48x2.cpp index 59a937e6763..fa38098bc38 100644 --- a/src/devices/machine/bq48x2.cpp +++ b/src/devices/machine/bq48x2.cpp @@ -343,7 +343,7 @@ void bq48x2_device::write(offs_t address, uint8_t data) case reg_days: if (data & FLAG_FTE) // Test mode - m_periodic_timer->adjust(attotime::from_hz(1024), 0, attotime::from_hz(1024)); + m_periodic_timer->adjust_periodic(attotime::from_hz(1024)); else { // reset to periodic timing @@ -401,14 +401,14 @@ void bq48x2_device::set_periodic_timer() m_periodic_timer->reset(); break; case 1: - m_periodic_timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10)); + m_periodic_timer->adjust_periodic(attotime::from_msec(10)); break; case 2: - m_periodic_timer->adjust(attotime::from_msec(100), 0, attotime::from_msec(100)); + m_periodic_timer->adjust_periodic(attotime::from_msec(100)); break; default: rate = 1 << (16-rateval); - m_periodic_timer->adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); + m_periodic_timer->adjust_periodic(attotime::from_hz(rate)); break; } } diff --git a/src/devices/machine/busmouse.cpp b/src/devices/machine/busmouse.cpp index b0daf5ad454..47daa44ec63 100644 --- a/src/devices/machine/busmouse.cpp +++ b/src/devices/machine/busmouse.cpp @@ -156,7 +156,7 @@ void bus_mouse_device::device_reset() { int hz = 2 * 15 * ioport("irq_rate")->read(); - m_irq_timer->adjust(attotime::from_hz(hz), 0, attotime::from_hz(hz)); + m_irq_timer->adjust_periodic(attotime::from_hz(hz)); irq = 0; irq_disabled = 1; diff --git a/src/devices/machine/cdp1879.cpp b/src/devices/machine/cdp1879.cpp index 4a21a360ef7..96430fd03bd 100644 --- a/src/devices/machine/cdp1879.cpp +++ b/src/devices/machine/cdp1879.cpp @@ -37,7 +37,7 @@ void cdp1879_device::device_start() { // allocate timers m_clock_timer = timer_alloc(); - m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_clock_timer->adjust_periodic(attotime::from_seconds(1)); m_irq_w.resolve_safe(); diff --git a/src/devices/machine/com8116.cpp b/src/devices/machine/com8116.cpp index b68f8826fa1..bd986460a07 100644 --- a/src/devices/machine/com8116.cpp +++ b/src/devices/machine/com8116.cpp @@ -143,7 +143,7 @@ void com8116_device::device_start() if (!m_fx4_handler.isnull()) { m_fx4_timer = timer_alloc(TIMER_FX4); - m_fx4_timer->adjust(attotime::from_hz((clock() / 4) * 2), 0, attotime::from_hz((clock() / 4)) * 2); + m_fx4_timer->adjust_periodic(attotime::from_hz((clock() / 4) * 2)); } m_fr_timer = timer_alloc(TIMER_FR); m_ft_timer = timer_alloc(TIMER_FT); diff --git a/src/devices/machine/dp8573.cpp b/src/devices/machine/dp8573.cpp index aa1ab164cab..0260278a9ba 100644 --- a/src/devices/machine/dp8573.cpp +++ b/src/devices/machine/dp8573.cpp @@ -46,7 +46,7 @@ void dp8573_device::device_start() m_tscr = 0; - m_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + m_timer->adjust_periodic(attotime::from_msec(1)); } void dp8573_device::sync_time() diff --git a/src/devices/machine/ds1302.cpp b/src/devices/machine/ds1302.cpp index 1d0d3376483..54c8334d9c3 100644 --- a/src/devices/machine/ds1302.cpp +++ b/src/devices/machine/ds1302.cpp @@ -102,7 +102,7 @@ void ds1302_device::device_start() { // allocate timers m_clock_timer = timer_alloc(); - m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 32768)); m_clk = 0; m_ce = 0; diff --git a/src/devices/machine/ds1386.cpp b/src/devices/machine/ds1386.cpp index 7d45b6cc686..9db09844e25 100644 --- a/src/devices/machine/ds1386.cpp +++ b/src/devices/machine/ds1386.cpp @@ -111,7 +111,7 @@ void ds1386_device::device_start() // allocate timers m_clock_timer = timer_alloc(CLOCK_TIMER); - m_clock_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); + m_clock_timer->adjust_periodic(attotime::from_hz(100)); m_square_timer = timer_alloc(SQUAREWAVE_TIMER); m_square_timer->adjust(attotime::never); m_watchdog_timer = timer_alloc(WATCHDOG_TIMER); diff --git a/src/devices/machine/ds1994.cpp b/src/devices/machine/ds1994.cpp index 7c84d37e51f..1390f3eab53 100644 --- a/src/devices/machine/ds1994.cpp +++ b/src/devices/machine/ds1994.cpp @@ -119,7 +119,7 @@ void ds1994_device::device_start() m_timer_reset = timer_alloc(TIMER_RESET); m_timer_clock = timer_alloc(TIMER_CLOCK); - m_timer_clock->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); + m_timer_clock->adjust_periodic(attotime::from_hz(256)); } void ds1994_device::device_reset() diff --git a/src/devices/machine/ds2404.cpp b/src/devices/machine/ds2404.cpp index d2b54b0f79a..704e7b10db0 100644 --- a/src/devices/machine/ds2404.cpp +++ b/src/devices/machine/ds2404.cpp @@ -74,7 +74,7 @@ void ds2404_device::device_start() elem = STATE_IDLE; m_tick_timer = timer_alloc(0); - m_tick_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); + m_tick_timer->adjust_periodic(attotime::from_hz(256)); } diff --git a/src/devices/machine/e0516.cpp b/src/devices/machine/e0516.cpp index 2833c150e8b..fb3ea2731ee 100644 --- a/src/devices/machine/e0516.cpp +++ b/src/devices/machine/e0516.cpp @@ -55,7 +55,7 @@ void e0516_device::device_start() { // allocate timers m_timer = timer_alloc(); - m_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_timer->adjust_periodic(attotime::from_hz(clock() / 32768)); // state saving save_item(NAME(m_cs)); diff --git a/src/devices/machine/fga002.cpp b/src/devices/machine/fga002.cpp index a1891fd481a..d111f3659b3 100644 --- a/src/devices/machine/fga002.cpp +++ b/src/devices/machine/fga002.cpp @@ -154,7 +154,7 @@ void fga002_device::device_timer(timer_instance const &timer) { if ((m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_ZERO_STOP) == 0) { - fga_timer->adjust(attotime::never, TIMER_ID_FGA, attotime::never); + fga_timer->adjust(attotime::never, TIMER_ID_FGA); } else { @@ -408,27 +408,27 @@ void fga002_device::do_fga002reg_tim0ctl_w(uint8_t data) if ((data & REG_TIM0CTL_START_STOP) != (m_fga002[FGA_TIM0CTL] & REG_TIM0CTL_START_STOP)) { if ((data & REG_TIM0CTL_START_STOP) == 0) - fga_timer->adjust(attotime::never, TIMER_ID_FGA, attotime::never); + fga_timer->adjust(attotime::never, TIMER_ID_FGA); else { switch (data & REG_TIM0CTL_CLK_MSK) { - case REG_TIM0CTL_CLK_1_MIC: fga_timer->adjust(attotime::from_usec(1), TIMER_ID_FGA, attotime::from_usec(1)); break; - case REG_TIM0CTL_CLK_2_MIC: fga_timer->adjust(attotime::from_usec(2), TIMER_ID_FGA, attotime::from_usec(2)); break; - case REG_TIM0CTL_CLK_4_MIC: fga_timer->adjust(attotime::from_usec(4), TIMER_ID_FGA, attotime::from_usec(4)); break; - case REG_TIM0CTL_CLK_8_MIC: fga_timer->adjust(attotime::from_usec(8), TIMER_ID_FGA, attotime::from_usec(8)); break; - case REG_TIM0CTL_CLK_16_MIC: fga_timer->adjust(attotime::from_usec(16), TIMER_ID_FGA, attotime::from_usec(16)); break; - case REG_TIM0CTL_CLK_32_MIC: fga_timer->adjust(attotime::from_usec(32), TIMER_ID_FGA, attotime::from_usec(32)); break; - case REG_TIM0CTL_CLK_64_MIC: fga_timer->adjust(attotime::from_usec(64), TIMER_ID_FGA, attotime::from_usec(64)); break; - case REG_TIM0CTL_CLK_128_MIC: fga_timer->adjust(attotime::from_usec(128), TIMER_ID_FGA, attotime::from_usec(128)); break; - case REG_TIM0CTL_CLK_256_MIC: fga_timer->adjust(attotime::from_usec(256), TIMER_ID_FGA, attotime::from_usec(256)); break; - case REG_TIM0CTL_CLK_512_MIC: fga_timer->adjust(attotime::from_usec(512), TIMER_ID_FGA, attotime::from_usec(512)); break; - case REG_TIM0CTL_CLK_2_MIL: fga_timer->adjust(attotime::from_msec(2), TIMER_ID_FGA, attotime::from_msec(2)); break; - case REG_TIM0CTL_CLK_8_MIL: fga_timer->adjust(attotime::from_msec(8), TIMER_ID_FGA, attotime::from_msec(8)); break; - case REG_TIM0CTL_CLK_32_MIL: fga_timer->adjust(attotime::from_msec(32), TIMER_ID_FGA, attotime::from_msec(32)); break; - case REG_TIM0CTL_CLK_125_MIL: fga_timer->adjust(attotime::from_msec(125), TIMER_ID_FGA, attotime::from_msec(125)); break; - case REG_TIM0CTL_CLK_500_MIL: fga_timer->adjust(attotime::from_msec(500), TIMER_ID_FGA, attotime::from_msec(500)); break; - case REG_TIM0CTL_CLK_2_SEC: fga_timer->adjust(attotime::from_seconds(2), TIMER_ID_FGA, attotime::from_seconds(2)); break; + case REG_TIM0CTL_CLK_1_MIC: fga_timer->adjust_periodic(attotime::from_usec(1), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_2_MIC: fga_timer->adjust_periodic(attotime::from_usec(2), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_4_MIC: fga_timer->adjust_periodic(attotime::from_usec(4), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_8_MIC: fga_timer->adjust_periodic(attotime::from_usec(8), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_16_MIC: fga_timer->adjust_periodic(attotime::from_usec(16), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_32_MIC: fga_timer->adjust_periodic(attotime::from_usec(32), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_64_MIC: fga_timer->adjust_periodic(attotime::from_usec(64), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_128_MIC: fga_timer->adjust_periodic(attotime::from_usec(128), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_256_MIC: fga_timer->adjust_periodic(attotime::from_usec(256), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_512_MIC: fga_timer->adjust_periodic(attotime::from_usec(512), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_2_MIL: fga_timer->adjust_periodic(attotime::from_msec(2), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_8_MIL: fga_timer->adjust_periodic(attotime::from_msec(8), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_32_MIL: fga_timer->adjust_periodic(attotime::from_msec(32), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_125_MIL: fga_timer->adjust_periodic(attotime::from_msec(125), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_500_MIL: fga_timer->adjust_periodic(attotime::from_msec(500), TIMER_ID_FGA); break; + case REG_TIM0CTL_CLK_2_SEC: fga_timer->adjust_periodic(attotime::from_seconds(2), TIMER_ID_FGA); break; default: logerror("REG_TIM0CTL programmer error, please report\n"); break; // Should never happen } } diff --git a/src/devices/machine/generalplus_gpl16250soc.cpp b/src/devices/machine/generalplus_gpl16250soc.cpp index b85c98a13d8..4653b5296bc 100644 --- a/src/devices/machine/generalplus_gpl16250soc.cpp +++ b/src/devices/machine/generalplus_gpl16250soc.cpp @@ -1628,7 +1628,7 @@ void sunplus_gcm394_base_device::device_reset() m_system_dma_memtype = 0x0000; - m_unk_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); + m_unk_timer->adjust_periodic(attotime::from_hz(60)); m_spg_video->set_video_spaces(this->space(AS_PROGRAM), *m_cs_space, m_csbase); m_spg_video->reset(); diff --git a/src/devices/machine/hd63450.cpp b/src/devices/machine/hd63450.cpp index a747e98060c..745157e84d0 100644 --- a/src/devices/machine/hd63450.cpp +++ b/src/devices/machine/hd63450.cpp @@ -307,9 +307,9 @@ void hd63450_device::dma_transfer_start(int channel) else if (!(m_reg[channel].ocr & 2)) m_timer[channel]->adjust(attotime::from_usec(500), channel, m_our_clock[channel]); else if ((m_reg[channel].ocr & 3) == 3) - m_timer[channel]->adjust(attotime::from_usec(500), channel, attotime::never); + m_timer[channel]->adjust(attotime::from_usec(500), channel); else if ((m_reg[channel].ocr & 3) == 2) - m_timer[channel]->adjust(attotime::never, channel, attotime::never); + m_timer[channel]->adjust(attotime::never, channel); m_transfer_size[channel] = m_reg[channel].mtc; @@ -534,7 +534,7 @@ WRITE_LINE_MEMBER(hd63450_device::drq0_w) { // in cycle steal mode drq is supposed to be edge triggered single_transfer(0); - m_timer[0]->adjust(m_our_clock[0], 0, m_our_clock[0]); + m_timer[0]->adjust_periodic(m_our_clock[0], 0); } else if (!state) m_timer[0]->adjust(attotime::never); @@ -548,7 +548,7 @@ WRITE_LINE_MEMBER(hd63450_device::drq1_w) if ((m_reg[1].ocr & 2) && (state && !ostate)) { single_transfer(1); - m_timer[1]->adjust(m_our_clock[1], 1, m_our_clock[1]); + m_timer[1]->adjust_periodic(m_our_clock[1], 1); } else if (!state) m_timer[1]->adjust(attotime::never); @@ -562,7 +562,7 @@ WRITE_LINE_MEMBER(hd63450_device::drq2_w) if ((m_reg[2].ocr & 2) && (state && !ostate)) { single_transfer(2); - m_timer[2]->adjust(m_our_clock[2], 2, m_our_clock[2]); + m_timer[2]->adjust_periodic(m_our_clock[2], 2); } else if (!state) m_timer[2]->adjust(attotime::never); @@ -576,7 +576,7 @@ WRITE_LINE_MEMBER(hd63450_device::drq3_w) if ((m_reg[3].ocr & 2) && (state && !ostate)) { single_transfer(3); - m_timer[3]->adjust(m_our_clock[3], 3, m_our_clock[3]); + m_timer[3]->adjust_periodic(m_our_clock[3], 3); } else if (!state) m_timer[3]->adjust(attotime::never); diff --git a/src/devices/machine/hd64610.cpp b/src/devices/machine/hd64610.cpp index 3c9b067592b..a4f28a13f08 100644 --- a/src/devices/machine/hd64610.cpp +++ b/src/devices/machine/hd64610.cpp @@ -175,7 +175,7 @@ void hd64610_device::device_start() // allocate timers m_counter_timer = timer_alloc(TIMER_UPDATE_COUNTER); - m_counter_timer->adjust(attotime::from_hz(clock() / 256), 0, attotime::from_hz(clock() / 256)); + m_counter_timer->adjust_periodic(attotime::from_hz(clock() / 256)); // state saving save_item(NAME(m_regs)); diff --git a/src/devices/machine/i8279.cpp b/src/devices/machine/i8279.cpp index ed58648166e..9305c187d4b 100644 --- a/src/devices/machine/i8279.cpp +++ b/src/devices/machine/i8279.cpp @@ -181,7 +181,7 @@ void i8279_device::timer_adjust() if (m_scanclock != new_clock) { - m_timer->adjust(attotime::from_ticks(64, new_clock), 0, attotime::from_ticks(64, new_clock)); + m_timer->adjust_periodic(attotime::from_ticks(64, new_clock)); m_scanclock = new_clock; } diff --git a/src/devices/machine/icm7170.cpp b/src/devices/machine/icm7170.cpp index 534b5c4c4c7..65d6248ce6b 100644 --- a/src/devices/machine/icm7170.cpp +++ b/src/devices/machine/icm7170.cpp @@ -90,7 +90,7 @@ void icm7170_device::device_start() m_timer = timer_alloc(ICM7170_TIMER_ID); // TODO: frequency should be based on input clock and divisor - m_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); + m_timer->adjust_periodic(attotime::from_hz(100)); m_timer->enable(false); save_item(NAME(m_regs)); diff --git a/src/devices/machine/kb3600.cpp b/src/devices/machine/kb3600.cpp index 1cb3960be48..86e88ddf8f2 100644 --- a/src/devices/machine/kb3600.cpp +++ b/src/devices/machine/kb3600.cpp @@ -83,7 +83,7 @@ void ay3600_device::device_start() // allocate timers m_scan_timer = timer_alloc(); - m_scan_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); + m_scan_timer->adjust_periodic(attotime::from_hz(60)); m_ako = 0; diff --git a/src/devices/machine/keyboard.ipp b/src/devices/machine/keyboard.ipp index 5cbe54d5095..fc864f1d2e2 100644 --- a/src/devices/machine/keyboard.ipp +++ b/src/devices/machine/keyboard.ipp @@ -53,7 +53,7 @@ template <uint8_t ROW_COUNT> void device_matrix_keyboard_interface<ROW_COUNT>::start_processing(const attotime &period) { m_processing = 1U; - m_scan_timer.adjust(period, 0, period); + m_scan_timer.adjust_periodic(period); } diff --git a/src/devices/machine/m3002.cpp b/src/devices/machine/m3002.cpp index 55339217544..b5827f3aef2 100644 --- a/src/devices/machine/m3002.cpp +++ b/src/devices/machine/m3002.cpp @@ -102,7 +102,7 @@ void m3002_device::device_start() void m3002_device::device_clock_changed() { attotime second = clocks_to_attotime(32768); - m_second_timer->adjust(second, 0, second); + m_second_timer->adjust_periodic(second); } diff --git a/src/devices/machine/mc14411.cpp b/src/devices/machine/mc14411.cpp index 7935de29cb1..41d3fde2461 100644 --- a/src/devices/machine/mc14411.cpp +++ b/src/devices/machine/mc14411.cpp @@ -181,7 +181,7 @@ void mc14411_device::arm_timer(int i) if (i < TIMER_F15) divider *= s_divider_select[m_divider]; attotime half_cycle = clocks_to_attotime(divider) / 2; // 2 flanks per cycle - m_fx_timer[i]->adjust(half_cycle, i, half_cycle); + m_fx_timer[i]->adjust_periodic(half_cycle, i); LOGSETUP(" - arming timer for F%d at %fHz (/%d)\n", i + 1, double(clock()) / divider, divider); } @@ -206,7 +206,7 @@ void mc14411_device::device_reset() if (m_reset == ASSERT_LINE) { - m_reset_timer->adjust(attotime::from_nsec((double)900), TIMER_ID_RESET, attotime::from_nsec((double)900)); + m_reset_timer->adjust_periodic(attotime::from_nsec((double)900), TIMER_ID_RESET); } } diff --git a/src/devices/machine/mc68328.cpp b/src/devices/machine/mc68328.cpp index 7a8fa1e3fd2..3c8637dc34a 100644 --- a/src/devices/machine/mc68328.cpp +++ b/src/devices/machine/mc68328.cpp @@ -583,7 +583,7 @@ void mc68328_device::device_reset() m_regs.rtcienr = 0x00; m_regs.stpwtch = 0x00; - m_rtc->adjust(attotime::from_hz(1), 0, attotime::from_hz(1)); + m_rtc->adjust_periodic(attotime::from_hz(1)); } diff --git a/src/devices/machine/mc68901.cpp b/src/devices/machine/mc68901.cpp index 4905629bd33..261e6046474 100644 --- a/src/devices/machine/mc68901.cpp +++ b/src/devices/machine/mc68901.cpp @@ -696,7 +696,7 @@ void mc68901_device::write(offs_t offset, u8 data) { int divisor = PRESCALER[m_tacr & 0x07]; LOG("MC68901 Timer A Delay Mode : %u Prescale\n", divisor); - m_timer[TIMER_A]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor)); + m_timer[TIMER_A]->adjust_periodic(attotime::from_hz(m_timer_clock / divisor)); } break; @@ -715,7 +715,7 @@ void mc68901_device::write(offs_t offset, u8 data) { int divisor = PRESCALER[m_tacr & 0x07]; LOG("MC68901 Timer A Pulse Width Mode : %u Prescale\n", divisor); - m_timer[TIMER_A]->adjust(attotime::never, 0, attotime::from_hz(m_timer_clock / divisor)); + m_timer[TIMER_A]->adjust(attotime::never); m_timer[TIMER_A]->enable(false); } break; @@ -751,7 +751,7 @@ void mc68901_device::write(offs_t offset, u8 data) { int divisor = PRESCALER[m_tbcr & 0x07]; LOG("MC68901 Timer B Delay Mode : %u Prescale\n", divisor); - m_timer[TIMER_B]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor)); + m_timer[TIMER_B]->adjust_periodic(attotime::from_hz(m_timer_clock / divisor)); } break; @@ -768,9 +768,8 @@ void mc68901_device::write(offs_t offset, u8 data) case TCR_TIMER_PULSE_100: case TCR_TIMER_PULSE_200: { - int divisor = PRESCALER[m_tbcr & 0x07]; LOG("MC68901 Timer B Pulse Width Mode : %u Prescale\n", DIVISOR); - m_timer[TIMER_B]->adjust(attotime::never, 0, attotime::from_hz(m_timer_clock / divisor)); + m_timer[TIMER_B]->adjust(attotime::never); m_timer[TIMER_B]->enable(false); } break; @@ -806,7 +805,7 @@ void mc68901_device::write(offs_t offset, u8 data) { int divisor = PRESCALER[m_tcdcr & 0x07]; LOG("MC68901 Timer D Delay Mode : %u Prescale\n", divisor); - m_timer[TIMER_D]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor)); + m_timer[TIMER_D]->adjust_periodic(attotime::from_hz(m_timer_clock / divisor)); } break; } @@ -828,7 +827,7 @@ void mc68901_device::write(offs_t offset, u8 data) { int divisor = PRESCALER[(m_tcdcr >> 4) & 0x07]; LOG("MC68901 Timer C Delay Mode : %u Prescale\n", divisor); - m_timer[TIMER_C]->adjust(attotime::from_hz(m_timer_clock / divisor), 0, attotime::from_hz(m_timer_clock / divisor)); + m_timer[TIMER_C]->adjust_periodic(attotime::from_hz(m_timer_clock / divisor)); } break; } diff --git a/src/devices/machine/mccs1850.cpp b/src/devices/machine/mccs1850.cpp index 3a272d8f65f..4f9793212a7 100644 --- a/src/devices/machine/mccs1850.cpp +++ b/src/devices/machine/mccs1850.cpp @@ -325,7 +325,7 @@ void mccs1850_device::device_start() // allocate timers m_clock_timer = timer_alloc(TIMER_CLOCK); - m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 32768)); // state saving save_item(NAME(m_pse)); diff --git a/src/devices/machine/microtch.cpp b/src/devices/machine/microtch.cpp index 2e26e384c52..82274bfb06a 100644 --- a/src/devices/machine/microtch.cpp +++ b/src/devices/machine/microtch.cpp @@ -228,7 +228,7 @@ void microtouch_device::device_start() m_last_touch_state = -1; m_timer = timer_alloc(); - m_timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5)); + m_timer->adjust_periodic(attotime::from_hz(167*5)); m_format = FORMAT_UNKNOWN; m_mode = MODE_INACTIVE; diff --git a/src/devices/machine/mm5740.cpp b/src/devices/machine/mm5740.cpp index 43939ee9be2..925dd4a1acf 100644 --- a/src/devices/machine/mm5740.cpp +++ b/src/devices/machine/mm5740.cpp @@ -80,7 +80,7 @@ void mm5740_device::device_start() // allocate timers m_scan_timer = timer_alloc(); - m_scan_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_scan_timer->adjust_periodic(attotime::from_hz(clock())); // state saving save_item(NAME(m_b)); diff --git a/src/devices/machine/mm58167.cpp b/src/devices/machine/mm58167.cpp index 4ba9308615d..4e3275344d2 100644 --- a/src/devices/machine/mm58167.cpp +++ b/src/devices/machine/mm58167.cpp @@ -68,7 +68,7 @@ void mm58167_device::device_start() { // allocate timers m_clock_timer = timer_alloc(); - m_clock_timer->adjust(attotime::from_hz(clock() / 32.768f), 0, attotime::from_hz(clock() / 32.768f)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 32.768f)); m_irq_w.resolve_safe(); diff --git a/src/devices/machine/mos6526.cpp b/src/devices/machine/mos6526.cpp index 8cf896c1922..7a274ec4832 100644 --- a/src/devices/machine/mos6526.cpp +++ b/src/devices/machine/mos6526.cpp @@ -645,7 +645,7 @@ void mos6526_device::device_start() if (m_tod_clock > 0) { m_tod_timer = timer_alloc(); - m_tod_timer->adjust(attotime::from_hz(m_tod_clock), 0, attotime::from_hz(m_tod_clock)); + m_tod_timer->adjust_periodic(attotime::from_hz(m_tod_clock)); } // state saving diff --git a/src/devices/machine/msm5832.cpp b/src/devices/machine/msm5832.cpp index 2e0dcae56da..12a4d914ae2 100644 --- a/src/devices/machine/msm5832.cpp +++ b/src/devices/machine/msm5832.cpp @@ -111,7 +111,7 @@ void msm5832_device::device_start() { // allocate timers m_clock_timer = timer_alloc(TIMER_CLOCK); - m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 32768)); // state saving save_item(NAME(m_reg)); diff --git a/src/devices/machine/msm58321.cpp b/src/devices/machine/msm58321.cpp index 842879f3c0a..d31e64ccea3 100644 --- a/src/devices/machine/msm58321.cpp +++ b/src/devices/machine/msm58321.cpp @@ -210,7 +210,7 @@ void msm58321_device::device_start() // allocate timers m_clock_timer = timer_alloc(TIMER_CLOCK); - m_clock_timer->adjust(clocks_to_attotime(32768/1024), 0, clocks_to_attotime(32768/1024)); + m_clock_timer->adjust_periodic(clocks_to_attotime(32768/1024)); // busy signal active period is approximately 427 µs m_busy_timer = timer_alloc(TIMER_BUSY); diff --git a/src/devices/machine/pcf8573.cpp b/src/devices/machine/pcf8573.cpp index 860a443d84d..68e7cadf10f 100644 --- a/src/devices/machine/pcf8573.cpp +++ b/src/devices/machine/pcf8573.cpp @@ -62,7 +62,7 @@ void pcf8573_device::device_start() // allocate timers m_clock_timer = timer_alloc(); - m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 32768)); // state saving save_item(NAME(m_scl)); diff --git a/src/devices/machine/pcf8583.cpp b/src/devices/machine/pcf8583.cpp index 5286c63bdea..2e13c41896b 100644 --- a/src/devices/machine/pcf8583.cpp +++ b/src/devices/machine/pcf8583.cpp @@ -56,7 +56,7 @@ pcf8583_device::pcf8583_device(const machine_config &mconfig, const char *tag, d void pcf8583_device::device_start() { m_timer = timer_alloc(TIMER_TICK); - m_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); + m_timer->adjust_periodic(attotime::from_hz(100)); save_item(NAME(m_scl)); save_item(NAME(m_sdaw)); diff --git a/src/devices/machine/pcf8593.cpp b/src/devices/machine/pcf8593.cpp index 3a07050cae7..83e0cc70adc 100644 --- a/src/devices/machine/pcf8593.cpp +++ b/src/devices/machine/pcf8593.cpp @@ -64,7 +64,7 @@ void pcf8593_device::device_start() _logerror( 0, ("pcf8593_init\n")); memset(m_register, 0, sizeof(m_register)); m_timer = timer_alloc(TIMER_UPDATE_COUNTER); - m_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_timer->adjust_periodic(attotime::from_seconds(1)); } //------------------------------------------------- diff --git a/src/devices/machine/r10788.cpp b/src/devices/machine/r10788.cpp index 56470527373..b48501c108e 100644 --- a/src/devices/machine/r10788.cpp +++ b/src/devices/machine/r10788.cpp @@ -82,7 +82,7 @@ void r10788_device::device_start() m_timer = timer_alloc(TIMER_DISPLAY); // recurring timer every 36 cycles - m_timer->adjust(clocks_to_attotime(36), 0, clocks_to_attotime(36)); + m_timer->adjust_periodic(clocks_to_attotime(36)); } /** diff --git a/src/devices/machine/ripple_counter.cpp b/src/devices/machine/ripple_counter.cpp index 881313164e8..037a2fc3a8c 100644 --- a/src/devices/machine/ripple_counter.cpp +++ b/src/devices/machine/ripple_counter.cpp @@ -111,7 +111,7 @@ void ripple_counter_device::device_start() void ripple_counter_device::device_clock_changed() { attotime freq = m_reset ? attotime::never : clocks_to_attotime(1); - m_count_timer->adjust(freq, 0, freq); + m_count_timer->adjust_periodic(freq, 0); } diff --git a/src/devices/machine/rp5c01.cpp b/src/devices/machine/rp5c01.cpp index 4fa58898c18..51081976af8 100644 --- a/src/devices/machine/rp5c01.cpp +++ b/src/devices/machine/rp5c01.cpp @@ -202,10 +202,10 @@ void rp5c01_device::device_start() if (clock() > 0) { m_clock_timer = timer_alloc(TIMER_CLOCK); - m_clock_timer->adjust(attotime::from_hz(clock() / 16384), 0, attotime::from_hz(clock() / 16384)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 16384)); m_16hz_timer = timer_alloc(TIMER_16HZ); - m_16hz_timer->adjust(attotime::from_hz(clock() / 1024), 0, attotime::from_hz(clock() / 1024)); + m_16hz_timer->adjust_periodic(attotime::from_hz(clock() / 1024)); } memset(m_reg, 0, sizeof(m_reg)); diff --git a/src/devices/machine/rp5c15.cpp b/src/devices/machine/rp5c15.cpp index 411909225a6..24ab1960d73 100644 --- a/src/devices/machine/rp5c15.cpp +++ b/src/devices/machine/rp5c15.cpp @@ -208,10 +208,10 @@ void rp5c15_device::device_start() // allocate timers m_clock_timer = timer_alloc(TIMER_CLOCK); - m_clock_timer->adjust(attotime::from_hz(clock() / 16384), 0, attotime::from_hz(clock() / 16384)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 16384)); m_16hz_timer = timer_alloc(TIMER_16HZ); - m_16hz_timer->adjust(attotime::from_hz(clock() / 1024), 0, attotime::from_hz(clock() / 1024)); + m_16hz_timer->adjust_periodic(attotime::from_hz(clock() / 1024)); m_clkout_timer = timer_alloc(TIMER_CLKOUT); @@ -378,23 +378,23 @@ void rp5c15_device::write(offs_t offset, uint8_t data) switch (data & 0x07) { case CLKOUT_16384_HZ: - m_clkout_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_clkout_timer->adjust_periodic(attotime::from_hz(clock())); break; case CLKOUT_1024_HZ: - m_clkout_timer->adjust(attotime::from_hz(clock() / 16), 0, attotime::from_hz(clock() / 16)); + m_clkout_timer->adjust_periodic(attotime::from_hz(clock() / 16)); break; case CLKOUT_128_HZ: - m_clkout_timer->adjust(attotime::from_hz(clock() / 128), 0, attotime::from_hz(clock() / 128)); + m_clkout_timer->adjust_periodic(attotime::from_hz(clock() / 128)); break; case CLKOUT_16_HZ: - m_clkout_timer->adjust(attotime::from_hz(clock() / 1024), 0, attotime::from_hz(clock() / 1024)); + m_clkout_timer->adjust_periodic(attotime::from_hz(clock() / 1024)); break; case CLKOUT_1_HZ: - m_clkout_timer->adjust(attotime::from_hz(clock() / 16384), 0, attotime::from_hz(clock() / 16384)); + m_clkout_timer->adjust_periodic(attotime::from_hz(clock() / 16384)); break; case CLKOUT_1_DIV_60_HZ: diff --git a/src/devices/machine/rtc4543.cpp b/src/devices/machine/rtc4543.cpp index 2b4554f77d6..7bb4913042b 100644 --- a/src/devices/machine/rtc4543.cpp +++ b/src/devices/machine/rtc4543.cpp @@ -74,7 +74,7 @@ void rtc4543_device::device_start() // allocate timers m_clock_timer = timer_alloc(); - m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 32768)); // state saving save_item(NAME(m_ce)); diff --git a/src/devices/machine/rtc65271.cpp b/src/devices/machine/rtc65271.cpp index bc8261052bb..cdcd15f451a 100644 --- a/src/devices/machine/rtc65271.cpp +++ b/src/devices/machine/rtc65271.cpp @@ -678,7 +678,7 @@ rtc65271_device::rtc65271_device(const machine_config &mconfig, const char *tag, void rtc65271_device::device_start() { m_update_timer = timer_alloc(*this, FUNC(rtc65271_device::rtc_begin_update_cb)); - m_update_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_update_timer->adjust_periodic(attotime::from_seconds(1)); m_SQW_timer = timer_alloc(*this, FUNC(rtc65271_device::rtc_SQW_cb)); m_interrupt_cb.resolve(); diff --git a/src/devices/machine/rtc9701.cpp b/src/devices/machine/rtc9701.cpp index d5f8c175ad2..c67575932ab 100644 --- a/src/devices/machine/rtc9701.cpp +++ b/src/devices/machine/rtc9701.cpp @@ -93,7 +93,7 @@ void rtc9701_device::device_start() { /* let's call the timer callback every second */ m_timer = timer_alloc(*this, FUNC(rtc9701_device::timer_callback)); - m_timer->adjust(attotime::from_hz(clock() / XTAL(32'768)), 0, attotime::from_hz(clock() / XTAL(32'768))); + m_timer->adjust_periodic(attotime::from_hz(clock() / XTAL(32'768))); system_time systime; machine().base_datetime(systime); diff --git a/src/devices/machine/s3520cf.cpp b/src/devices/machine/s3520cf.cpp index 08f77422764..ed95155d9ed 100644 --- a/src/devices/machine/s3520cf.cpp +++ b/src/devices/machine/s3520cf.cpp @@ -106,7 +106,7 @@ void s3520cf_device::device_start() { /* let's call the timer callback every second for now */ m_timer = timer_alloc(*this, FUNC(s3520cf_device::timer_callback)); - m_timer->adjust(attotime::from_hz(clock() / XTAL(32'768)), 0, attotime::from_hz(clock() / XTAL(32'768))); + m_timer->adjust_periodic(attotime::from_hz(clock() / XTAL(32'768))); system_time systime; machine().base_datetime(systime); diff --git a/src/devices/machine/s3c24xx.cpp b/src/devices/machine/s3c24xx.cpp index 40cebd1b643..5de7ced7b3f 100644 --- a/src/devices/machine/s3c24xx.cpp +++ b/src/devices/machine/s3c24xx.cpp @@ -97,8 +97,7 @@ void s3c24xx_peripheral_types::rtc_t::reset() std::memset(®s, 0, sizeof(regs)); regs.almday = 1; regs.almmon = 1; - timer_update->adjust(attotime::never); - timer_update->adjust(attotime::from_msec(1000), 0, attotime::from_msec(1000)); + timer_update->adjust_periodic(attotime::from_msec(1000)); } void s3c24xx_peripheral_types::rtc_t::recalc() @@ -108,7 +107,7 @@ void s3c24xx_peripheral_types::rtc_t::recalc() uint32_t const ttc = BITS(regs.ticnt, 6, 0); double const freq = 128.0 / (ttc + 1); LOG("ttc %u freq %f\n", ttc, freq); - timer_tick_count->adjust(attotime::from_hz(freq), 0, attotime::from_hz(freq)); + timer_tick_count->adjust_periodic(attotime::from_hz(freq)); } else { diff --git a/src/devices/machine/s3c24xx.hxx b/src/devices/machine/s3c24xx.hxx index 77928803397..335a982ba92 100644 --- a/src/devices/machine/s3c24xx.hxx +++ b/src/devices/machine/s3c24xx.hxx @@ -1425,7 +1425,7 @@ void S3C24_CLASS_NAME::s3c24xx_pwm_start(int timer) m_pwm.freq[timer] = freq; if (auto_reload) { - m_pwm.timer[timer]->adjust(attotime::from_hz(hz), timer, attotime::from_hz(hz)); + m_pwm.timer[timer]->adjust_periodic(attotime::from_hz(hz), timer); } else { @@ -2160,7 +2160,7 @@ void S3C24_CLASS_NAME::s3c24xx_wdt_start() freq = (double)pclk / (prescaler + 1) / clock; hz = freq / m_wdt.regs.wtcnt; LOGMASKED(LOG_WDT, "watchdog start: pclk %d prescaler %d clock %d freq %f hz %f\n", pclk, prescaler, clock, freq, hz); - m_wdt.timer->adjust( attotime::from_hz( hz), 0, attotime::from_hz( hz)); + m_wdt.timer->adjust_periodic( attotime::from_hz( hz)); #if defined(DEVICE_S3C2410) m_wdt.freq = freq; m_wdt.cnt = m_wdt.regs.wtcnt; @@ -2468,7 +2468,7 @@ void S3C24_CLASS_NAME::s3c24xx_iis_start() int pclk = s3c24xx_get_pclk(); double freq = ((double)pclk / (prescaler_control_a + 1) / codeclk_table[codeclk]) * 2; // why do I have to multiply by two? LOGMASKED(LOG_I2S, "IIS - pclk %d psc_enable %d psc_a %d psc_b %d codeclk %d freq %f\n", pclk, prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk_table[codeclk], freq); - m_iis.timer->adjust( attotime::from_hz( freq), 0, attotime::from_hz( freq)); + m_iis.timer->adjust_periodic( attotime::from_hz( freq)); } void S3C24_CLASS_NAME::s3c24xx_iis_stop() diff --git a/src/devices/machine/s3c44b0.cpp b/src/devices/machine/s3c44b0.cpp index b19eac7063c..d27ad6ee902 100644 --- a/src/devices/machine/s3c44b0.cpp +++ b/src/devices/machine/s3c44b0.cpp @@ -1155,7 +1155,7 @@ void s3c44b0_device::pwm_start(int timer) { if (auto_reload) { - m_pwm.timer[timer]->adjust(attotime::from_hz(hz), timer, attotime::from_hz(hz)); + m_pwm.timer[timer]->adjust_periodic(attotime::from_hz(hz), timer); } else { @@ -1609,7 +1609,7 @@ void s3c44b0_device::uart_w(int ch, uint32_t offset, uint32_t data, uint32_t mem mclk = get_mclk(); hz = (mclk / (m_uart->regs.ubrdiv + 1)) / 16; verboselog( *this, 5, "UART %d - mclk %08X hz %08X\n", ch, mclk, hz); - m_uart->timer->adjust(attotime::from_hz(hz), ch, attotime::from_hz(hz)); + m_uart->timer->adjust_periodic(attotime::from_hz(hz), ch); } break; } @@ -1696,7 +1696,7 @@ void s3c44b0_device::wdt_start() freq = (double)mclk / (prescaler + 1) / clock; hz = freq / m_wdt.regs.wtcnt; verboselog( *this, 5, "WDT mclk %d prescaler %d clock %d freq %f hz %f\n", mclk, prescaler, clock, freq, hz); - m_wdt.timer->adjust(attotime::from_hz(hz), 0, attotime::from_hz(hz)); + m_wdt.timer->adjust_periodic(attotime::from_hz(hz)); } void s3c44b0_device::wdt_stop() @@ -1912,7 +1912,7 @@ void s3c44b0_device::iis_start() freq = (double)mclk / div[prescaler]; hz = freq / 256 * 2; verboselog( *this, 5, "IIS mclk %d prescaler %d freq %f hz %f\n", mclk, prescaler, freq, hz); - m_iis.timer->adjust(attotime::from_hz(hz), 0, attotime::from_hz(hz)); + m_iis.timer->adjust_periodic(attotime::from_hz(hz)); } void s3c44b0_device::iis_stop() diff --git a/src/devices/machine/s_smp.cpp b/src/devices/machine/s_smp.cpp index c2dca533bc8..862c44c1b57 100644 --- a/src/devices/machine/s_smp.cpp +++ b/src/devices/machine/s_smp.cpp @@ -130,7 +130,7 @@ void s_smp_device::device_reset() } attotime period = attotime::from_ticks(32, clock()); - m_tick_timer->adjust(period, 0, period); + m_tick_timer->adjust_periodic(period); spc700_device::device_reset(); } @@ -142,7 +142,7 @@ void s_smp_device::device_reset() void s_smp_device::device_clock_changed() { attotime period = attotime::from_ticks(32, clock()); - m_tick_timer->adjust(period, 0, period); + m_tick_timer->adjust_periodic(period); } //------------------------------------------------- diff --git a/src/devices/machine/sa1110.cpp b/src/devices/machine/sa1110.cpp index 70f2f068ce1..c47bc148f2d 100644 --- a/src/devices/machine/sa1110.cpp +++ b/src/devices/machine/sa1110.cpp @@ -914,10 +914,10 @@ attotime sa1110_periphs_device::mcp_get_telecom_frame_rate() void sa1110_periphs_device::mcp_update_sample_rate() { const attotime audio_rate = mcp_get_audio_frame_rate(); - m_mcp_regs.audio_tx_timer->adjust(audio_rate, 0, audio_rate); + m_mcp_regs.audio_tx_timer->adjust_periodic(audio_rate); const attotime telecom_rate = mcp_get_telecom_frame_rate(); - m_mcp_regs.telecom_tx_timer->adjust(telecom_rate, 0, telecom_rate); + m_mcp_regs.telecom_tx_timer->adjust_periodic(telecom_rate); } void sa1110_periphs_device::mcp_set_enabled(bool enabled) @@ -1197,8 +1197,8 @@ void sa1110_periphs_device::ssp_update_enable_state() uint64_t bit_count = (m_ssp_regs.sscr0 & SSCR0_DSS_MASK) >> SSCR0_DSS_BIT; uint32_t clock_rate = 2 * (((m_ssp_regs.sscr0 & SSCR0_SCR_MASK) >> SSCR0_SCR_BIT) + 1); attotime packet_rate = attotime::from_ticks(bit_count * clock_rate, 3686400); - m_ssp_regs.rx_timer->adjust(packet_rate, 0, packet_rate); - m_ssp_regs.tx_timer->adjust(packet_rate, 0, packet_rate); + m_ssp_regs.rx_timer->adjust_periodic(packet_rate); + m_ssp_regs.tx_timer->adjust_periodic(packet_rate); } else { @@ -2567,7 +2567,7 @@ void sa1110_periphs_device::device_reset() m_rtc_regs.rcnr = 0; m_rtc_regs.rttr = 0; m_rtc_regs.rtsr = 0; - m_rtc_regs.tick_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_rtc_regs.tick_timer->adjust_periodic(attotime::from_seconds(1)); // init power regs m_power_regs.pmcr = 0; diff --git a/src/devices/machine/sa1111.cpp b/src/devices/machine/sa1111.cpp index e35977793d5..649531a4e13 100644 --- a/src/devices/machine/sa1111.cpp +++ b/src/devices/machine/sa1111.cpp @@ -634,7 +634,7 @@ void sa1111_device::audio_start_tx_dma(const uint32_t buf) const uint32_t divisor = ((m_sk_regs.skaud & SKAUD_ACD_MASK) >> SKAUD_ACD_BIT) + 1; const uint32_t pll_clock = clock() * 39; attotime clock_period = attotime::from_ticks(divisor * 128, pll_clock); - m_audio_regs.tx_dma_timer->adjust(clock_period, 0, clock_period); + m_audio_regs.tx_dma_timer->adjust_periodic(clock_period); LOGMASKED(LOG_AUDIO_DMA, "audio_start_tx_dma, setting start address to %08x, Tx clock to %d / %d\n", m_audio_regs.sadta, pll_clock, divisor); } @@ -649,7 +649,7 @@ void sa1111_device::audio_start_rx_dma(const uint32_t buf) const uint32_t divisor = ((m_sk_regs.skaud & SKAUD_ACD_MASK) >> SKAUD_ACD_BIT) + 1; const uint32_t pll_clock = clock() * 39; attotime clock_period = attotime::from_ticks(divisor * 256, pll_clock); - m_audio_regs.rx_dma_timer->adjust(clock_period, 0, clock_period); + m_audio_regs.rx_dma_timer->adjust_periodic(clock_period); } void sa1111_device::audio_update_tx_fifo_levels() @@ -724,7 +724,7 @@ void sa1111_device::audio_tx_fifo_push(uint32_t data) const uint32_t divisor = ((m_sk_regs.skaud & SKAUD_ACD_MASK) >> SKAUD_ACD_BIT) + 1; const uint32_t pll_clock = clock() * 39; attotime clock_period = attotime::from_ticks(divisor * 256, pll_clock); - m_audio_regs.tx_timer->adjust(clock_period, 0, clock_period); + m_audio_regs.tx_timer->adjust_periodic(clock_period); } } } @@ -1293,8 +1293,8 @@ void sa1111_device::ssp_update_enable_state() uint64_t bit_count = (m_ssp_regs.sspcr0 & SSPCR0_DSS_MASK) >> SSPCR0_DSS_BIT; uint32_t clock_rate = 2 * (((m_ssp_regs.sspcr0 & SSPCR0_SCR_MASK) >> SSPCR0_SCR_BIT) + 1); attotime packet_rate = attotime::from_ticks(bit_count * clock_rate, 3686400); - m_ssp_regs.rx_timer->adjust(packet_rate, 0, packet_rate); - m_ssp_regs.tx_timer->adjust(packet_rate, 0, packet_rate); + m_ssp_regs.rx_timer->adjust_periodic(packet_rate); + m_ssp_regs.tx_timer->adjust_periodic(packet_rate); } else { diff --git a/src/devices/machine/scc68070.cpp b/src/devices/machine/scc68070.cpp index c5308d8e597..013f148a0aa 100644 --- a/src/devices/machine/scc68070.cpp +++ b/src/devices/machine/scc68070.cpp @@ -775,8 +775,8 @@ void scc68070_device::ucsr_w(uint8_t data) attotime rx_rate = attotime::from_ticks(s_baud_divisors[(data >> 4) & 7] * 10, 49152000); attotime tx_rate = attotime::from_ticks(s_baud_divisors[data & 7] * 10, 49152000); - m_uart.rx_timer->adjust(rx_rate, 0, rx_rate); - m_uart.tx_timer->adjust(tx_rate, 0, tx_rate); + m_uart.rx_timer->adjust_periodic(rx_rate); + m_uart.tx_timer->adjust_periodic(tx_rate); } uint8_t scc68070_device::ucr_r() diff --git a/src/devices/machine/scn_pci.cpp b/src/devices/machine/scn_pci.cpp index bd1e460ac3c..63df936ea57 100644 --- a/src/devices/machine/scn_pci.cpp +++ b/src/devices/machine/scn_pci.cpp @@ -1284,7 +1284,7 @@ void scn_pci_device::write_mode(u8 data) else { attotime brg_period = clocks_to_attotime(m_br_div[data & 0x0f]); - m_brg_timer->adjust(brg_period / 2, 0, brg_period / 2); + m_brg_timer->adjust_periodic(brg_period / 2); } } diff --git a/src/devices/machine/scnxx562.cpp b/src/devices/machine/scnxx562.cpp index 21d9f9824c0..7b8f1482468 100644 --- a/src/devices/machine/scnxx562.cpp +++ b/src/devices/machine/scnxx562.cpp @@ -759,7 +759,7 @@ void duscc_channel::device_timer(timer_instance const &timer) else // Pulse! { m_rtxc = 1; - rtxc_timer->adjust(attotime::from_hz(clock()), TIMER_ID_RTXC, attotime::from_hz(clock())); + rtxc_timer->adjust_periodic(attotime::from_hz(clock()), TIMER_ID_RTXC); } if (m_index == duscc_device::CHANNEL_A) m_uart->m_out_rtxca_cb(m_rtxc); @@ -777,7 +777,7 @@ void duscc_channel::device_timer(timer_instance const &timer) else // Pulse! { m_trxc = 1; - trxc_timer->adjust(attotime::from_hz(clock()), TIMER_ID_TRXC, attotime::from_hz(clock())); + trxc_timer->adjust_periodic(attotime::from_hz(clock()), TIMER_ID_TRXC); } if (m_index == duscc_device::CHANNEL_A) m_uart->m_out_trxca_cb(m_trxc); @@ -2007,7 +2007,7 @@ void duscc_channel::do_dusccreg_ccr_w(uint8_t data) /* Start. Starts the counteritimer and prescaler. */ case REG_CCR_START_TIMER: LOG("- Start Counter/Timer\n"); rate = 100; // TODO: calculate correct rate - duscc_timer->adjust(attotime::from_hz(rate), TIMER_ID_RTXC, attotime::from_hz(rate)); + duscc_timer->adjust_periodic(attotime::from_hz(rate), TIMER_ID_RTXC); break; /* Stop. Stops the counter/timer and prescaler. Since the command may be asynchronous with the selected clock source, diff --git a/src/devices/machine/smioc.cpp b/src/devices/machine/smioc.cpp index 3c6bc9a5392..6fb2a565e43 100644 --- a/src/devices/machine/smioc.cpp +++ b/src/devices/machine/smioc.cpp @@ -221,7 +221,7 @@ void smioc_device::device_start() m_m68k_r_cb.resolve_safe(0); m_m68k_w_cb.resolve_safe(); - m_451_timer->adjust(attotime::from_msec(200), 0, attotime::from_msec(200)); + m_451_timer->adjust_periodic(attotime::from_msec(200)); } //------------------------------------------------- diff --git a/src/devices/machine/spg290_cdservo.cpp b/src/devices/machine/spg290_cdservo.cpp index 004e3004cfb..6070ff8b90e 100644 --- a/src/devices/machine/spg290_cdservo.cpp +++ b/src/devices/machine/spg290_cdservo.cpp @@ -335,7 +335,7 @@ void spg290_cdservo_device::change_status() if (m_speed == 0 || !m_cdrom.found() || !m_cdrom->get_cdrom_file()) m_cdtimer->adjust(attotime::never); else - m_cdtimer->adjust(attotime::from_hz(75 * m_speed), 0, attotime::from_hz(75 * m_speed)); + m_cdtimer->adjust_periodic(attotime::from_hz(75 * m_speed)); } void spg290_cdservo_device::add_qsub(int sector, uint8_t addrctrl, uint8_t track, uint8_t index, uint32_t rel_msf, uint32_t abs_msf, uint16_t crc16) diff --git a/src/devices/machine/spg290_timer.cpp b/src/devices/machine/spg290_timer.cpp index 909fda5ccdc..f10ae3d4294 100644 --- a/src/devices/machine/spg290_timer.cpp +++ b/src/devices/machine/spg290_timer.cpp @@ -51,7 +51,7 @@ void spg290_timer_device::device_reset() void spg290_timer_device::device_clock_changed() { if (m_enabled) - m_tick_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_tick_timer->adjust_periodic(attotime::from_hz(clock())); else m_tick_timer->adjust(attotime::never); } diff --git a/src/devices/machine/spg2xx_audio.cpp b/src/devices/machine/spg2xx_audio.cpp index 9f4db7be594..c59e131d54f 100644 --- a/src/devices/machine/spg2xx_audio.cpp +++ b/src/devices/machine/spg2xx_audio.cpp @@ -138,7 +138,7 @@ void spg2xx_audio_device::device_reset() m_audio_ctrl_regs[AUDIO_CHANNEL_REPEAT] = 0x3f; m_audio_ctrl_regs[AUDIO_CHANNEL_ENV_MODE] = 0x3f; - m_audio_beat->adjust(attotime::from_ticks(4, 281250), 0, attotime::from_ticks(4, 281250)); + m_audio_beat->adjust_periodic(attotime::from_ticks(4, 281250)); for (int i = 0; i < 16; i++) { @@ -480,7 +480,7 @@ void spg2xx_audio_device::audio_ctrl_w(offs_t offset, uint16_t data) m_audio_ctrl_regs[offset] |= mask; if (BIT(m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_ENABLE], channel_bit)) { - m_channel_irq[channel_bit]->adjust(attotime::from_hz(m_channel_rate[channel_bit]), 0, attotime::from_hz(m_channel_rate[channel_bit])); + m_channel_irq[channel_bit]->adjust_periodic(attotime::from_hz(m_channel_rate[channel_bit])); } else { diff --git a/src/devices/machine/spg2xx_io.cpp b/src/devices/machine/spg2xx_io.cpp index 07729bbb111..8d880ccb32e 100644 --- a/src/devices/machine/spg2xx_io.cpp +++ b/src/devices/machine/spg2xx_io.cpp @@ -200,9 +200,9 @@ void spg2xx_io_device::device_reset() std::fill_n(&m_extint[0], 2, false); - m_4khz_timer->adjust(attotime::from_hz(4096), 0, attotime::from_hz(4096)); + m_4khz_timer->adjust_periodic(attotime::from_hz(4096)); - m_rng_timer->adjust(attotime::from_hz(1234), 0, attotime::from_hz(1234)); // timer value is arbitrary, maybe should match system clock, but that would result in heavy switching + m_rng_timer->adjust_periodic(attotime::from_hz(1234)); // timer value is arbitrary, maybe should match system clock, but that would result in heavy switching m_tmb1->adjust(attotime::never); m_tmb2->adjust(attotime::never); @@ -688,13 +688,13 @@ void spg2xx_io_device::update_timer_b_rate() m_timer_src_c->adjust(attotime::never); break; case 2: - m_timer_src_c->adjust(attotime::from_hz(32768), 0, attotime::from_hz(32768)); + m_timer_src_c->adjust_periodic(attotime::from_hz(32768)); break; case 3: - m_timer_src_c->adjust(attotime::from_hz(8192), 0, attotime::from_hz(8192)); + m_timer_src_c->adjust_periodic(attotime::from_hz(8192)); break; case 4: - m_timer_src_c->adjust(attotime::from_hz(4096), 0, attotime::from_hz(4096)); + m_timer_src_c->adjust_periodic(attotime::from_hz(4096)); break; } } @@ -843,9 +843,9 @@ void spg2xx_io_device::io_w(offs_t offset, uint16_t data) m_io_regs[REG_TIMEBASE_SETUP] = data; const uint8_t hifreq = BIT(data, 4); const uint32_t tmb1freq = s_tmb1_freq[hifreq][data & 3]; - m_tmb1->adjust(attotime::from_hz(tmb1freq), 0, attotime::from_hz(tmb1freq)); + m_tmb1->adjust_periodic(attotime::from_hz(tmb1freq)); const uint32_t tmb2freq = s_tmb2_freq[hifreq][(data >> 2) & 3]; - m_tmb2->adjust(attotime::from_hz(tmb2freq), 0, attotime::from_hz(tmb2freq)); + m_tmb2->adjust_periodic(attotime::from_hz(tmb2freq)); break; } @@ -880,15 +880,15 @@ void spg2xx_io_device::io_w(offs_t offset, uint16_t data) m_timer_src_ab->adjust(attotime::never); break; case 2: - m_timer_src_ab->adjust(attotime::from_hz(32768), 0, attotime::from_hz(32768)); + m_timer_src_ab->adjust_periodic(attotime::from_hz(32768)); timer_a_rate = 32768; break; case 3: - m_timer_src_ab->adjust(attotime::from_hz(8192), 0, attotime::from_hz(8192)); + m_timer_src_ab->adjust_periodic(attotime::from_hz(8192)); timer_a_rate = 8192; break; case 4: - m_timer_src_ab->adjust(attotime::from_hz(4096), 0, attotime::from_hz(4096)); + m_timer_src_ab->adjust_periodic(attotime::from_hz(4096)); timer_a_rate = 4096; break; } @@ -1099,7 +1099,7 @@ void spg2xx_io_device::io_w(offs_t offset, uint16_t data) if (BIT(data, 10)) { m_io_regs[REG_ADC_DATA] &= ~0x8000; - m_adc_timer[adc_channel]->adjust(attotime::from_hz(8000), 0, attotime::from_hz(8000)); + m_adc_timer[adc_channel]->adjust_periodic(attotime::from_hz(8000)); } } else @@ -1334,7 +1334,7 @@ void spg2xx_io_device::io_extended_w(offs_t offset, uint16_t data) m_spi_tx_fifo_count++; attotime rate = attotime::from_ticks(m_spi_rate, clock()); - m_spi_tx_timer->adjust(rate, 0, rate); + m_spi_tx_timer->adjust_periodic(rate); } else { diff --git a/src/devices/machine/timekpr.cpp b/src/devices/machine/timekpr.cpp index b9028e9f69e..8b7306cb7d6 100644 --- a/src/devices/machine/timekpr.cpp +++ b/src/devices/machine/timekpr.cpp @@ -228,7 +228,7 @@ void timekeeper_device::device_start() save_item(NAME(m_watchdog_delay)); emu_timer *timer = timer_alloc(); - timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + timer->adjust_periodic(attotime::from_seconds(1)); m_watchdog_timer = timer_alloc(*this, FUNC(timekeeper_device::watchdog_callback)); m_watchdog_timer->adjust(attotime::never); diff --git a/src/devices/machine/tms9901.cpp b/src/devices/machine/tms9901.cpp index 46aac576122..e45cb2587cc 100644 --- a/src/devices/machine/tms9901.cpp +++ b/src/devices/machine/tms9901.cpp @@ -604,7 +604,7 @@ void tms9901_device::device_start() if (clock() != 0) { m_decrementer = timer_alloc(DECREMENTER); - m_decrementer->adjust(attotime::from_hz(clock() / 64.), 0, attotime::from_hz(clock() / 64.)); + m_decrementer->adjust_periodic(attotime::from_hz(clock() / 64.)); } m_read_port.resolve(); diff --git a/src/devices/machine/upd1990a.cpp b/src/devices/machine/upd1990a.cpp index 4003778c91b..34a3d8ac385 100644 --- a/src/devices/machine/upd1990a.cpp +++ b/src/devices/machine/upd1990a.cpp @@ -93,7 +93,7 @@ void upd1990a_device::device_start() // allocate timers m_timer_clock = timer_alloc(TIMER_CLOCK); - m_timer_clock->adjust(attotime::from_hz(clock() / 32768.0), 0, attotime::from_hz(clock() / 32768.0)); // 1 second on XTAL(32'768) + m_timer_clock->adjust_periodic(attotime::from_hz(clock() / 32768.0)); // 1 second on XTAL(32'768) m_timer_tp = timer_alloc(TIMER_TP); m_timer_data_out = timer_alloc(TIMER_DATA_OUT); m_timer_test_mode = timer_alloc(TIMER_TEST_MODE); diff --git a/src/devices/machine/upd4991a.cpp b/src/devices/machine/upd4991a.cpp index b64e02e4ec3..d04d4d73e29 100644 --- a/src/devices/machine/upd4991a.cpp +++ b/src/devices/machine/upd4991a.cpp @@ -63,7 +63,7 @@ void upd4991a_device::device_validity_check(validity_checker &valid) const void upd4991a_device::device_start() { m_timer_clock = timer_alloc(TIMER_CLOCK); - m_timer_clock->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_timer_clock->adjust_periodic(attotime::from_hz(clock() / 32768)); save_item(NAME(m_address)); } diff --git a/src/devices/machine/upd4992.cpp b/src/devices/machine/upd4992.cpp index ad2a90dff5e..99ea59f98e1 100644 --- a/src/devices/machine/upd4992.cpp +++ b/src/devices/machine/upd4992.cpp @@ -59,7 +59,7 @@ void upd4992_device::device_validity_check(validity_checker &valid) const void upd4992_device::device_start() { m_timer_clock = timer_alloc(TIMER_CLOCK); - m_timer_clock->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_timer_clock->adjust_periodic(attotime::from_hz(clock() / 32768)); } diff --git a/src/devices/machine/v3021.cpp b/src/devices/machine/v3021.cpp index e64e7c81111..d452d541b7d 100644 --- a/src/devices/machine/v3021.cpp +++ b/src/devices/machine/v3021.cpp @@ -154,7 +154,7 @@ void v3021_device::device_start() { /* let's call the timer callback every second */ m_timer = timer_alloc(*this, FUNC(v3021_device::timer_callback)); - m_timer->adjust(attotime::from_hz(clock() / XTAL(32'768)), 0, attotime::from_hz(clock() / XTAL(32'768))); + m_timer->adjust_periodic(attotime::from_hz(clock() / XTAL(32'768))); copy_clock_to_ram(); diff --git a/src/devices/machine/wozfdc.cpp b/src/devices/machine/wozfdc.cpp index 1f06ad9d837..147f196f9d9 100644 --- a/src/devices/machine/wozfdc.cpp +++ b/src/devices/machine/wozfdc.cpp @@ -114,7 +114,7 @@ void wozfdc_device::device_reset() // Just a timer to be sure that the lss is updated from time to // time, so that there's no hiccup when it's talked to again. - timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10)); + timer->adjust_periodic(attotime::from_msec(10)); } void wozfdc_device::a3_update_drive_sel() diff --git a/src/devices/machine/ym2148.cpp b/src/devices/machine/ym2148.cpp index f1ea1b5dcd9..648fbbc9015 100644 --- a/src/devices/machine/ym2148.cpp +++ b/src/devices/machine/ym2148.cpp @@ -46,7 +46,7 @@ void ym2148_device::device_start() // Start a timer to trigger at clock / 8 / 16 const attotime rate = clocks_to_attotime(8 * 16); m_timer = timer_alloc(0); - m_timer->adjust(rate, 0, rate); + m_timer->adjust_periodic(rate); } diff --git a/src/devices/machine/ym3802.cpp b/src/devices/machine/ym3802.cpp index 73805331941..52770507ccd 100644 --- a/src/devices/machine/ym3802.cpp +++ b/src/devices/machine/ym3802.cpp @@ -162,7 +162,7 @@ void ym3802_device::reset_midi_timer() } if(rate != m_prev_rate) - m_midi_timer->adjust(attotime::from_hz(rate),0,attotime::from_hz(rate)); + m_midi_timer->adjust_periodic(attotime::from_hz(rate)); m_prev_rate = rate; logerror("MIDI Timer rate set to %iHz\n",rate); } @@ -263,12 +263,12 @@ void ym3802_device::write(offs_t offset, uint8_t data) const double rate = (m_reg[REG_CCR] & 0x02) ? m_clkm_rate / 4 : m_clkm_rate / 8; // start message to click counter - m_midi_counter_timer->adjust(attotime::from_hz(rate),0,attotime::from_hz(rate)); + m_midi_counter_timer->adjust_periodic(attotime::from_hz(rate)); } if((data & 0x07) == 3) { // stop message to click counter - m_midi_counter_timer->adjust(attotime::zero,0,attotime::never); + m_midi_counter_timer->adjust(attotime::zero); } } break; diff --git a/src/devices/machine/z80ctc.cpp b/src/devices/machine/z80ctc.cpp index 17ed606d085..295d484ad82 100644 --- a/src/devices/machine/z80ctc.cpp +++ b/src/devices/machine/z80ctc.cpp @@ -404,7 +404,7 @@ void z80ctc_channel_device::write(u8 data) if ((m_mode & MODE) == MODE_COUNTER || (m_mode & TRIGGER) == TRIGGER_AUTO) { attotime curperiod = period(); - m_timer->adjust(curperiod, 0, curperiod); + m_timer->adjust_periodic(curperiod); } // else set the bit indicating that we're waiting for the appropriate trigger @@ -513,7 +513,7 @@ TIMER_CALLBACK_MEMBER(z80ctc_channel_device::timer_callback) { attotime curperiod = period(); LOG("Period = %s\n", curperiod.as_string()); - m_timer->adjust(curperiod, 0, curperiod); + m_timer->adjust_periodic(curperiod); // we're no longer waiting m_mode &= ~WAITING_FOR_TRIG; diff --git a/src/devices/machine/z80scc.cpp b/src/devices/machine/z80scc.cpp index 24fa8e6399c..58c306dfef3 100644 --- a/src/devices/machine/z80scc.cpp +++ b/src/devices/machine/z80scc.cpp @@ -1199,7 +1199,7 @@ void z80scc_channel::device_timer(timer_instance const &timer) { // int rate = owner()->clock() / brconst; // attotime attorate = attotime::from_hz(rate); - // baudtimer->adjust(attorate, id, attorate); + // baudtimer->adjust_periodic(attorate, id); txc_w(m_brg_counter & 1); rxc_w(m_brg_counter & 1); m_brg_counter++; // Will just keep track of state in timer mode, not hardware counter value. @@ -1207,7 +1207,7 @@ void z80scc_channel::device_timer(timer_instance const &timer) else { LOG(" - turning off Baudrate timer\n"); - baudtimer->adjust(attotime::never, 0, attotime::never); + baudtimer->adjust(attotime::never); } } break; @@ -2287,7 +2287,7 @@ void z80scc_channel::do_sccreg_wr14(uint8_t data) if (data & WR14_BRG_SOURCE) // Do we use the PCLK as baudrate source { #if Z80SCC_USE_LOCAL_BRG - baudtimer->adjust(attotime::from_hz(rate), TIMER_ID_BAUD, attotime::from_hz(rate)); // Start the baudrate generator + baudtimer->adjust_periodic(attotime::from_hz(rate), TIMER_ID_BAUD); // Start the baudrate generator #if START_BIT_HUNT m_rcv_mode = RCV_SEEKING; #endif @@ -2297,7 +2297,7 @@ void z80scc_channel::do_sccreg_wr14(uint8_t data) else if ( (m_wr14 & WR14_BRG_ENABLE) && !(data & WR14_BRG_ENABLE) ) // baud rate generator being disabled? { #if Z80SCC_USE_LOCAL_BRG - baudtimer->adjust(attotime::never, TIMER_ID_BAUD, attotime::never); // Stop the baudrate generator + baudtimer->adjust(attotime::never, TIMER_ID_BAUD); // Stop the baudrate generator m_brg_counter = 0; #endif } diff --git a/src/devices/machine/z80sti.cpp b/src/devices/machine/z80sti.cpp index 98ab1a5a495..642657e0158 100644 --- a/src/devices/machine/z80sti.cpp +++ b/src/devices/machine/z80sti.cpp @@ -462,12 +462,12 @@ void z80sti_device::write(offs_t offset, uint8_t data) LOG("Z80STI Timer D Prescaler: %u\n", tdc); if (tcc) - m_timer[TIMER_C]->adjust(attotime::from_hz(clock() / tcc), TIMER_C, attotime::from_hz(clock() / tcc)); + m_timer[TIMER_C]->adjust_periodic(attotime::from_hz(clock() / tcc), TIMER_C); else m_timer[TIMER_C]->enable(false); if (tdc) - m_timer[TIMER_D]->adjust(attotime::from_hz(clock() / tdc), TIMER_D, attotime::from_hz(clock() / tdc)); + m_timer[TIMER_D]->adjust_periodic(attotime::from_hz(clock() / tdc), TIMER_D); else m_timer[TIMER_D]->enable(false); @@ -568,12 +568,12 @@ void z80sti_device::write(offs_t offset, uint8_t data) LOG("Z80STI Timer B Prescaler: %u\n", tbc); if (tac) - m_timer[TIMER_A]->adjust(attotime::from_hz(clock() / tac), TIMER_A, attotime::from_hz(clock() / tac)); + m_timer[TIMER_A]->adjust_periodic(attotime::from_hz(clock() / tac), TIMER_A); else m_timer[TIMER_A]->enable(false); if (tbc) - m_timer[TIMER_B]->adjust(attotime::from_hz(clock() / tbc), TIMER_B, attotime::from_hz(clock() / tbc)); + m_timer[TIMER_B]->adjust_periodic(attotime::from_hz(clock() / tbc), TIMER_B); else m_timer[TIMER_B]->enable(false); } diff --git a/src/devices/machine/z8536.cpp b/src/devices/machine/z8536.cpp index 0de327d5b80..316626aa9f2 100644 --- a/src/devices/machine/z8536.cpp +++ b/src/devices/machine/z8536.cpp @@ -827,7 +827,7 @@ void cio_base_device::device_start() // allocate timer m_timer = timer_alloc(); - m_timer->adjust(attotime::from_hz(clock() / 2), 0, attotime::from_hz(clock() / 2)); + m_timer->adjust_periodic(attotime::from_hz(clock() / 2)); // resolve callbacks m_write_irq.resolve_safe(); diff --git a/src/devices/sound/ad1848.cpp b/src/devices/sound/ad1848.cpp index a45c5f2043d..77008ca7797 100644 --- a/src/devices/sound/ad1848.cpp +++ b/src/devices/sound/ad1848.cpp @@ -101,7 +101,7 @@ void ad1848_device::write(offs_t offset, uint8_t data) // FIXME: provide external configuration for XTAL1 (24.576 MHz) and XTAL2 (16.9344 MHz) inputs attotime rate = m_play ? attotime::from_hz(((m_regs.dform & 1) ? 16.9344_MHz_XTAL : 24.576_MHz_XTAL) / div_factor[(m_regs.dform >> 1) & 7]) : attotime::never; - m_timer->adjust(rate, 0 , rate); + m_timer->adjust_periodic(rate); m_drq_cb(m_play ? ASSERT_LINE : CLEAR_LINE); break; } diff --git a/src/devices/sound/dave.cpp b/src/devices/sound/dave.cpp index df825a8f918..64f2000a8da 100644 --- a/src/devices/sound/dave.cpp +++ b/src/devices/sound/dave.cpp @@ -84,10 +84,10 @@ void dave_device::device_start() // allocate timers m_timer_1hz = timer_alloc(TIMER_1HZ); - m_timer_1hz->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); + m_timer_1hz->adjust_periodic(attotime::from_hz(2)); m_timer_50hz = timer_alloc(TIMER_50HZ); - m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000)); + m_timer_50hz->adjust_periodic(attotime::from_hz(2000)); // state saving save_item(NAME(m_segment)); @@ -480,14 +480,14 @@ void dave_device::io_w(offs_t offset, uint8_t data) case 0: { //logerror("1kHz\n"); - m_timer_50hz->adjust(attotime::from_hz(2000), 0, attotime::from_hz(2000)); + m_timer_50hz->adjust_periodic(attotime::from_hz(2000)); } break; case 1: { //logerror("50Hz\n"); - m_timer_50hz->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); + m_timer_50hz->adjust_periodic(attotime::from_hz(100)); } break; diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp index a318b30f7b9..cdfcb33bb1b 100644 --- a/src/devices/sound/es5503.cpp +++ b/src/devices/sound/es5503.cpp @@ -245,7 +245,7 @@ void es5503_device::device_clock_changed() m_mix_buffer.resize((output_rate/50)*8); attotime update_rate = output_rate ? attotime::from_hz(output_rate) : attotime::never; - m_timer->adjust(update_rate, 0, update_rate); + m_timer->adjust_periodic(update_rate); } void es5503_device::device_reset() diff --git a/src/devices/sound/gb.cpp b/src/devices/sound/gb.cpp index 58abcfecf15..b83140240d4 100644 --- a/src/devices/sound/gb.cpp +++ b/src/devices/sound/gb.cpp @@ -144,7 +144,7 @@ void gameboy_sound_device::device_start() { m_channel = stream_alloc(0, 2, SAMPLE_RATE_OUTPUT_ADAPTIVE); m_timer = timer_alloc(*this, FUNC(gameboy_sound_device::timer_callback)); - m_timer->adjust(clocks_to_attotime(FRAME_CYCLES/128), 0, clocks_to_attotime(FRAME_CYCLES/128)); + m_timer->adjust_periodic(clocks_to_attotime(FRAME_CYCLES/128)); save_item(NAME(m_last_updated)); save_item(NAME(m_snd_regs)); @@ -175,7 +175,7 @@ void gameboy_sound_device::device_start() void gameboy_sound_device::device_clock_changed() { - m_timer->adjust(clocks_to_attotime(FRAME_CYCLES / 128), 0, clocks_to_attotime(FRAME_CYCLES / 128)); + m_timer->adjust_periodic(clocks_to_attotime(FRAME_CYCLES / 128)); } diff --git a/src/devices/sound/huc6230.cpp b/src/devices/sound/huc6230.cpp index dda44676615..f1c47fc89c0 100644 --- a/src/devices/sound/huc6230.cpp +++ b/src/devices/sound/huc6230.cpp @@ -206,5 +206,5 @@ void huc6230_device::device_clock_changed() { m_stream->set_sample_rate(clock() / 6); attotime adpcm_period = clocks_to_attotime(682); - m_adpcm_timer->adjust(adpcm_period, 0, adpcm_period); + m_adpcm_timer->adjust_periodic(adpcm_period); } diff --git a/src/devices/sound/ics2115.cpp b/src/devices/sound/ics2115.cpp index 16377429d11..66957f42fca 100644 --- a/src/devices/sound/ics2115.cpp +++ b/src/devices/sound/ics2115.cpp @@ -434,7 +434,7 @@ int ics2115_device::fill_output(ics2115_voice& voice, std::vector<write_stream_v { constexpr int RAMP_SHIFT = 6; const u32 volacc = (voice.vol.acc >> 14) & 0xfff; - const u16 vlefti = volacc - m_panlaw[255 - voice.vol.pan]; // left index from acc - pan law + const u16 vlefti = volacc - m_panlaw[255 - voice.vol.pan]; // left index from acc - pan law const u16 vrighti = volacc - m_panlaw[voice.vol.pan]; // right index from acc - pan law //check negative values so no cracks, is it a hardware feature ? const u16 vleft = vlefti > 0 ? (m_volume[vlefti] * voice.state.ramp >> RAMP_SHIFT) : 0; @@ -1112,7 +1112,7 @@ void ics2115_device::recalc_timer(int timer) m_timer[timer].period = period; // Adjust the timer lengths if (period) // Reset the length - m_timer[timer].timer->adjust(attotime::from_nsec(period), 0, attotime::from_nsec(period)); + m_timer[timer].timer->adjust_periodic(attotime::from_nsec(period)); else // Kill the timer if length == 0 m_timer[timer].timer->adjust(attotime::never); } diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index 00f8640aed2..0733ed96a07 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -137,7 +137,7 @@ void k053260_device::device_start() void k053260_device::device_clock_changed() { m_stream->set_sample_rate(clock() / CLOCKS_PER_SAMPLE); - m_timer->adjust(attotime::from_ticks(16, clock()), 0, attotime::from_ticks(16, clock())); + m_timer->adjust_periodic(attotime::from_ticks(16, clock())); } @@ -147,7 +147,7 @@ void k053260_device::device_clock_changed() void k053260_device::device_reset() { - m_timer->adjust(attotime::from_ticks(16, clock()), 0, attotime::from_ticks(16, clock())); + m_timer->adjust_periodic(attotime::from_ticks(16, clock())); for (auto & elem : m_voice) elem.voice_reset(); diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp index 3ea1829b935..dba1b7dbeb2 100644 --- a/src/devices/sound/k054539.cpp +++ b/src/devices/sound/k054539.cpp @@ -426,7 +426,7 @@ void k054539_device::write(offs_t offset, u8 data) { attotime period = attotime::from_hz((float)(38 + data) * (clock()/384.0f/14400.0f)) / 2; - m_timer->adjust(period, 0, period); + m_timer->adjust_periodic(period); m_timer_state = 0; m_timer_handler(m_timer_state); diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp index 540a2c75099..0a2b88517e2 100644 --- a/src/devices/sound/ks0164.cpp +++ b/src/devices/sound/ks0164.cpp @@ -95,7 +95,7 @@ void ks0164_device::device_reset() m_midi_in = 0x00; m_midi_in_active = false; - m_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + m_timer->adjust_periodic(attotime::from_msec(1)); } void ks0164_device::device_timer(timer_instance const &timer) diff --git a/src/devices/sound/msm5205.cpp b/src/devices/sound/msm5205.cpp index f19bce790d6..56b27eb1b1e 100644 --- a/src/devices/sound/msm5205.cpp +++ b/src/devices/sound/msm5205.cpp @@ -346,7 +346,7 @@ void msm5205_device::device_clock_changed() logerror("/%d prescaler selected\n", prescaler); attotime half_period = clocks_to_attotime(prescaler / 2); - m_vck_timer->adjust(half_period, 0, half_period); + m_vck_timer->adjust_periodic(half_period); } else { diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp index 7f21a791667..bdda5c6d9f8 100644 --- a/src/devices/sound/tms5110.cpp +++ b/src/devices/sound/tms5110.cpp @@ -1207,7 +1207,7 @@ int tms5110_device::romclk_hack_r() if (!m_romclk_hack_timer_started) { m_romclk_hack_timer_started = true; - m_romclk_hack_timer->adjust(attotime::from_hz(clock() / 40), 0, attotime::from_hz(clock() / 40)); + m_romclk_hack_timer->adjust_periodic(attotime::from_hz(clock() / 40)); } return m_romclk_hack_state; } diff --git a/src/devices/video/ef9345.cpp b/src/devices/video/ef9345.cpp index 7ca90ce7685..7e9ba89a257 100644 --- a/src/devices/video/ef9345.cpp +++ b/src/devices/video/ef9345.cpp @@ -139,7 +139,7 @@ void ef9345_device::device_start() m_screen_out.allocate(496, screen().height()); - m_blink_timer->adjust(attotime::from_msec(500), 0, attotime::from_msec(500)); + m_blink_timer->adjust_periodic(attotime::from_msec(500)); init_accented_chars(); diff --git a/src/devices/video/hd44352.cpp b/src/devices/video/hd44352.cpp index 471e2251e9b..db5e68565e2 100644 --- a/src/devices/video/hd44352.cpp +++ b/src/devices/video/hd44352.cpp @@ -58,7 +58,7 @@ void hd44352_device::device_start() m_on_cb.resolve_safe(); m_on_timer = timer_alloc(ON_TIMER); - m_on_timer->adjust(attotime::from_hz(m_clock/16384), 0, attotime::from_hz(m_clock/16384)); + m_on_timer->adjust_periodic(attotime::from_hz(m_clock/16384)); save_item( NAME(m_control_lines)); save_item( NAME(m_data_bus)); @@ -334,7 +334,7 @@ void hd44352_device::data_write(uint8_t data) default: on_timer_rate = 8192; break; } - m_on_timer->adjust(attotime::from_hz(m_clock/on_timer_rate), 0, attotime::from_hz(m_clock/on_timer_rate)); + m_on_timer->adjust_periodic(attotime::from_hz(m_clock/on_timer_rate)); } m_data_bus = 0xff; m_state = 0; diff --git a/src/devices/video/hd44780.cpp b/src/devices/video/hd44780.cpp index 6b00a9a7328..1ca59c57ecd 100644 --- a/src/devices/video/hd44780.cpp +++ b/src/devices/video/hd44780.cpp @@ -115,7 +115,7 @@ void hd44780_device::device_start() m_busy_timer = timer_alloc(TIMER_BUSY); m_blink_timer = timer_alloc(TIMER_BLINKING); - m_blink_timer->adjust(attotime::from_msec(409), 0, attotime::from_msec(409)); + m_blink_timer->adjust_periodic(attotime::from_msec(409)); // state saving save_item(NAME(m_busy_factor)); diff --git a/src/devices/video/hlcd0438.cpp b/src/devices/video/hlcd0438.cpp index 42317ddb087..808d2b8d1f2 100644 --- a/src/devices/video/hlcd0438.cpp +++ b/src/devices/video/hlcd0438.cpp @@ -38,7 +38,7 @@ void hlcd0438_device::device_start() // timer (when LCD pin is oscillator) m_lcd_timer = timer_alloc(); attotime period = (clock() != 0) ? attotime::from_hz(2 * clock()) : attotime::never; - m_lcd_timer->adjust(period, 0, period); + m_lcd_timer->adjust_periodic(period); // register for savestates save_item(NAME(m_data_in)); diff --git a/src/devices/video/hlcd0515.cpp b/src/devices/video/hlcd0515.cpp index 541cd1f1006..e1edf66f54e 100644 --- a/src/devices/video/hlcd0515.cpp +++ b/src/devices/video/hlcd0515.cpp @@ -65,7 +65,7 @@ void hlcd0515_device::device_start() // timer m_lcd_timer = timer_alloc(); attotime period = attotime::from_hz(clock() / 2); - m_lcd_timer->adjust(period, 0, period); + m_lcd_timer->adjust_periodic(period); // zerofill m_cs = 0; diff --git a/src/devices/video/hlcd0538.cpp b/src/devices/video/hlcd0538.cpp index a5f731313e9..a3ba23081af 100644 --- a/src/devices/video/hlcd0538.cpp +++ b/src/devices/video/hlcd0538.cpp @@ -53,7 +53,7 @@ void hlcd0538_device::device_start() // timer (when LCD pin is oscillator) m_lcd_timer = timer_alloc(); attotime period = (clock() != 0) ? attotime::from_hz(2 * clock()) : attotime::never; - m_lcd_timer->adjust(period, 0, period); + m_lcd_timer->adjust_periodic(period); // register for savestates save_item(NAME(m_lcd)); diff --git a/src/devices/video/pcf2100.cpp b/src/devices/video/pcf2100.cpp index 902c95ab1cf..0648498d928 100644 --- a/src/devices/video/pcf2100.cpp +++ b/src/devices/video/pcf2100.cpp @@ -61,7 +61,7 @@ void pcf2100_device::device_start() // timer m_lcd_timer = timer_alloc(); attotime period = attotime::from_hz(clock()); - m_lcd_timer->adjust(period, 0, period); + m_lcd_timer->adjust_periodic(period); // register for savestates save_item(NAME(m_shift)); diff --git a/src/devices/video/sed1500.cpp b/src/devices/video/sed1500.cpp index 6da9769898e..3cfd799f9b2 100644 --- a/src/devices/video/sed1500.cpp +++ b/src/devices/video/sed1500.cpp @@ -71,7 +71,7 @@ void sed1500_device::device_start() // timer m_lcd_timer = timer_alloc(); attotime period = attotime::from_hz(clock() / 64); - m_lcd_timer->adjust(period, 0, period); + m_lcd_timer->adjust_periodic(period); // register for savestates save_item(NAME(m_mode)); diff --git a/src/devices/video/v9938.cpp b/src/devices/video/v9938.cpp index e2e952c524b..fa1cdbdb035 100644 --- a/src/devices/video/v9938.cpp +++ b/src/devices/video/v9938.cpp @@ -708,7 +708,7 @@ void v99x8_device::device_reset() m_stat_reg[6] = 0xfc; // Start the timer - m_line_timer->adjust(attotime::from_ticks(HTOTAL*2, m_clock), 0, attotime::from_ticks(HTOTAL*2, m_clock)); + m_line_timer->adjust_periodic(attotime::from_ticks(HTOTAL*2, m_clock)); configure_pal_ntsc(); set_screen_parameters(); diff --git a/src/emu/diexec.cpp b/src/emu/diexec.cpp index aefd1ed8c41..c0926abf836 100644 --- a/src/emu/diexec.cpp +++ b/src/emu/diexec.cpp @@ -497,7 +497,7 @@ void device_execute_interface::interface_post_reset() // reconfigure periodic interrupts if (!m_periodic_interrupt_period.is_zero()) - m_periodic_interrupt_timer.adjust(m_periodic_interrupt_period, 0, m_periodic_interrupt_period); + m_periodic_interrupt_timer.adjust_periodic(m_periodic_interrupt_period); } diff --git a/src/emu/diserial.cpp b/src/emu/diserial.cpp index 8b2262cd94b..84b444a21ba 100644 --- a/src/emu/diserial.cpp +++ b/src/emu/diserial.cpp @@ -366,7 +366,7 @@ void device_serial_interface::transmit_register_setup(u8 data_byte) u8 transmit_data; if(!m_tra_rate.is_never()) - m_tra_clock.adjust(m_tra_rate, 0, m_tra_rate); + m_tra_clock.adjust_periodic(m_tra_rate); m_tra_bit_count_transmitted = 0; m_tra_bit_count = 0; diff --git a/src/emu/schedule.h b/src/emu/schedule.h index 441c7573729..fce2cd4c0dd 100644 --- a/src/emu/schedule.h +++ b/src/emu/schedule.h @@ -505,7 +505,8 @@ public: bool enable(bool enable = true); bool disable() { return enable(false); } persistent_timer &reset(attotime const &duration = attotime::never) { return adjust(duration, m_instance.param(), m_period); } - persistent_timer &adjust(attotime const &start_delay, s32 param = 0, attotime const &periodicity = attotime::never) { return adjust_internal(start_delay, param, periodicity, false); } + persistent_timer &adjust(attotime const &start_delay, s32 param = 0, attotime const &period = attotime::never) { return adjust_internal(start_delay, param, period, false); } + persistent_timer &adjust_periodic(attotime const &period, s32 param = 0) { return adjust_internal(period, param, period, false); } persistent_timer &adjust_absolute(attotime const &start_time, s32 param = 0, attotime const &periodicity = attotime::never) { return adjust_internal(start_time, param, periodicity, true); } // save state diff --git a/src/emu/sound.cpp b/src/emu/sound.cpp index 98cdb80efc9..11d1173ff4f 100644 --- a/src/emu/sound.cpp +++ b/src/emu/sound.cpp @@ -1105,7 +1105,7 @@ sound_manager::sound_manager(running_machine &machine) : // start the periodic update flushing timer m_update_timer.init(machine.scheduler(), *this, FUNC(sound_manager::update)); - m_update_timer.adjust(STREAMS_UPDATE_ATTOTIME, 0, STREAMS_UPDATE_ATTOTIME); + m_update_timer.adjust_periodic(STREAMS_UPDATE_ATTOTIME); } diff --git a/src/emu/video.cpp b/src/emu/video.cpp index 01d0ad576a2..0ec77cc5f72 100644 --- a/src/emu/video.cpp +++ b/src/emu/video.cpp @@ -171,7 +171,7 @@ video_manager::video_manager(running_machine &machine) if (no_screens) { m_screenless_frame_timer.init(machine.scheduler(), *this, FUNC(video_manager::screenless_update_callback)); - m_screenless_frame_timer.adjust(screen_device::DEFAULT_FRAME_PERIOD, 0, screen_device::DEFAULT_FRAME_PERIOD); + m_screenless_frame_timer.adjust_periodic(screen_device::DEFAULT_FRAME_PERIOD); machine.output().set_global_notifier(video_notifier_callback, this); } } diff --git a/src/mame/audio/ad_sound.cpp b/src/mame/audio/ad_sound.cpp index 003f534ab12..5cb7ce49818 100644 --- a/src/mame/audio/ad_sound.cpp +++ b/src/mame/audio/ad_sound.cpp @@ -408,7 +408,7 @@ void ad_59mc07_device::device_start() save_item(NAME(m_hihatvol)); m_adjuster_timer = timer_alloc(*this, FUNC(ad_59mc07_device::frq_adjuster_callback)); - m_adjuster_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); + m_adjuster_timer->adjust_periodic(attotime::from_hz(60)); } diff --git a/src/mame/audio/alesis.cpp b/src/mame/audio/alesis.cpp index 79e619bc980..429e2ed8ad8 100644 --- a/src/mame/audio/alesis.cpp +++ b/src/mame/audio/alesis.cpp @@ -64,7 +64,7 @@ void alesis_dm3ag_device::device_start() void alesis_dm3ag_device::device_reset() { - m_dac_update_timer->adjust(attotime::from_hz(48000), 0, attotime::from_hz(48000)); + m_dac_update_timer->adjust_periodic(attotime::from_hz(48000)); m_output_active = false; m_count = 0; diff --git a/src/mame/audio/cage.cpp b/src/mame/audio/cage.cpp index e0ea7862260..47c12282c8a 100644 --- a/src/mame/audio/cage.cpp +++ b/src/mame/audio/cage.cpp @@ -122,8 +122,6 @@ atari_cage_device::atari_cage_device(const machine_config &mconfig, device_type m_cpu(*this, "cpu"), m_cageram(*this, "cageram"), m_soundlatch(*this, "soundlatch"), - m_dma_timer(*this, "cage_dma_timer"), - m_timer(*this, "cage_timer%u", 0U), m_dmadac(*this, "dac%u", 1U), m_bootbank(*this, "bootbank"), m_mainbank(*this, "mainbank"), @@ -139,7 +137,9 @@ atari_cage_device::atari_cage_device(const machine_config &mconfig, device_type void atari_cage_device::device_start() { - attotime cage_cpu_clock_period; + m_dma_timer.init(*this, FUNC(atari_cage_device::dma_timer_callback)); + m_timer[0].init(*this, FUNC(atari_cage_device::cage_timer_callback)); + m_timer[1].init(*this, FUNC(atari_cage_device::cage_timer_callback)); // resolve callbacks m_irqhandler.resolve_safe(); @@ -147,7 +147,7 @@ void atari_cage_device::device_start() m_bootbank->set_base(m_bootrom->base()); m_mainbank->set_base(m_mainrom->base()); - cage_cpu_clock_period = attotime::from_hz(m_cpu->clock()); + attotime cage_cpu_clock_period = attotime::from_hz(m_cpu->clock()); m_cpu_h1_clock_period = cage_cpu_clock_period * 2; m_cage_deferred_w.init(*this, FUNC(atari_cage_device::cage_deferred_w)); @@ -184,14 +184,14 @@ void atari_cage_device::reset_w(int state) * *************************************/ -TIMER_DEVICE_CALLBACK_MEMBER( atari_cage_device::dma_timer_callback ) +void atari_cage_device::dma_timer_callback(int param) { /* if we weren't enabled, don't do anything, just shut ourself off */ if (!m_dma_enabled) { if (m_dma_timer_enabled) { - m_dma_timer->adjust(attotime::never); + m_dma_timer.adjust(attotime::never); m_dma_timer_enabled = 0; } return; @@ -244,7 +244,7 @@ void atari_cage_device::update_dma_state() if (!m_dma_timer_enabled) { attotime period = m_serial_period_per_word * m_tms32031_io_regs[DMA_TRANSFER_COUNT]; - m_dma_timer->adjust(period, addr, period); + m_dma_timer.adjust_periodic(period, addr); m_dma_timer_enabled = 1; } } @@ -252,7 +252,7 @@ void atari_cage_device::update_dma_state() /* see if we turned off */ else if (!enabled && m_dma_enabled) { - m_dma_timer->reset(); + m_dma_timer.reset(); m_dma_timer_enabled = 0; } @@ -268,9 +268,8 @@ void atari_cage_device::update_dma_state() * *************************************/ -TIMER_DEVICE_CALLBACK_MEMBER( atari_cage_device::cage_timer_callback ) +void atari_cage_device::cage_timer_callback(int which) { - int which = param; /* set the interrupt */ m_cpu->set_input_line(TMS3203X_TINT0 + which, ASSERT_LINE); m_timer_enabled[which] = 0; @@ -293,13 +292,13 @@ void atari_cage_device::update_timer(int which) if (m_tms32031_io_regs[base + TIMER0_GLOBAL_CTL] != 0x2c1) logerror("CAGE TIMER%d: unexpected timer config %08X!\n", which, m_tms32031_io_regs[base + TIMER0_GLOBAL_CTL]); - m_timer[which]->adjust(period, which); + m_timer[which].adjust(period, which); } /* see if we turned off */ else if (!enabled && m_timer_enabled[which]) { - m_timer[which]->adjust(attotime::never, which); + m_timer[which].adjust(attotime::never, which); } /* set the new state */ @@ -544,12 +543,12 @@ void atari_cage_device::control_w(uint16_t data) m_dma_enabled = 0; m_dma_timer_enabled = 0; - m_dma_timer->reset(); + m_dma_timer.reset(); m_timer_enabled[0] = 0; m_timer_enabled[1] = 0; - m_timer[0]->reset(); - m_timer[1]->reset(); + m_timer[0].reset(); + m_timer[1].reset(); memset(m_tms32031_io_regs, 0, 0x60 * 4); @@ -623,10 +622,6 @@ void atari_cage_device::device_add_mconfig(machine_config &config) m_cpu->set_addrmap(AS_PROGRAM, &atari_cage_device::cage_map); m_cpu->set_mcbl_mode(true); - TIMER(config, m_dma_timer).configure_generic(DEVICE_SELF, FUNC(atari_cage_device::dma_timer_callback)); - TIMER(config, m_timer[0]).configure_generic(DEVICE_SELF, FUNC(atari_cage_device::cage_timer_callback)); - TIMER(config, m_timer[1]).configure_generic(DEVICE_SELF, FUNC(atari_cage_device::cage_timer_callback)); - /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); diff --git a/src/mame/audio/cage.h b/src/mame/audio/cage.h index 8ae4ced0daf..d309a607745 100644 --- a/src/mame/audio/cage.h +++ b/src/mame/audio/cage.h @@ -13,7 +13,6 @@ #include "cpu/tms32031/tms32031.h" #include "machine/gen_latch.h" -#include "machine/timer.h" #include "sound/dmadac.h" @@ -51,8 +50,8 @@ protected: virtual void device_start() override; virtual void device_add_mconfig(machine_config &config) override; - TIMER_DEVICE_CALLBACK_MEMBER( dma_timer_callback ); - TIMER_DEVICE_CALLBACK_MEMBER( cage_timer_callback ); + void dma_timer_callback(int param); + void cage_timer_callback(int which); required_device<tms32031_device> m_cpu; @@ -71,8 +70,6 @@ protected: private: required_shared_ptr<uint32_t> m_cageram; required_device<generic_latch_16_device> m_soundlatch; - required_device<timer_device> m_dma_timer; - required_device_array<timer_device, 2> m_timer; optional_device_array<dmadac_sound_device, 4> m_dmadac; required_memory_bank m_bootbank; @@ -102,6 +99,9 @@ private: uint32_t *m_speedup_ram; offs_t m_speedup; + + persistent_timer m_dma_timer; + persistent_timer m_timer[2]; }; diff --git a/src/mame/audio/cmi01a.cpp b/src/mame/audio/cmi01a.cpp index 7ab0f789901..508a42e64a5 100644 --- a/src/mame/audio/cmi01a.cpp +++ b/src/mame/audio/cmi01a.cpp @@ -225,7 +225,7 @@ void cmi01a_device::device_reset() m_zx_timer->adjust(attotime::never); m_eosi_timer->adjust(attotime::never); - //m_bcas_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + //m_bcas_timer->adjust_periodic(attotime::from_hz(clock())); m_bcas_timer->adjust(attotime::never); } @@ -530,7 +530,7 @@ void cmi01a_device::run_voice() // Set timers and things m_zx_flag = 0; attotime zx_period = attotime::from_ticks(64, cfreq); - m_zx_timer->adjust(zx_period, 0, zx_period); + m_zx_timer->adjust_periodic(zx_period); if (m_load) { diff --git a/src/mame/audio/dcs.cpp b/src/mame/audio/dcs.cpp index d46df62ff8b..f1cbcfd94d7 100644 --- a/src/mame/audio/dcs.cpp +++ b/src/mame/audio/dcs.cpp @@ -595,7 +595,7 @@ void dcs_audio_device::dcs_reset() m_timer_ignore = false; m_timer_enable = 0; m_timer_scale = 1; - m_internal_timer->reset(); + m_internal_timer.reset(); /* reset the HLE transfer states */ m_transfer.dcs_state = m_transfer.state = 0; @@ -693,9 +693,6 @@ dcs_audio_device::dcs_audio_device(const machine_config &mconfig, device_type ty m_channels(0), m_size(0), m_incs(0), - m_reg_timer(*this, "dcs_reg_timer"), - m_sport0_timer(*this, "dcs_sport0_timer"), - m_internal_timer(*this, "dcs_int_timer"), m_ireg(0), m_ireg_base(0), m_bootrom(nullptr), @@ -799,6 +796,9 @@ void dcs_audio_device::device_start() m_s1_ack_callback1.init(*this, FUNC(dcs_audio_device::s1_ack_callback1)); m_s2_ack_callback.init(*this, FUNC(dcs_audio_device::s2_ack_callback)); + m_reg_timer.init(*this, FUNC(dcs_audio_device::dcs_irq)); + m_internal_timer.init(*this, FUNC(dcs_audio_device::internal_timer_callback)); + /* non-RAM based automatically acks */ m_auto_ack = true; /* register for save states */ @@ -899,13 +899,17 @@ void dcs2_audio_device::device_start() m_s1_ack_callback1.init(*this, FUNC(dcs_audio_device::s1_ack_callback1)); m_s2_ack_callback.init(*this, FUNC(dcs_audio_device::s2_ack_callback)); + m_reg_timer.init(*this, FUNC(dcs_audio_device::dcs_irq)); + m_sport0_timer.init(*this, FUNC(dcs_audio_device::sport0_irq)); + m_internal_timer.init(*this, FUNC(dcs_audio_device::internal_timer_callback)); + /* install the speedup handler */ install_speedup(); /* allocate a watchdog timer for HLE transfers */ m_transfer.hle_enabled = (ENABLE_HLE_TRANSFERS && m_dram_in_mb != 0 && m_rev < REV_DSIO); if (m_transfer.hle_enabled) - m_transfer.watchdog = subdevice<timer_device>("dcs_hle_timer"); + m_transfer.watchdog.init(*this, FUNC(dcs_audio_device::transfer_watchdog_callback)); /* register for save states */ dcs_register_state(); @@ -1284,8 +1288,8 @@ void dcs_audio_device::denver_reset() m_dmovlay_val = 0; dmovlay_remap_memory(); dmadac_enable(&m_dmadac[0], m_channels, 0); - m_reg_timer->reset(); - m_sport0_timer->reset(); + m_reg_timer.reset(); + m_sport0_timer.reset(); } void dcs_audio_device::denver_alloc_dmadac() @@ -1566,7 +1570,7 @@ void dcs_audio_device::data_w(uint16_t data) return; /* if we are DCS1, set a timer to latch the data */ - if (m_sport0_timer == nullptr) + if (m_rev < REV_DCS2) m_dcs_delayed_data_w.synchronize(data); else dcs_delayed_data_w(data); @@ -1747,7 +1751,7 @@ void dcs_audio_device::update_timer_count() } -TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::internal_timer_callback ) +void dcs_audio_device::internal_timer_callback() { int64_t target_cycles; @@ -1759,7 +1763,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::internal_timer_callback ) /* set the next timer, but only if it's for a reasonable number */ if (!m_timer_ignore && (m_timer_period > 10 || m_timer_scale > 1)) - m_internal_timer->adjust(m_cpu->cycles_to_attotime(target_cycles)); + m_internal_timer.adjust(m_cpu->cycles_to_attotime(target_cycles)); /* the IRQ line is edge triggered */ m_cpu->set_input_line(ADSP2105_TIMER, ASSERT_LINE); @@ -1811,7 +1815,7 @@ void dcs_audio_device::reset_timer() /* adjust the timer if not optimized */ if (!m_timer_ignore) - m_internal_timer->adjust(m_cpu->cycles_to_attotime(m_timer_scale * (m_timer_start_count + 1))); + m_internal_timer.adjust(m_cpu->cycles_to_attotime(m_timer_scale * (m_timer_start_count + 1))); } @@ -1829,7 +1833,7 @@ WRITE_LINE_MEMBER(dcs_audio_device::timer_enable_callback) // Update the timer so the start count is correct the next time the timer is enabled update_timer_count(); m_timer_enable = state; - m_internal_timer->reset(); + m_internal_timer.reset(); } } @@ -1912,24 +1916,24 @@ void dcs_audio_device:: adsp_control_w(offs_t offset, uint16_t data) if ((data & 0x0800) == 0) { dmadac_enable(&m_dmadac[0], m_channels, 0); - m_reg_timer->reset(); + m_reg_timer.reset(); } // Check SPORT0 enabled - if (m_sport0_timer) + if (m_rev >= REV_DCS2) { if (data & 0x1000) { // Start the SPORT0 timer // SPORT0 is used as a 1kHz timer - m_sport0_timer->adjust(attotime::from_usec(10), 0, attotime::from_hz(1000)); + m_sport0_timer.adjust(attotime::from_usec(10), 0, attotime::from_hz(1000)); if (LOG_DCS_IO) logerror("adsp_control_w: Setting SPORT0 freqency to 1kHz\n"); } else { // Stop the SPORT0 timer - m_sport0_timer->reset(); + m_sport0_timer.reset(); } } break; @@ -1939,7 +1943,7 @@ void dcs_audio_device:: adsp_control_w(offs_t offset, uint16_t data) if ((data & 0x0002) == 0) { dmadac_enable(&m_dmadac[0], m_channels, 0); - m_reg_timer->reset(); + m_reg_timer.reset(); } break; @@ -1988,7 +1992,7 @@ void dcs_audio_device:: adsp_control_w(offs_t offset, uint16_t data) DCS IRQ GENERATION CALLBACKS ****************************************************************************/ -TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::dcs_irq ) +void dcs_audio_device::dcs_irq() { /* get the index register */ int reg = m_cpu->state_int(ADSP2100_I0 + m_ireg); @@ -2031,9 +2035,8 @@ TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::dcs_irq ) logerror("dcs_irq end: m_size: %x m_incs: %x m_channels: %d m_ireg_base: %x reg: %06x\n", m_size, m_incs, m_channels, m_ireg_base, reg); } -TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::sport0_irq ) +void dcs_audio_device::sport0_irq() { - /* this latches internally, so we just pulse */ /* note that there is non-interrupt code that reads/modifies/writes the output_control */ /* register; if we don't interlock it, we will eventually lose sound (see CarnEvil) */ @@ -2073,7 +2076,7 @@ void dcs_audio_device::recompute_sample_rate() if (m_incs) { attotime period = (sample_period * m_size) / (2 * m_channels * m_incs); - m_reg_timer->adjust(period, 0, period); + m_reg_timer.adjust_periodic(period); } } @@ -2131,7 +2134,7 @@ void dcs_audio_device::sound_tx_callback(offs_t offset, uint32_t data) dmadac_enable(&m_dmadac[0], m_channels, 0); /* remove timer */ - m_reg_timer->reset(); + m_reg_timer.reset(); } @@ -2193,7 +2196,7 @@ void dcs_audio_device::fifo_notify(int count, int max) } -TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::transfer_watchdog_callback ) +void dcs_audio_device::transfer_watchdog_callback(int param) { hle_transfer_state &transfer = m_transfer; int starting_writes_left = param; @@ -2203,8 +2206,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( dcs_audio_device::transfer_watchdog_callback ) for ( ; transfer.fifo_entries; transfer.fifo_entries--) preprocess_write(m_fifo_data_r()); } - if (transfer.watchdog != nullptr) - transfer.watchdog->adjust(attotime::from_msec(1), transfer.writes_left); + transfer.watchdog.adjust(attotime::from_msec(1), transfer.writes_left); } @@ -2436,7 +2438,7 @@ int dcs_audio_device::preprocess_stage_2(uint16_t data) transfer.sum = 0; if (transfer.hle_enabled) { - transfer.watchdog->adjust(attotime::from_msec(1), transfer.writes_left); + transfer.watchdog.adjust(attotime::from_msec(1), transfer.writes_left); return 1; } break; @@ -2463,7 +2465,7 @@ int dcs_audio_device::preprocess_stage_2(uint16_t data) if (transfer.state == 0) { m_s2_ack_callback.call_after(attotime::from_usec(1), transfer.sum); - transfer.watchdog->reset(); + transfer.watchdog.reset(); } return 1; } @@ -2479,7 +2481,7 @@ int dcs_audio_device::preprocess_write(uint16_t data) int result; /* if we're not DCS2, skip */ - if (!m_sport0_timer) + if (m_rev < REV_DCS2) return 0; /* state 0 - initialization phase */ @@ -2509,9 +2511,6 @@ void dcs_audio_device::add_mconfig_dcs(machine_config &config) dcs.set_addrmap(AS_PROGRAM, &dcs_audio_device::dcs_2k_program_map); dcs.set_addrmap(AS_DATA, &dcs_audio_device::dcs_2k_data_map); - TIMER(config, m_reg_timer).configure_generic(FUNC(dcs_audio_device::dcs_irq)); - TIMER(config, m_internal_timer).configure_generic(FUNC(dcs_audio_device::internal_timer_callback)); - SPEAKER(config, "mono").front_center(); DMADAC(config, "dac").add_route(ALL_OUTPUTS, "mono", 1.0); // AD-1851 16bit mono @@ -2606,11 +2605,6 @@ void dcs2_audio_device::add_mconfig_dcs2(machine_config &config) dcs2.set_addrmap(AS_PROGRAM, &dcs2_audio_device::dcs2_2115_program_map); dcs2.set_addrmap(AS_DATA, &dcs2_audio_device::dcs2_2115_data_map); - TIMER(config, "dcs_reg_timer").configure_generic(FUNC(dcs_audio_device::dcs_irq)); - TIMER(config, "dcs_sport0_timer").configure_generic(FUNC(dcs_audio_device::sport0_irq)); - TIMER(config, "dcs_int_timer").configure_generic(FUNC(dcs_audio_device::internal_timer_callback)); - TIMER(config, "dcs_hle_timer").configure_generic(FUNC(dcs_audio_device::transfer_watchdog_callback)); - SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -2680,10 +2674,6 @@ void dcs2_audio_dsio_device::device_add_mconfig(machine_config &config) ADDRESS_MAP_BANK(config, "data_map_bank").set_map(&dcs2_audio_dsio_device::dsio_rambank_map).set_options(ENDIANNESS_LITTLE, 16, 14, 0x2000); - TIMER(config, m_reg_timer).configure_generic(FUNC(dcs_audio_device::dcs_irq)); - TIMER(config, m_internal_timer).configure_generic(FUNC(dcs_audio_device::internal_timer_callback)); - TIMER(config, m_sport0_timer).configure_generic(FUNC(dcs_audio_device::sport0_irq)); // roadburn needs this to pass hardware test - SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); @@ -2711,10 +2701,6 @@ void dcs2_audio_denver_device::device_add_mconfig(machine_config &config) denver.set_addrmap(AS_IO, &dcs2_audio_denver_device::denver_io_map); ADDRESS_MAP_BANK(config, m_ram_map).set_map(&dcs2_audio_denver_device::denver_rambank_map).set_options(ENDIANNESS_LITTLE, 16, 15, 0x2000*2); - - TIMER(config, m_reg_timer).configure_generic(FUNC(dcs_audio_device::dcs_irq)); - TIMER(config, m_internal_timer).configure_generic(FUNC(dcs_audio_device::internal_timer_callback)); - TIMER(config, m_sport0_timer).configure_generic(FUNC(dcs_audio_device::sport0_irq)); // Atlantis driver waits for sport0 rx interrupts } dcs2_audio_denver_5ch_device::dcs2_audio_denver_5ch_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : diff --git a/src/mame/audio/dcs.h b/src/mame/audio/dcs.h index 93c44ee76f1..a066323d277 100644 --- a/src/mame/audio/dcs.h +++ b/src/mame/audio/dcs.h @@ -14,7 +14,6 @@ #include "cpu/adsp2100/adsp2100.h" #include "sound/dmadac.h" #include "machine/bankdev.h" -#include "machine/timer.h" class dcs_audio_device : public device_t @@ -81,20 +80,20 @@ public: void output_control_w(uint16_t data); uint16_t output_control_r(); void update_timer_count(); - TIMER_DEVICE_CALLBACK_MEMBER( internal_timer_callback ); + void internal_timer_callback(); void reset_timer(); DECLARE_WRITE_LINE_MEMBER(timer_enable_callback); uint16_t adsp_control_r(offs_t offset); void adsp_control_w(offs_t offset, uint16_t data); - TIMER_DEVICE_CALLBACK_MEMBER( dcs_irq ); - TIMER_DEVICE_CALLBACK_MEMBER( sport0_irq ); + void dcs_irq(); + void sport0_irq(); void recompute_sample_rate(); void sound_tx_callback(offs_t offset, uint32_t data); uint16_t dcs_polling_r(address_space &space); void dcs_polling_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0); uint32_t dcs_polling32_r(address_space &space); void dcs_polling32_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); - TIMER_DEVICE_CALLBACK_MEMBER( transfer_watchdog_callback ); + void transfer_watchdog_callback(int param); void s1_ack_callback2(); void s1_ack_callback1(uint16_t param); int preprocess_stage_1(uint16_t data); @@ -165,7 +164,7 @@ protected: int32_t writes_left; uint16_t sum; int32_t fifo_entries; - timer_device *watchdog; + persistent_timer watchdog; }; adsp21xx_device *m_cpu; @@ -179,9 +178,6 @@ protected: uint16_t m_size; uint16_t m_incs; dmadac_sound_device *m_dmadac[6]; - required_device<timer_device> m_reg_timer; - optional_device<timer_device> m_sport0_timer; - required_device<timer_device> m_internal_timer; int32_t m_ireg; uint16_t m_ireg_base; uint16_t m_control_regs[32]; @@ -237,6 +233,10 @@ protected: transient_timer_factory m_s1_ack_callback1; transient_timer_factory m_s2_ack_callback; + persistent_timer m_reg_timer; + persistent_timer m_sport0_timer; + persistent_timer m_internal_timer; + std::unique_ptr<uint16_t[]> m_sram; uint16_t m_polling_value; uint32_t m_polling32_value; diff --git a/src/mame/audio/geebee.cpp b/src/mame/audio/geebee.cpp index 9144a44b21e..67acedfa196 100644 --- a/src/mame/audio/geebee.cpp +++ b/src/mame/audio/geebee.cpp @@ -86,7 +86,7 @@ void geebee_sound_device::sound_w(u8 data) * discharge C33 (1uF) through R50 (22k) -> 0.14058s */ attotime period = attotime::from_hz(32768) * 14058 / 100000; - m_volume_timer->adjust(period, 0, period); + m_volume_timer->adjust_periodic(period); } else { @@ -98,7 +98,7 @@ void geebee_sound_device::sound_w(u8 data) * maybe half as fast? */ attotime period = attotime::from_hz(32768) * 29060 / 100000; - m_volume_timer->adjust(period, 0, period); + m_volume_timer->adjust_periodic(period); } } diff --git a/src/mame/audio/jaguar.cpp b/src/mame/audio/jaguar.cpp index 670ce4f2a5d..ad2c23bebae 100644 --- a/src/mame/audio/jaguar.cpp +++ b/src/mame/audio/jaguar.cpp @@ -356,7 +356,7 @@ void jaguar_state::serial_w(offs_t offset, uint32_t data) if ((data & 0x3f) == 0x15) { attotime rate = attotime::from_hz(m_dsp->clock()) * (32 * 2 * (m_serial_frequency + 1)); - m_serial_timer->adjust(rate, 0, rate); + m_serial_timer->adjust_periodic(rate); } break; diff --git a/src/mame/audio/namco52.cpp b/src/mame/audio/namco52.cpp index 4606de58bc0..045098dd604 100644 --- a/src/mame/audio/namco52.cpp +++ b/src/mame/audio/namco52.cpp @@ -168,7 +168,7 @@ void namco_52xx_device::device_start() if (!m_extclock.is_zero()) { m_extclock_pulse_timer = timer_alloc(*this, FUNC(namco_52xx_device::external_clock_pulse)); - m_extclock_pulse_timer->adjust(attotime(m_extclock), 0, attotime(m_extclock)); + m_extclock_pulse_timer->adjust_periodic(attotime(m_extclock)); } save_item(NAME(m_latched_cmd)); diff --git a/src/mame/audio/rax.cpp b/src/mame/audio/rax.cpp index cdcf124456d..780fd15fa34 100644 --- a/src/mame/audio/rax.cpp +++ b/src/mame/audio/rax.cpp @@ -175,7 +175,7 @@ void acclaim_rax_device::adsp_control_w(offs_t offset, uint16_t data) attotime word_period = attotime::from_hz(m_cpu->unscaled_clock()); attotime period = word_period * (data & 0x3fff) * 1; - m_dma_timer->adjust(period, src_addr, period); + m_dma_timer.adjust_periodic(period, src_addr); break; } @@ -193,7 +193,7 @@ void acclaim_rax_device::adsp_control_w(offs_t offset, uint16_t data) if ((data & 0x0002) == 0) { m_dmadac[0]->enable(0); - m_reg_timer->reset(); + m_reg_timer.reset(); } break; @@ -216,7 +216,7 @@ void acclaim_rax_device::adsp_control_w(offs_t offset, uint16_t data) } -TIMER_DEVICE_CALLBACK_MEMBER( acclaim_rax_device::dma_timer_callback ) +void acclaim_rax_device::dma_timer_callback(int param) { /* Update external address count and page */ m_control_regs[BDMA_WORD_COUNT_REG] = 0; @@ -229,7 +229,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( acclaim_rax_device::dma_timer_callback ) else m_cpu->pulse_input_line(ADSP2181_BDMA, m_cpu->minimum_quantum()); - m_dma_timer->adjust(attotime::never); + m_dma_timer.adjust(attotime::never); } @@ -297,6 +297,9 @@ void acclaim_rax_device::adsp_io_map(address_map &map) void acclaim_rax_device::device_start() { + m_reg_timer.init(*this, FUNC(acclaim_rax_device::adsp_irq0)); + m_dma_timer.init(*this, FUNC(acclaim_rax_device::dma_timer_callback)); + m_program = &m_cpu->space(AS_PROGRAM); m_data = &m_cpu->space(AS_DATA); @@ -371,7 +374,7 @@ void acclaim_rax_device::adsp_irq(int which) m_cpu->set_state_int(ADSP2100_I0 + m_ireg[which], reg); } -TIMER_DEVICE_CALLBACK_MEMBER( acclaim_rax_device::adsp_irq0 ) +void acclaim_rax_device::adsp_irq0() { adsp_irq(0); } @@ -395,10 +398,7 @@ void acclaim_rax_device::recompute_sample_rate(int which) /* fire off a timer which will hit every half-buffer */ if (m_incs[which]) - { - attotime period = (sample_period * m_size[which]) / (4 * 2 * m_incs[which]); - m_reg_timer->adjust(period, 0, period); - } + m_reg_timer.adjust_periodic((sample_period * m_size[which]) / (4 * 2 * m_incs[which])); } void acclaim_rax_device::adsp_sound_tx_callback(offs_t offset, uint32_t data) @@ -453,7 +453,7 @@ void acclaim_rax_device::adsp_sound_tx_callback(offs_t offset, uint32_t data) dmadac->enable(0); /* remove timer */ - m_reg_timer->reset(); + m_reg_timer.reset(); } void acclaim_rax_device::dmovlay_callback(uint32_t data) @@ -480,8 +480,6 @@ acclaim_rax_device::acclaim_rax_device(const machine_config &mconfig, const char : device_t(mconfig, ACCLAIM_RAX, tag, owner, clock) , m_cpu(*this, "adsp") , m_dmadac(*this, { "dacl", "dacr" }) - , m_reg_timer(*this, "adsp_reg_timer") - , m_dma_timer(*this, "adsp_dma_timer") , m_adsp_pram(*this, "adsp_pram") , m_adsp_data_bank(*this, "databank") , m_rom(*this, DEVICE_SELF) @@ -504,9 +502,6 @@ void acclaim_rax_device::device_add_mconfig(machine_config &config) m_cpu->set_addrmap(AS_DATA, &acclaim_rax_device::adsp_data_map); m_cpu->set_addrmap(AS_IO, &acclaim_rax_device::adsp_io_map); - TIMER(config, "adsp_reg_timer").configure_generic(FUNC(acclaim_rax_device::adsp_irq0)); - TIMER(config, "adsp_dma_timer").configure_generic(FUNC(acclaim_rax_device::dma_timer_callback)); - GENERIC_LATCH_16(config, m_data_in); GENERIC_LATCH_16(config, m_data_out); diff --git a/src/mame/audio/rax.h b/src/mame/audio/rax.h index 957fa923b9e..9870c49c576 100644 --- a/src/mame/audio/rax.h +++ b/src/mame/audio/rax.h @@ -12,7 +12,6 @@ #include "cpu/adsp2100/adsp2100.h" #include "machine/gen_latch.h" -#include "machine/timer.h" #include "sound/dmadac.h" @@ -29,7 +28,7 @@ public: void adsp_irq(int which); void recompute_sample_rate(int which); - TIMER_DEVICE_CALLBACK_MEMBER( dma_timer_callback ); + void dma_timer_callback(int param); void adsp_data_map(address_map &map); void adsp_io_map(address_map &map); @@ -43,13 +42,13 @@ protected: private: required_device<adsp2181_device> m_cpu; required_device_array<dmadac_sound_device, 2> m_dmadac; - required_device<timer_device> m_reg_timer; - required_device<timer_device> m_dma_timer; required_shared_ptr<uint32_t> m_adsp_pram; required_memory_bank m_adsp_data_bank; required_region_ptr<uint8_t> m_rom; uint32_t m_adsp_snd_pf0; + persistent_timer m_reg_timer; + persistent_timer m_dma_timer; struct { @@ -82,8 +81,8 @@ private: void adsp_sound_tx_callback(offs_t offset, uint32_t data); - TIMER_DEVICE_CALLBACK_MEMBER(adsp_irq0); - TIMER_DEVICE_CALLBACK_MEMBER(sport0_irq); + void adsp_irq0(); + void sport0_irq(int param); void dmovlay_callback(uint32_t data); uint16_t adsp_control_r(offs_t offset); diff --git a/src/mame/audio/redalert.cpp b/src/mame/audio/redalert.cpp index edcf0eba567..abfae15edde 100644 --- a/src/mame/audio/redalert.cpp +++ b/src/mame/audio/redalert.cpp @@ -222,7 +222,7 @@ void irem_m37b_audio_device::device_start() m_audio_irq_on_timer = timer_alloc(*this, FUNC(irem_m37b_audio_device::audio_irq_on)); m_audio_irq_off_timer = timer_alloc(*this, FUNC(irem_m37b_audio_device::audio_irq_off)); - m_audio_irq_on_timer->adjust(REDALERT_AUDIO_CPU_IRQ_FREQ, 0, REDALERT_AUDIO_CPU_IRQ_FREQ); + m_audio_irq_on_timer->adjust_periodic(REDALERT_AUDIO_CPU_IRQ_FREQ); save_item(NAME(m_sound_hs)); save_item(NAME(m_ay8910_latch_1)); @@ -321,7 +321,7 @@ void demoneye_audio_device::device_start() m_audio_irq_on_timer = timer_alloc(*this, FUNC(demoneye_audio_device::audio_irq_on)); m_audio_irq_off_timer = timer_alloc(*this, FUNC(demoneye_audio_device::audio_irq_off)); - m_audio_irq_on_timer->adjust(REDALERT_AUDIO_CPU_IRQ_FREQ, 0, REDALERT_AUDIO_CPU_IRQ_FREQ); + m_audio_irq_on_timer->adjust_periodic(REDALERT_AUDIO_CPU_IRQ_FREQ); save_item(NAME(m_ay8910_latch_1)); save_item(NAME(m_ay8910_latch_2)); diff --git a/src/mame/audio/segag80r.cpp b/src/mame/audio/segag80r.cpp index 83c9aef0074..0cdc239fa79 100644 --- a/src/mame/audio/segag80r.cpp +++ b/src/mame/audio/segag80r.cpp @@ -234,7 +234,7 @@ inline void segag80r_state::sega005_update_sound_data() if ((diff & 0x20) && (newval & 0x20)) { //osd_printf_debug("Starting timer\n"); - m_005snd->m_sega005_sound_timer->adjust(attotime::from_hz(SEGA005_555_TIMER_FREQ), 0, attotime::from_hz(SEGA005_555_TIMER_FREQ)); + m_005snd->m_sega005_sound_timer->adjust_periodic(attotime::from_hz(SEGA005_555_TIMER_FREQ)); } } diff --git a/src/mame/audio/sente6vb.cpp b/src/mame/audio/sente6vb.cpp index de06af02feb..0c674a448e8 100644 --- a/src/mame/audio/sente6vb.cpp +++ b/src/mame/audio/sente6vb.cpp @@ -116,8 +116,6 @@ void sente6vb_device::device_add_mconfig(machine_config &config) uartclock.signal_handler().append(m_uart, FUNC(acia6850_device::write_txc)); uartclock.signal_handler().append(m_uart, FUNC(acia6850_device::write_rxc)); - TIMER(config, m_counter_0_timer, 0).configure_generic(FUNC(sente6vb_device::clock_counter_0_ff)); - PIT8253(config, m_pit, 0); m_pit->out_handler<0>().set(FUNC(sente6vb_device::counter_0_set_out)); m_pit->out_handler<2>().set_inputline(m_audiocpu, INPUT_LINE_IRQ0); @@ -168,7 +166,6 @@ const tiny_rom_entry *sente6vb_device::device_rom_region() const sente6vb_device::sente6vb_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, SENTE6VB, tag, owner, clock), m_pit(*this, "pit"), - m_counter_0_timer(*this, "8253_0_timer"), m_cem_device(*this, "cem%u", 1U), m_audiocpu(*this, "audiocpu"), m_uart(*this, "uart"), @@ -185,6 +182,8 @@ void sente6vb_device::device_start() m_uart->write_cts(0); m_uart->write_dcd(0); + m_counter_0_timer.init(*this, FUNC(sente6vb_device::clock_counter_0_ff)); + save_item(NAME(m_counter_control)); save_item(NAME(m_counter_0_ff)); save_item(NAME(m_counter_0_out)); @@ -263,7 +262,7 @@ WRITE_LINE_MEMBER(sente6vb_device::set_counter_0_ff) } -TIMER_DEVICE_CALLBACK_MEMBER(sente6vb_device::clock_counter_0_ff) +void sente6vb_device::clock_counter_0_ff() { // clock the D value through the flip-flop set_counter_0_ff(BIT(m_counter_control, 3)); @@ -277,7 +276,7 @@ void sente6vb_device::update_counter_0_timer() // if there's already a timer, remove it if (m_counter_0_timer_active) - m_counter_0_timer->reset(); + m_counter_0_timer.reset(); m_counter_0_timer_active = false; // find the counter with the maximum frequency @@ -302,7 +301,7 @@ void sente6vb_device::update_counter_0_timer() if (maxfreq > 0.0) { m_counter_0_timer_active = true; - m_counter_0_timer->adjust(attotime::from_hz(maxfreq), 0, attotime::from_hz(maxfreq)); + m_counter_0_timer.adjust_periodic(attotime::from_hz(maxfreq)); } } @@ -352,7 +351,7 @@ void sente6vb_device::counter_control_w(uint8_t data) // if we gate off, remove the timer else if (!BIT(data, 1) && m_counter_0_timer_active) { - m_counter_0_timer->reset(); + m_counter_0_timer.reset(); m_counter_0_timer_active = false; } } diff --git a/src/mame/audio/sente6vb.h b/src/mame/audio/sente6vb.h index ee199817360..cdaa2cc2774 100644 --- a/src/mame/audio/sente6vb.h +++ b/src/mame/audio/sente6vb.h @@ -13,7 +13,6 @@ #include "machine/6850acia.h" #include "machine/pit8253.h" -#include "machine/timer.h" #include "sound/cem3394.h" @@ -49,14 +48,13 @@ private: DECLARE_WRITE_LINE_MEMBER(counter_0_set_out); void update_counter_0_timer(); - TIMER_DEVICE_CALLBACK_MEMBER(clock_counter_0_ff); + void clock_counter_0_ff(); DECLARE_WRITE_LINE_MEMBER(set_counter_0_ff); void mem_map(address_map &map); void io_map(address_map &map); required_device<pit8253_device> m_pit; - required_device<timer_device> m_counter_0_timer; required_device_array<cem3394_device, 6> m_cem_device; required_device<cpu_device> m_audiocpu; required_device<acia6850_device> m_uart; @@ -77,6 +75,8 @@ private: // sound CPU 6850 states bool m_uint; + + persistent_timer m_counter_0_timer; }; DECLARE_DEVICE_TYPE(SENTE6VB, sente6vb_device) diff --git a/src/mame/audio/tvc.cpp b/src/mame/audio/tvc.cpp index a2288f3de4e..aeb4d60871b 100644 --- a/src/mame/audio/tvc.cpp +++ b/src/mame/audio/tvc.cpp @@ -110,7 +110,7 @@ void tvc_sound_device::write(offs_t offset, uint8_t data) m_freq = (pitch == 0x0fff) ? 0 : (int)(195312.5 / (4096 - pitch)); if ((m_ports[1] & 0x20) && m_freq != 0) - m_sndint_timer->adjust(attotime::from_hz(m_freq), 0, attotime::from_hz(m_freq)); + m_sndint_timer->adjust_periodic(attotime::from_hz(m_freq)); else m_sndint_timer->reset(); @@ -136,7 +136,7 @@ void tvc_sound_device::reset_divider() m_signal = 1; if (m_ports[1] & 0x20 && m_freq != 0) - m_sndint_timer->adjust(attotime::from_hz(m_freq), 0, attotime::from_hz(m_freq)); + m_sndint_timer->adjust_periodic(attotime::from_hz(m_freq)); else m_sndint_timer->reset(); } diff --git a/src/mame/audio/warpwarp.cpp b/src/mame/audio/warpwarp.cpp index a32944c6a48..49f7d2027ef 100644 --- a/src/mame/audio/warpwarp.cpp +++ b/src/mame/audio/warpwarp.cpp @@ -110,7 +110,7 @@ void warpwarp_sound_device::sound_w(u8 data) * 0.639 * 15k * 1uF -> 0.9585s */ attotime period = attotime::from_hz(32768) * 95850 / 100000; - m_sound_volume_timer->adjust(period, 0, period); + m_sound_volume_timer->adjust_periodic(period); } else { @@ -123,7 +123,7 @@ void warpwarp_sound_device::sound_w(u8 data) */ //attotime period = attotime::from_hz(32768) * 702900 / 100000; attotime period = attotime::from_hz(32768) * 191700 / 100000; - m_sound_volume_timer->adjust(period, 0, period); + m_sound_volume_timer->adjust_periodic(period); } } @@ -152,7 +152,7 @@ void warpwarp_sound_device::music2_w(u8 data) * ...I'm sure this is off by one number of magnitude :/ */ attotime period = attotime::from_hz(32768) * 95850 / 100000; - m_music_volume_timer->adjust(period, 0, period); + m_music_volume_timer->adjust_periodic(period); } else { @@ -163,7 +163,7 @@ void warpwarp_sound_device::music2_w(u8 data) */ //attotime period = attotime::from_hz(32768) * 3003300 / 100000; attotime period = attotime::from_hz(32768) * 300330 / 100000; - m_music_volume_timer->adjust(period, 0, period); + m_music_volume_timer->adjust_periodic(period); } } diff --git a/src/mame/audio/xavix.cpp b/src/mame/audio/xavix.cpp index ab5b2387a86..bdc5e6b970d 100644 --- a/src/mame/audio/xavix.cpp +++ b/src/mame/audio/xavix.cpp @@ -497,7 +497,7 @@ void xavix_state::sound_irqstatus_w(uint8_t data) the usual clock divided by 2 would be 10.738636 but that's too high */ attotime period = attotime::from_hz(10.3f * (m_sndtimer[t])); - m_sound_timer[t]->adjust(period, t, period); + m_sound_timer[t]->adjust_periodic(period, t); } else { diff --git a/src/mame/drivers/abc80.cpp b/src/mame/drivers/abc80.cpp index 3d728cfbf60..8add3a48cd3 100644 --- a/src/mame/drivers/abc80.cpp +++ b/src/mame/drivers/abc80.cpp @@ -442,7 +442,7 @@ void abc80_state::machine_start() { // start timers m_cassette_timer = timer_alloc(TIMER_ID_CASSETTE); - m_cassette_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); + m_cassette_timer->adjust_periodic(attotime::from_hz(44100)); // register for state saving save_item(NAME(m_key_data)); diff --git a/src/mame/drivers/alto2.cpp b/src/mame/drivers/alto2.cpp index af81aec88a6..f8944391035 100644 --- a/src/mame/drivers/alto2.cpp +++ b/src/mame/drivers/alto2.cpp @@ -303,7 +303,7 @@ void alto2_state::init_alto2() { // Create a timer which fires twice per frame, once for each field m_vblank_timer = timer_alloc(TIMER_VBLANK); - m_vblank_timer->adjust(attotime::from_hz(2*30),0,attotime::from_hz(30*2)); + m_vblank_timer->adjust_periodic(attotime::from_hz(2*30)); } void alto2_state::device_timer(timer_instance const &timer) diff --git a/src/mame/drivers/apexc.cpp b/src/mame/drivers/apexc.cpp index 05a47d1b80b..c874e02a813 100644 --- a/src/mame/drivers/apexc.cpp +++ b/src/mame/drivers/apexc.cpp @@ -18,7 +18,7 @@ void apexc_state::machine_start() teletyper_init(); m_input_timer = timer_alloc(TIMER_POLL_INPUTS); - m_input_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); + m_input_timer->adjust_periodic(attotime::from_hz(60)); m_panel_data_reg = 0; } diff --git a/src/mame/drivers/aristmk4.cpp b/src/mame/drivers/aristmk4.cpp index b3f0f18acf0..7d9c665e5be 100644 --- a/src/mame/drivers/aristmk4.cpp +++ b/src/mame/drivers/aristmk4.cpp @@ -1750,7 +1750,7 @@ void aristmk4_state::machine_reset() break; } - m_power_timer->adjust(attotime::from_hz(1), 0, attotime::from_hz(1)); + m_power_timer->adjust_periodic(attotime::from_hz(1)); } void aristmk4_state::device_timer(timer_instance const &timer) diff --git a/src/mame/drivers/aristmk5.cpp b/src/mame/drivers/aristmk5.cpp index bd1a0fe3a88..482cdde813f 100644 --- a/src/mame/drivers/aristmk5.cpp +++ b/src/mame/drivers/aristmk5.cpp @@ -856,7 +856,7 @@ void aristmk5_state::spi_data_w(uint8_t data) m_spi_bits = 0; // start the SPI clock - m_spi_timer->adjust(attotime::from_hz(MASTER_CLOCK / 9 / 512 / 2), 0, attotime::from_hz(MASTER_CLOCK / 9 / 512 / 2)); + m_spi_timer->adjust_periodic(attotime::from_hz(MASTER_CLOCK / 9 / 512 / 2)); } uint8_t aristmk5_state::spi_data_r() diff --git a/src/mame/drivers/atlantis.cpp b/src/mame/drivers/atlantis.cpp index f9c4078bebd..68cb1ace9f2 100644 --- a/src/mame/drivers/atlantis.cpp +++ b/src/mame/drivers/atlantis.cpp @@ -54,6 +54,7 @@ #include "machine/timekpr.h" #include "coreutil.h" #include "emupal.h" +#include "screen.h" namespace { diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp index f0af8284df0..914c98cf402 100644 --- a/src/mame/drivers/cave.cpp +++ b/src/mame/drivers/cave.cpp @@ -2620,7 +2620,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( cave_state::sailormn_startup ) MACHINE_RESET_MEMBER(cave_state,sailormn) { machine_reset(); - m_startup->adjust(attotime::from_usec(1000), 0, attotime::zero); + m_startup->adjust(attotime::from_usec(1000), 0); } void cave_state::sailormn(machine_config &config) diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp index ff4018875ba..bd397af0cef 100644 --- a/src/mame/drivers/cbm2.cpp +++ b/src/mame/drivers/cbm2.cpp @@ -2066,7 +2066,7 @@ MACHINE_START_MEMBER( cbm2_state, cbm2 ) int todclk = (m_ntsc ? 60 : 50) * 2; m_todclk_timer = timer_alloc(); - m_todclk_timer->adjust(attotime::from_hz(todclk), 0, attotime::from_hz(todclk)); + m_todclk_timer->adjust_periodic(attotime::from_hz(todclk)); // state saving save_item(NAME(m_dramon)); diff --git a/src/mame/drivers/chexx.cpp b/src/mame/drivers/chexx.cpp index ad62310fd3b..56286220493 100644 --- a/src/mame/drivers/chexx.cpp +++ b/src/mame/drivers/chexx.cpp @@ -393,7 +393,7 @@ void chexx_state::machine_reset() { m_bank = -1; digitalker_set_bank(0); - m_update_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); + m_update_timer->adjust_periodic(attotime::from_hz(60)); } void chexx_state::update() diff --git a/src/mame/drivers/clickstart.cpp b/src/mame/drivers/clickstart.cpp index 9635c3fed33..cd6fec2dadb 100644 --- a/src/mame/drivers/clickstart.cpp +++ b/src/mame/drivers/clickstart.cpp @@ -190,7 +190,7 @@ void clickstart_state::machine_reset() m_uart_tx_fifo_start = 0; m_uart_tx_fifo_end = 0; m_uart_tx_fifo_count = 0; - m_uart_tx_timer->adjust(attotime::from_hz(3200/10), 0, attotime::from_hz(3200/10)); + m_uart_tx_timer->adjust_periodic(attotime::from_hz(3200/10)); m_unk_portc_toggle = 0; } diff --git a/src/mame/drivers/cops.cpp b/src/mame/drivers/cops.cpp index 8309d1f0eaa..521c78d77e2 100644 --- a/src/mame/drivers/cops.cpp +++ b/src/mame/drivers/cops.cpp @@ -482,7 +482,7 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) } if (LOG_DACIA) logerror("DACIA TIME %02d\n", (XTAL(3'686'400) / m_dacia_ic_div_1).value()); -// m_ld_timer->adjust(attotime::from_hz(XTAL(3'686'400) / m_dacia_ic_div_1), 0, attotime::from_hz(XTAL(3'686'400) / m_dacia_ic_div_1)); +// m_ld_timer->adjust_periodic(attotime::from_hz(XTAL(3'686'400) / m_dacia_ic_div_1)); if (LOG_DACIA) logerror("DACIA Ctrl Register: %02x\n", data); @@ -547,7 +547,7 @@ void cops_state::dacia_w(offs_t offset, uint8_t data) } if (LOG_DACIA) logerror("DACIA TIME 2 %02d\n", (XTAL(3'686'400) / m_dacia_ic_div_1).value()); - m_ld_timer->adjust(attotime::from_hz(XTAL(3'686'400) / m_dacia_ic_div_2), 0, attotime::from_hz(XTAL(3'686'400) / m_dacia_ic_div_2)); + m_ld_timer->adjust_periodic(attotime::from_hz(XTAL(3'686'400) / m_dacia_ic_div_2)); if (LOG_DACIA) logerror("DACIA Ctrl Register 2: %02x\n", data); @@ -877,7 +877,7 @@ void cops_state::machine_start() m_digits.resolve(); m_ld_timer = timer_alloc(*this, FUNC(cops_state::ld_timer_callback)); - m_ld_timer->adjust(attotime::from_hz(167*5), 0, attotime::from_hz(167*5)); + m_ld_timer->adjust_periodic(attotime::from_hz(167*5)); m_dacia_cmpval1 = m_dacia_cmpval2 = 0; m_ld_command_current_byte = 0; diff --git a/src/mame/drivers/cps2.cpp b/src/mame/drivers/cps2.cpp index a9ace2c6b90..2d3a26a3204 100644 --- a/src/mame/drivers/cps2.cpp +++ b/src/mame/drivers/cps2.cpp @@ -10170,7 +10170,7 @@ void cps2_state::init_digital_volume() // create a timer to update our volume state from the fake switches - read it every 6 frames or so to enable some granularity m_digital_volume_timer = timer_alloc(*this, FUNC(cps2_state::cps2_update_digital_volume)); - m_digital_volume_timer->adjust(attotime::from_msec(100), 0, attotime::from_msec(100)); + m_digital_volume_timer->adjust_periodic(attotime::from_msec(100)); } @@ -10225,7 +10225,7 @@ void cps2_state::init_singbrd() // The single board games don't have a digital volume switch m_cps2disabledigitalvolume = 1; - m_digital_volume_timer->adjust(attotime::never, 0, attotime::never); + m_digital_volume_timer->adjust(attotime::never); } uint16_t cps2_state::gigaman2_dummyqsound_r(offs_t offset) @@ -10269,7 +10269,7 @@ void cps2_state::init_gigaman2() memcpy(m_decrypted_opcodes, memregion("maincpu")->base()+0x200000, 0x200000); // No digital volume switches on this? - m_digital_volume_timer->adjust(attotime::never, 0, attotime::never); + m_digital_volume_timer->adjust(attotime::never); } void cps2_state::init_ecofghtr() diff --git a/src/mame/drivers/cvs.cpp b/src/mame/drivers/cvs.cpp index 2b73edd8905..53aa453cc6d 100644 --- a/src/mame/drivers/cvs.cpp +++ b/src/mame/drivers/cvs.cpp @@ -297,7 +297,7 @@ TIMER_CALLBACK_MEMBER(cvs_state::cvs_393hz_timer_cb) void cvs_state::start_393hz_timer() { m_cvs_393hz_timer = timer_alloc(*this, FUNC(cvs_state::cvs_393hz_timer_cb)); - m_cvs_393hz_timer->adjust(attotime::from_hz(30*393), 0, attotime::from_hz(30*393)); + m_cvs_393hz_timer->adjust_periodic(attotime::from_hz(30*393)); } diff --git a/src/mame/drivers/dpb7000.cpp b/src/mame/drivers/dpb7000.cpp index be36cdc138c..72f36df16dd 100644 --- a/src/mame/drivers/dpb7000.cpp +++ b/src/mame/drivers/dpb7000.cpp @@ -930,7 +930,7 @@ void dpb7000_state::machine_reset() m_acia[i]->write_dcd(0); } - m_field_in_clk->adjust(attotime::from_hz(59.94), 0, attotime::from_hz(59.94)); + m_field_in_clk->adjust_periodic(attotime::from_hz(59.94)); m_field_out_clk->adjust(attotime::from_hz(59.94) + attotime::from_hz(15734.0 / 1.0), 0, attotime::from_hz(59.94)); // Disc Sequencer Card @@ -1055,7 +1055,7 @@ void dpb7000_state::machine_reset() m_tablet_mux = 0; m_tablet_drq = 0; m_tablet_counter_latch = 0; - m_tablet_tx_timer->adjust(attotime::from_hz(9600), 0, attotime::from_hz(9600)); + m_tablet_tx_timer->adjust_periodic(attotime::from_hz(9600)); m_tablet_irq_timer->adjust(attotime::never); m_tablet_tx_bit = 1; m_tablet_pen_in_proximity = false; @@ -2277,7 +2277,7 @@ void dpb7000_state::tds_p1_w(uint8_t data) if (BIT(old & ~data, 0)) { m_tds_duart->reset(); - m_tablet_tx_timer->adjust(attotime::from_hz(9600), 0, attotime::from_hz(9600)); + m_tablet_tx_timer->adjust_periodic(attotime::from_hz(9600)); } } diff --git a/src/mame/drivers/dvk_kcgd.cpp b/src/mame/drivers/dvk_kcgd.cpp index 87991cee797..7bf9fadc753 100644 --- a/src/mame/drivers/dvk_kcgd.cpp +++ b/src/mame/drivers/dvk_kcgd.cpp @@ -175,7 +175,7 @@ void kcgd_state::video_start() m_vsync_off_timer->adjust(m_screen->time_until_pos(16, 0), 0, m_screen->frame_period()); */ m_500hz_timer = timer_alloc(TIMER_ID_500HZ); - m_500hz_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500)); + m_500hz_timer->adjust_periodic(attotime::from_hz(500)); } void kcgd_state::kcgd_palette(palette_device &palette) const diff --git a/src/mame/drivers/dvk_ksm.cpp b/src/mame/drivers/dvk_ksm.cpp index 5afe8a23ee8..8361213308c 100644 --- a/src/mame/drivers/dvk_ksm.cpp +++ b/src/mame/drivers/dvk_ksm.cpp @@ -289,27 +289,27 @@ void ksm_state::update_brg(bool a, bool b, int c) switch ((a << 3) + (b << 2) + c) { case 0xa: - m_brg->adjust(attotime::from_hz(9600*16*2), 0, attotime::from_hz(9600*16*2)); + m_brg->adjust_periodic(attotime::from_hz(9600*16*2)); break; case 0x8: - m_brg->adjust(attotime::from_hz(4800*16*2), 0, attotime::from_hz(4800*16*2)); + m_brg->adjust_periodic(attotime::from_hz(4800*16*2)); break; case 0x4: - m_brg->adjust(attotime::from_hz(2400*16*2), 0, attotime::from_hz(2400*16*2)); + m_brg->adjust_periodic(attotime::from_hz(2400*16*2)); break; case 0x5: - m_brg->adjust(attotime::from_hz(1200*16*2), 0, attotime::from_hz(1200*16*2)); + m_brg->adjust_periodic(attotime::from_hz(1200*16*2)); break; case 0x6: - m_brg->adjust(attotime::from_hz(600*16*2), 0, attotime::from_hz(600*16*2)); + m_brg->adjust_periodic(attotime::from_hz(600*16*2)); break; case 0x7: - m_brg->adjust(attotime::from_hz(300*16*2), 0, attotime::from_hz(300*16*2)); + m_brg->adjust_periodic(attotime::from_hz(300*16*2)); break; } } diff --git a/src/mame/drivers/eurocom2.cpp b/src/mame/drivers/eurocom2.cpp index 2bd8e3ba710..4e470f16198 100644 --- a/src/mame/drivers/eurocom2.cpp +++ b/src/mame/drivers/eurocom2.cpp @@ -411,9 +411,9 @@ void eurocom2_state::machine_reset() m_floppy = nullptr; if (ioport("S1")->read() & 0x80) - m_sst->adjust(attotime::from_usec(12200), 0, attotime::from_usec(12200)); + m_sst->adjust_periodic(attotime::from_usec(12200)); else - m_sst->adjust(attotime::never, 0, attotime::never); + m_sst->adjust(attotime::never); } void eurocom2_state::machine_start() diff --git a/src/mame/drivers/exterm.cpp b/src/mame/drivers/exterm.cpp index c037bcdbe69..d286089b648 100644 --- a/src/mame/drivers/exterm.cpp +++ b/src/mame/drivers/exterm.cpp @@ -76,6 +76,8 @@ void exterm_state::machine_start() { + m_nmi_timer.init(*this, FUNC(exterm_state::master_sound_nmi_callback)); + save_item(NAME(m_aimpos)); save_item(NAME(m_trackball_old)); save_item(NAME(m_sound_control)); @@ -185,7 +187,7 @@ void exterm_state::sound_latch_w(uint8_t data) * *************************************/ -TIMER_DEVICE_CALLBACK_MEMBER(exterm_state::master_sound_nmi_callback) +void exterm_state::master_sound_nmi_callback() { /* bit 0 of the sound control determines if the NMI is actually delivered */ if (m_sound_control & 0x01) @@ -206,7 +208,7 @@ void exterm_state::sound_nmi_rate_w(uint8_t data) /* this value is latched into up-counters, which are clocked at the */ /* input clock / 256 */ attotime nmi_rate = attotime::from_hz(4000000) * (4096 * (256 - data)); - m_nmi_timer->adjust(nmi_rate, 0, nmi_rate); + m_nmi_timer.adjust_periodic(nmi_rate); } @@ -398,8 +400,6 @@ void exterm_state::exterm(machine_config &config) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); - TIMER(config, m_nmi_timer).configure_generic(FUNC(exterm_state::master_sound_nmi_callback)); - WATCHDOG_TIMER(config, "watchdog"); /* video hardware */ diff --git a/src/mame/drivers/famibox.cpp b/src/mame/drivers/famibox.cpp index 1c104c2a33e..0692c23aeec 100644 --- a/src/mame/drivers/famibox.cpp +++ b/src/mame/drivers/famibox.cpp @@ -280,7 +280,7 @@ void famibox_state::famicombox_reset() TIMER_CALLBACK_MEMBER(famibox_state::famicombox_attract_timer_callback) { - m_attract_timer->adjust(attotime::never, 0, attotime::never); + m_attract_timer->adjust(attotime::never); if ( BIT(m_exception_mask,1) ) { m_exception_cause &= ~0x02; @@ -295,7 +295,7 @@ TIMER_CALLBACK_MEMBER(famibox_state::famicombox_gameplay_timer_callback) if (m_coins == 0) { - m_gameplay_timer->adjust(attotime::never, 0, attotime::never); + m_gameplay_timer->adjust(attotime::never); if ( BIT(m_exception_mask,4) ) { m_exception_cause &= ~0x10; @@ -344,7 +344,7 @@ void famibox_state::famibox_system_w(offs_t offset, uint8_t data) { if (m_attract_timer->start() != attotime::never) { - m_attract_timer->adjust(attotime::from_seconds((int32_t)((double)1.0/6.8274*m_attract_timer_period)), 0, attotime::never); + m_attract_timer->adjust(attotime::from_seconds((int32_t)((double)1.0/6.8274*m_attract_timer_period))); } } break; @@ -360,7 +360,7 @@ void famibox_state::famibox_system_w(offs_t offset, uint8_t data) m_attract_timer_period = data; if ( BIT(m_exception_mask,1) && ( data != 0 ) ) { - m_attract_timer->adjust(attotime::from_hz(6.8274/m_attract_timer_period), 0, attotime::never); + m_attract_timer->adjust(attotime::from_hz(6.8274/m_attract_timer_period)); } break; case 4: @@ -421,7 +421,7 @@ INPUT_CHANGED_MEMBER(famibox_state::coin_inserted) m_coins++; if (m_attract_timer->start() != attotime::never) { - m_gameplay_timer->adjust(attotime::from_seconds(60*(m_money_reg == 0x22 ? 20 : 10)), 0, attotime::never); + m_gameplay_timer->adjust(attotime::from_seconds(60*(m_money_reg == 0x22 ? 20 : 10))); } if ( BIT(m_exception_mask,4) && (m_coins == 1) ) diff --git a/src/mame/drivers/firebeat.cpp b/src/mame/drivers/firebeat.cpp index 5e67296ee1c..32271719053 100644 --- a/src/mame/drivers/firebeat.cpp +++ b/src/mame/drivers/firebeat.cpp @@ -1815,7 +1815,7 @@ void firebeat_kbm_state::init_keyboard() { // set keyboard timer // m_keyboard_timer = timer_alloc(*this, FUNC(firebeat_state::keyboard_timer_callback)); -// m_keyboard_timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10)); +// m_keyboard_timer->adjust_periodic(attotime::from_msec(10)); } void firebeat_kbm_state::firebeat_kbm(machine_config &config) diff --git a/src/mame/drivers/fm7.cpp b/src/mame/drivers/fm7.cpp index 896882850e2..bc39bb8d1e4 100644 --- a/src/mame/drivers/fm7.cpp +++ b/src/mame/drivers/fm7.cpp @@ -1785,8 +1785,8 @@ MACHINE_START_MEMBER(fm7_state,fm16) void fm7_state::machine_reset() { - m_timer->adjust(attotime::from_nsec(2034500),0,attotime::from_nsec(2034500)); - m_subtimer->adjust(attotime::from_msec(20),0,attotime::from_msec(20)); + m_timer->adjust_periodic(attotime::from_nsec(2034500)); + m_subtimer->adjust_periodic(attotime::from_msec(20)); m_keyboard_timer->adjust(attotime::zero,0,attotime::from_msec(10)); m_irq_mask = 0x00; diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp index 3ebb70ebe83..d729ea014aa 100644 --- a/src/mame/drivers/fmtowns.cpp +++ b/src/mame/drivers/fmtowns.cpp @@ -494,7 +494,7 @@ void towns_state::towns_sys6c_w(uint8_t data) { // halts the CPU for 1 microsecond m_maincpu->set_input_line(INPUT_LINE_HALT,ASSERT_LINE); - m_towns_wait_timer->adjust(attotime::from_usec(1),0,attotime::never); + m_towns_wait_timer->adjust(attotime::from_usec(1)); } template<int Chip> @@ -1145,7 +1145,7 @@ void towns_state::towns_pad_mask_w(uint8_t data) } else m_towns_mouse_output++; - m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); + m_towns_mouse_timer->adjust(attotime::from_usec(600)); } if((m_towns_pad_mask & 0x10) == 0 && (m_prev_pad_mask & 0x10) != 0) { @@ -1161,7 +1161,7 @@ void towns_state::towns_pad_mask_w(uint8_t data) } else m_towns_mouse_output++; - m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); + m_towns_mouse_timer->adjust(attotime::from_usec(600)); } m_prev_pad_mask = m_towns_pad_mask; } @@ -1181,7 +1181,7 @@ void towns_state::towns_pad_mask_w(uint8_t data) } else m_towns_mouse_output++; - m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); + m_towns_mouse_timer->adjust(attotime::from_usec(600)); } if((m_towns_pad_mask & 0x20) == 0 && (m_prev_pad_mask & 0x20) != 0) { @@ -1197,7 +1197,7 @@ void towns_state::towns_pad_mask_w(uint8_t data) } else m_towns_mouse_output++; - m_towns_mouse_timer->adjust(attotime::from_usec(600),0,attotime::zero); + m_towns_mouse_timer->adjust(attotime::from_usec(600)); } m_prev_pad_mask = m_towns_pad_mask; } @@ -1436,7 +1436,7 @@ void towns_state::towns_cd_set_status(uint8_t st0, uint8_t st1, uint8_t st2, uin m_towns_cd.cmd_status[2] = st2; m_towns_cd.cmd_status[3] = st3; // wait a bit - m_towns_status_timer->adjust(attotime::from_msec(1),0,attotime::never); + m_towns_status_timer->adjust(attotime::from_msec(1)); } uint8_t towns_state::towns_cd_get_track() @@ -1675,7 +1675,7 @@ void towns_state::towns_cdrom_execute_command(cdrom_image_device* device) case 0x04: // Play Audio Track if(LOG_CD) logerror("CD: Command 0x04: PLAY CD-DA\n"); m_towns_cdda_timer->set_ptr(device); - m_towns_cdda_timer->adjust(attotime::from_msec(1),0,attotime::never); + m_towns_cdda_timer->adjust(attotime::from_msec(1)); break; case 0x05: // Read TOC if(LOG_CD) logerror("CD: Command 0x05: READ TOC\n"); diff --git a/src/mame/drivers/gaelco3d.cpp b/src/mame/drivers/gaelco3d.cpp index d9ee138a2a1..3ed8699a2ce 100644 --- a/src/mame/drivers/gaelco3d.cpp +++ b/src/mame/drivers/gaelco3d.cpp @@ -176,6 +176,8 @@ WRITE_LINE_MEMBER(gaelco3d_state::ser_irq) void gaelco3d_state::machine_start() { + m_adsp_autobuffer_timer.init(*this, FUNC(gaelco3d_state::adsp_autobuffer_irq)); + // Save state support save_item(NAME(m_sound_status)); save_item(NAME(m_analog_ports)); @@ -491,7 +493,7 @@ void gaelco3d_state::adsp_control_w(offs_t offset, uint16_t data) for (uint8_t i = 0; i < SOUND_CHANNELS; i++) m_dmadac[i]->enable(0); - m_adsp_autobuffer_timer->reset(); + m_adsp_autobuffer_timer.reset(); } break; @@ -502,7 +504,7 @@ void gaelco3d_state::adsp_control_w(offs_t offset, uint16_t data) for (uint8_t i = 0; i < SOUND_CHANNELS; i++) m_dmadac[i]->enable(0); - m_adsp_autobuffer_timer->reset(); + m_adsp_autobuffer_timer.reset(); } break; @@ -531,7 +533,7 @@ void gaelco3d_state::adsp_rombank_w(offs_t offset, uint16_t data) * *************************************/ -TIMER_DEVICE_CALLBACK_MEMBER(gaelco3d_state::adsp_autobuffer_irq) +void gaelco3d_state::adsp_autobuffer_irq() { // Get the index register int reg = m_adsp->state_int(ADSP2100_I0 + m_adsp_ireg); @@ -615,7 +617,7 @@ void gaelco3d_state::adsp_tx_callback(offs_t offset, uint32_t data) // Fire off a timer which will hit every half-buffer sample_period = (sample_period * m_adsp_size) / (SOUND_CHANNELS * m_adsp_incs); - m_adsp_autobuffer_timer->adjust(sample_period, 0, sample_period); + m_adsp_autobuffer_timer.adjust_periodic(sample_period); return; } @@ -628,7 +630,7 @@ void gaelco3d_state::adsp_tx_callback(offs_t offset, uint32_t data) m_dmadac[i]->enable(0); // Remove timer - m_adsp_autobuffer_timer->reset(); + m_adsp_autobuffer_timer.reset(); } @@ -930,8 +932,6 @@ void gaelco3d_state::gaelco3d(machine_config &config) config.set_maximum_quantum(attotime::from_hz(6000)); - TIMER(config, "adsp_timer").configure_generic(FUNC(gaelco3d_state::adsp_autobuffer_irq)); - GAELCO_SERIAL(config, m_serial, 0); m_serial->irq_handler().set(FUNC(gaelco3d_state::ser_irq)); diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp index dec7ef54461..1ada652924e 100644 --- a/src/mame/drivers/galaga.cpp +++ b/src/mame/drivers/galaga.cpp @@ -844,6 +844,12 @@ void galaga_state::machine_reset() m_cpu3_interrupt_timer->adjust(m_screen->time_until_pos(64), 64); } +void battles_state::machine_start() +{ + xevious_state::machine_start(); + m_nmi_timer.init(*this, FUNC(battles_state::nmi_generate)); +} + void battles_state::machine_reset() { galaga_state::machine_reset(); @@ -1882,8 +1888,6 @@ void battles_state::battles(machine_config &config) m_screen->screen_vblank().append(FUNC(battles_state::interrupt_4)); - TIMER(config, "nmi").configure_generic(FUNC(battles_state::nmi_generate)); - /* sound hardware */ config.device_remove("discrete"); diff --git a/src/mame/drivers/gba.cpp b/src/mame/drivers/gba.cpp index 1d30d4e4fa5..9ecc4090c65 100644 --- a/src/mame/drivers/gba.cpp +++ b/src/mame/drivers/gba.cpp @@ -411,7 +411,7 @@ TIMER_CALLBACK_MEMBER(gba_state::timer_expire) final = clocksel / rate; m_timer_hz[tmr] = final; time = attotime::from_hz(final); - m_tmr_timer[tmr]->adjust(time, tmr, time); + m_tmr_timer[tmr]->adjust_periodic(time, tmr); } // check if timers 0 or 1 are feeding directsound @@ -1092,7 +1092,7 @@ void gba_state::gba_io_w(offs_t offset, uint32_t data, uint32_t mem_mask) if( !(data & 0x40000) ) // if we're not in Count-Up mode { attotime time = attotime::from_hz(final); - m_tmr_timer[timer]->adjust(time, timer, time); + m_tmr_timer[timer]->adjust_periodic(time, timer); } } } diff --git a/src/mame/drivers/gp32.cpp b/src/mame/drivers/gp32.cpp index 89479172eb6..96126fa7a7e 100644 --- a/src/mame/drivers/gp32.cpp +++ b/src/mame/drivers/gp32.cpp @@ -590,7 +590,7 @@ void gp32_state::s3c240x_pwm_start(int timer) LOGMASKED(LOG_MISC, "PWM %d - FCLK=%d HCLK=%d PCLK=%d prescaler=%d div=%d freq=%f cnt=%d cmp=%d auto_reload=%d hz=%f\n", timer, s3c240x_get_fclk(MPLLCON), s3c240x_get_hclk(MPLLCON), s3c240x_get_pclk(MPLLCON), prescaler, mux_table[mux], freq, cnt, cmp, auto_reload, hz); if (auto_reload) { - m_s3c240x_pwm_timer[timer]->adjust( attotime::from_hz( hz), timer, attotime::from_hz( hz)); + m_s3c240x_pwm_timer[timer]->adjust_periodic( attotime::from_hz( hz), timer); } else { @@ -1458,7 +1458,7 @@ void gp32_state::s3c240x_iis_start() codeclk = BIT( m_s3c240x_iis_regs[1], 2); freq = (double)(s3c240x_get_pclk(MPLLCON) / (prescaler_control_a + 1) / codeclk_table[codeclk]) * 2; // why do I have to multiply by two? LOGMASKED(LOG_MISC, "IIS - pclk %d psc_enable %d psc_a %d psc_b %d codeclk %d freq %f\n", s3c240x_get_pclk(MPLLCON), prescaler_enable, prescaler_control_a, prescaler_control_b, codeclk_table[codeclk], freq); - m_s3c240x_iis_timer->adjust( attotime::from_hz( freq), 0, attotime::from_hz( freq)); + m_s3c240x_iis_timer->adjust_periodic( attotime::from_hz( freq)); } void gp32_state::s3c240x_iis_stop() diff --git a/src/mame/drivers/hh_sm510.cpp b/src/mame/drivers/hh_sm510.cpp index 4493582c212..d13db6ea119 100644 --- a/src/mame/drivers/hh_sm510.cpp +++ b/src/mame/drivers/hh_sm510.cpp @@ -154,7 +154,7 @@ void hh_sm510_state::machine_start() // 1kHz display decay ticks m_display_decay_timer = timer_alloc(*this, FUNC(hh_sm510_state::display_decay_tick)); - m_display_decay_timer->adjust(attotime::from_hz(1024), 0, attotime::from_hz(1024)); + m_display_decay_timer->adjust_periodic(attotime::from_hz(1024)); // zerofill m_inp_mux = 0; diff --git a/src/mame/drivers/hp2640.cpp b/src/mame/drivers/hp2640.cpp index a33f75820b8..c22fe74406b 100644 --- a/src/mame/drivers/hp2640.cpp +++ b/src/mame/drivers/hp2640.cpp @@ -105,11 +105,11 @@ #include "emu.h" #include "screen.h" #include "cpu/i8085/i8085.h" -#include "machine/timer.h" #include "bus/rs232/rs232.h" #include "machine/ay31015.h" #include "machine/clock.h" #include "machine/hp2640_tape.h" +#include "machine/timer.h" #include "sound/beep.h" #include "emupal.h" #include "speaker.h" @@ -195,7 +195,7 @@ protected: IRQ_CALLBACK_MEMBER(irq_callback); void mode_byte_w(uint8_t data); - TIMER_DEVICE_CALLBACK_MEMBER(timer_10ms_exp); + void timer_10ms_exp(); uint8_t kb_r(offs_t offset); void kb_prev_w(uint8_t data); @@ -210,14 +210,14 @@ protected: TIMER_DEVICE_CALLBACK_MEMBER(scanline_timer); void cx_w(uint8_t data); void cy_w(uint8_t data); - TIMER_DEVICE_CALLBACK_MEMBER(timer_cursor_blink_inh); + void timer_cursor_blink_inh(); uint8_t async_status_r(); void async_control_w(uint8_t data); DECLARE_WRITE_LINE_MEMBER(async_dav_w); DECLARE_WRITE_LINE_MEMBER(async_txd_w); - TIMER_DEVICE_CALLBACK_MEMBER(timer_beep_exp); + void timer_beep_exp(); DECLARE_WRITE_LINE_MEMBER(tape_irq_w); @@ -227,7 +227,6 @@ protected: void cpu_io_map(address_map &map); required_device<i8080a_cpu_device> m_cpu; - required_device<timer_device> m_timer_10ms; required_ioport_array<4> m_io_key; required_ioport m_io_comm; required_ioport m_io_sw_ah; @@ -235,14 +234,15 @@ protected: required_ioport m_io_sw_sz; required_device<screen_device> m_screen; required_device<palette_device> m_palette; - required_device<timer_device> m_timer_cursor_blink_inh; required_device<rs232_port_device> m_rs232; required_device<ay51013_device> m_uart; required_device<clock_device> m_uart_clock; required_device<beep_device> m_beep; - required_device<timer_device> m_timer_beep; required_device<hp2640_tape_device> m_tapes; memory_view m_io_view; + persistent_timer m_timer_10ms; + persistent_timer m_timer_cursor_blink_inh; + persistent_timer m_timer_beep; uint8_t m_mode_byte; bool m_timer_irq; @@ -294,7 +294,6 @@ protected: hp2640_base_state::hp2640_base_state(const machine_config &mconfig, device_type type, const char *tag , uint8_t m_cg_0 , uint8_t m_cg_1 , uint8_t m_cg_2 , uint8_t m_cg_3) : driver_device(mconfig , type , tag), m_cpu(*this , "cpu"), - m_timer_10ms(*this , "timer_10ms"), m_io_key(*this , "KEY%u" , 0), m_io_comm(*this , "comm"), m_io_sw_ah(*this , "sw_ah"), @@ -302,12 +301,10 @@ hp2640_base_state::hp2640_base_state(const machine_config &mconfig, device_type m_io_sw_sz(*this , "sw_sz"), m_screen(*this , "screen"), m_palette(*this , "palette"), - m_timer_cursor_blink_inh(*this , "timer_cursor_blink_inh"), m_rs232(*this , "rs232"), m_uart(*this , "uart"), m_uart_clock(*this , "uart_clock"), m_beep(*this , "beep"), - m_timer_beep(*this , "timer_beep"), m_tapes(*this , "tapes"), m_io_view(*this , "io_view"), m_chargen(*this , "chargen%u" , 0), @@ -317,6 +314,10 @@ hp2640_base_state::hp2640_base_state(const machine_config &mconfig, device_type void hp2640_base_state::machine_start() { + m_timer_10ms.init(*this, FUNC(hp2640_base_state::timer_10ms_exp)); + m_timer_cursor_blink_inh.init(*this, FUNC(hp2640_base_state::timer_cursor_blink_inh)); + m_timer_beep.init(*this, FUNC(hp2640_base_state::timer_beep_exp)); + m_screen->register_screen_bitmap(m_bitmap); // TODO: save more state @@ -332,7 +333,7 @@ void hp2640_base_state::machine_reset() m_timer_irq = false; m_datacom_irq = false; m_tape_irq = false; - m_timer_10ms->reset(); + m_timer_10ms.reset(); update_irq(); m_blanking = true; m_dma_on = true; @@ -374,9 +375,9 @@ IRQ_CALLBACK_MEMBER(hp2640_base_state::irq_callback) void hp2640_base_state::mode_byte_w(uint8_t data) { if (BIT(m_mode_byte , 0) && !BIT(data , 0)) { - m_timer_10ms->reset(); + m_timer_10ms.reset(); } else if (!BIT(m_mode_byte , 0) && BIT(data , 0)) { - m_timer_10ms->adjust(attotime::from_msec(10) , 0 , attotime::from_msec(10)); + m_timer_10ms.adjust_periodic(attotime::from_msec(10)); } m_mode_byte = data; @@ -388,7 +389,7 @@ void hp2640_base_state::mode_byte_w(uint8_t data) m_io_view.select(BIT(m_mode_byte , 6)); } -TIMER_DEVICE_CALLBACK_MEMBER(hp2640_base_state::timer_10ms_exp) +void hp2640_base_state::timer_10ms_exp() { if (BIT(m_mode_byte , 1)) { m_timer_irq = true; @@ -446,7 +447,7 @@ void hp2640_base_state::kb_led_w(uint8_t data) { if (BIT(data , 7)) { m_beep->set_state(1); - m_timer_beep->adjust(attotime::from_msec(BEEP_DURATION_MS)); + m_timer_beep.adjust(attotime::from_msec(BEEP_DURATION_MS)); } // TODO: LOG("LED = %02x\n" , data); @@ -488,7 +489,7 @@ void hp2640_base_state::cx_w(uint8_t data) { m_cursor_x = data & 0x7f; m_cursor_blink_inh = true; - m_timer_cursor_blink_inh->adjust(attotime::from_msec(CURSOR_BLINK_INH_MS)); + m_timer_cursor_blink_inh.adjust(attotime::from_msec(CURSOR_BLINK_INH_MS)); } void hp2640_base_state::cy_w(uint8_t data) @@ -513,10 +514,10 @@ void hp2640_base_state::cy_w(uint8_t data) video_fill_buffer(m_even , MAX_DMA_CYCLES); } m_cursor_blink_inh = true; - m_timer_cursor_blink_inh->adjust(attotime::from_msec(CURSOR_BLINK_INH_MS)); + m_timer_cursor_blink_inh.adjust(attotime::from_msec(CURSOR_BLINK_INH_MS)); } -TIMER_DEVICE_CALLBACK_MEMBER(hp2640_base_state::timer_cursor_blink_inh) +void hp2640_base_state::timer_cursor_blink_inh() { m_cursor_blink_inh = false; } @@ -564,7 +565,7 @@ WRITE_LINE_MEMBER(hp2640_base_state::async_txd_w) m_rs232->write_txd(!BIT(m_async_control , 6) && m_uart->so_r()); } -TIMER_DEVICE_CALLBACK_MEMBER(hp2640_base_state::timer_beep_exp) +void hp2640_base_state::timer_beep_exp() { m_beep->set_state(0); } @@ -1097,9 +1098,6 @@ void hp2640_base_state::hp2640_base(machine_config &config) m_cpu->set_addrmap(AS_IO, &hp2640_base_state::cpu_io_map); m_cpu->set_irq_acknowledge_callback(FUNC(hp2640_base_state::irq_callback)); - TIMER(config, m_timer_10ms).configure_generic(FUNC(hp2640_base_state::timer_10ms_exp)); - TIMER(config, m_timer_cursor_blink_inh).configure_generic(FUNC(hp2640_base_state::timer_cursor_blink_inh)); - SCREEN(config, m_screen, SCREEN_TYPE_RASTER, rgb_t::white()); // Actual pixel clock is half this value: 21.06 MHz // We use the doubled value to be able to emulate the half-pixel shifting of the real hw @@ -1129,7 +1127,6 @@ void hp2640_base_state::hp2640_base(machine_config &config) // Beep SPEAKER(config, "mono").front_center(); BEEP(config, m_beep, BEEP_FREQUENCY).add_route(ALL_OUTPUTS, "mono", 1.00); - TIMER(config, m_timer_beep).configure_generic(FUNC(hp2640_base_state::timer_beep_exp)); // Tape drives HP2640_TAPE(config , m_tapes , SYS_CLOCK); diff --git a/src/mame/drivers/hp9825.cpp b/src/mame/drivers/hp9825.cpp index dfcc7c5d007..06e82285b35 100644 --- a/src/mame/drivers/hp9825.cpp +++ b/src/mame/drivers/hp9825.cpp @@ -40,7 +40,6 @@ #include "emu.h" #include "cpu/hphybrid/hphybrid.h" -#include "machine/timer.h" #include "machine/hp9825_tape.h" #include "machine/hp98x5_io_sys.h" #include "machine/hp9825_optrom.h" @@ -105,15 +104,12 @@ public: , m_cpu(*this , "cpu") , m_rom_drawers(*this , "drawer%u" , 0U) , m_io_sys(*this , "io_sys") - , m_cursor_timer(*this , "cursor_timer") , m_tape(*this , "tape") , m_io_key(*this , "KEY%u" , 0) , m_shift_key(*this , "KEY_SHIFT") , m_prt_alpha_out(*this , "prt_alpha") , m_prt_graph_out(*this , "prt_graph") - , m_prt_timer(*this , "prt_timer") , m_beeper(*this , "beeper") - , m_beep_timer(*this , "beep_timer") , m_io_slot(*this, "slot%u", 0U) , m_display(*this , "char_%u_%u" , 0U , 0U) , m_run_light(*this , "run_light") @@ -132,15 +128,12 @@ protected: private: required_device<hp98x5_io_sys_device> m_io_sys; - required_device<timer_device> m_cursor_timer; required_device<hp9825_tape_device> m_tape; required_ioport_array<4> m_io_key; required_ioport m_shift_key; required_device<bitbanger_device> m_prt_alpha_out; required_device<bitbanger_device> m_prt_graph_out; - required_device<timer_device> m_prt_timer; required_device<beep_device> m_beeper; - required_device<timer_device> m_beep_timer; required_device_array<hp9845_io_slot_device , 3> m_io_slot; output_finder<32 , 7> m_display; output_finder<> m_run_light; @@ -162,6 +155,11 @@ private: // SC of slots int m_slot_sc[ 3 ]; + persistent_timer m_cursor_timer; + persistent_timer m_prt_timer; + persistent_timer m_beep_timer; + persistent_timer m_kb_periodic_timer; + void cpu_io_map(address_map &map); uint16_t kb_scancode_r(); @@ -171,13 +169,13 @@ private: void printer_w(uint16_t data); void update_display(); - TIMER_DEVICE_CALLBACK_MEMBER(cursor_blink); + void cursor_blink(); void kb_scan_ioport(ioport_value pressed , ioport_port &port , unsigned idx_base , int& max_seq_len , unsigned& max_seq_idx); - TIMER_DEVICE_CALLBACK_MEMBER(kb_scan); + void kb_scan(); - TIMER_DEVICE_CALLBACK_MEMBER(prt_timer); + void prt_timer(); - TIMER_DEVICE_CALLBACK_MEMBER(beep_timer); + void beep_timer(); // Slot handling void set_irq_slot(unsigned slot , int state); @@ -191,6 +189,13 @@ void hp9825_state::machine_start() m_display.resolve(); m_run_light.resolve(); + m_cursor_timer.init(*this, FUNC(hp9825_state::cursor_blink)); + m_prt_timer.init(*this, FUNC(hp9825_state::prt_timer)); + m_beep_timer.init(*this, FUNC(hp9825_state::beep_timer)); + + // Keyboard scan timer. A scan of the whole keyboard should take 2^14 KDP clocks. + m_kb_periodic_timer.init(*this, FUNC(hp9825_state::kb_scan)).adjust_periodic(attotime::from_ticks(16384 , KDP_CLOCK)); + save_item(NAME(m_display_on)); save_item(NAME(m_display_mem)); save_item(NAME(m_display_idx)); @@ -222,7 +227,7 @@ void hp9825_state::machine_reset() m_display_on = false; m_display_idx = 0; m_rpl_cursor = false; - m_cursor_timer->reset(); + m_cursor_timer.reset(); m_cursor_blink = true; update_display(); m_scancode = 0; @@ -231,9 +236,9 @@ void hp9825_state::machine_reset() m_autorepeat_cnt = 0; m_printer_idx = 0; m_printer_line = 0; - m_prt_timer->reset(); + m_prt_timer.reset(); m_beeper->set_state(0); - m_beep_timer->reset(); + m_beep_timer.reset(); } void hp9825_state::cpu_io_map(address_map &map) @@ -260,7 +265,7 @@ void hp9825_state::disp_w(uint16_t data) { if (m_display_on) { m_display_on = false; - m_cursor_timer->reset(); + m_cursor_timer.reset(); m_cursor_blink = true; m_display_idx = 0; update_display(); @@ -288,7 +293,7 @@ void hp9825_state::kdp_control_w(uint16_t data) m_display_on = true; // Cursor should blink at 2^-19 the KDP clock attotime cursor_half_period{ attotime::from_ticks(262144 , KDP_CLOCK) }; - m_cursor_timer->adjust(cursor_half_period , 0 , cursor_half_period); + m_cursor_timer.adjust_periodic(cursor_half_period); regen_display = true; } if (BIT(data , 6) && !m_rpl_cursor) { @@ -317,12 +322,12 @@ void hp9825_state::kdp_control_w(uint16_t data) m_prt_alpha_out->output('\n'); m_printer_idx = 0; m_printer_line++; - m_prt_timer->adjust(attotime::from_ticks(KDP_CLOCKS_PER_LINE , KDP_CLOCK)); + m_prt_timer.adjust(attotime::from_ticks(KDP_CLOCKS_PER_LINE , KDP_CLOCK)); } if (BIT(data , 2)) { // Start beeper m_beeper->set_state(1); - m_beep_timer->adjust(attotime::from_msec(BEEPER_MS)); + m_beep_timer.adjust(attotime::from_msec(BEEPER_MS)); } if (regen_display) { update_display(); @@ -504,7 +509,7 @@ void hp9825_state::update_display() } } -TIMER_DEVICE_CALLBACK_MEMBER(hp9825_state::cursor_blink) +void hp9825_state::cursor_blink() { m_cursor_blink = !m_cursor_blink; if (m_any_cursor) { @@ -512,7 +517,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(hp9825_state::cursor_blink) } } -TIMER_DEVICE_CALLBACK_MEMBER(hp9825_state::kb_scan) +void hp9825_state::kb_scan() { ioport_value input[ 4 ] { m_io_key[ 0 ]->read(), @@ -569,7 +574,7 @@ void hp9825_state::kb_scan_ioport(ioport_value pressed , ioport_port &port , uns } } -TIMER_DEVICE_CALLBACK_MEMBER(hp9825_state::prt_timer) +void hp9825_state::prt_timer() { if (m_printer_line == 1 || m_printer_line == 9 || m_printer_line == 10) { // Empty lines @@ -589,13 +594,13 @@ TIMER_DEVICE_CALLBACK_MEMBER(hp9825_state::prt_timer) m_prt_graph_out->output('\n'); m_printer_line++; if (m_printer_line <= 10) { - m_prt_timer->adjust(attotime::from_ticks(KDP_CLOCKS_PER_LINE , KDP_CLOCK)); + m_prt_timer.adjust(attotime::from_ticks(KDP_CLOCKS_PER_LINE , KDP_CLOCK)); } else { m_printer_line = 0; } } -TIMER_DEVICE_CALLBACK_MEMBER(hp9825_state::beep_timer) +void hp9825_state::beep_timer() { m_beeper->set_state(0); } @@ -648,11 +653,6 @@ void hp9825_state::hp9825_base(machine_config &config) m_io_sys->flg().set(m_cpu , FUNC(hp_09825_67907_cpu_device::flag_w)); m_io_sys->dmar().set(m_cpu , FUNC(hp_09825_67907_cpu_device::dmar_w)); - TIMER(config , m_cursor_timer , 0).configure_generic(FUNC(hp9825_state::cursor_blink)); - - // Keyboard scan timer. A scan of the whole keyboard should take 2^14 KDP clocks. - TIMER(config , "kb_timer" , 0).configure_periodic(FUNC(hp9825_state::kb_scan), attotime::from_ticks(16384 , KDP_CLOCK)); - // Tape drive HP9825_TAPE(config , m_tape , 0); m_tape->flg().set([this](int state) { m_io_sys->set_flg(TAPE_PA , state); }); @@ -662,12 +662,10 @@ void hp9825_state::hp9825_base(machine_config &config) // Printer BITBANGER(config , m_prt_alpha_out , 0); BITBANGER(config , m_prt_graph_out , 0); - TIMER(config , m_prt_timer , 0).configure_generic(FUNC(hp9825_state::prt_timer)); // Beeper SPEAKER(config, "mono").front_center(); BEEP(config, m_beeper, BEEPER_FREQ).add_route(ALL_OUTPUTS, "mono", 1.00); - TIMER(config , m_beep_timer , 0).configure_generic(FUNC(hp9825_state::beep_timer)); // I/O slots for (unsigned slot = 0; slot < 3; slot++) { diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp index c9c1cc7c3da..aa44aea790d 100644 --- a/src/mame/drivers/ibmpcjr.cpp +++ b/src/mame/drivers/ibmpcjr.cpp @@ -174,7 +174,7 @@ void pcjr_state::device_timer(timer_instance const &timer) if ( m_signal_count <= 0 ) { - m_keyb_signal_timer->adjust( attotime::never, 0, attotime::never ); + m_keyb_signal_timer->adjust( attotime::never ); m_transferring = 0; } break; @@ -304,7 +304,7 @@ WRITE_LINE_MEMBER(pcjr_state::keyb_interrupt) m_transferring = 1; /* Set timer */ - m_keyb_signal_timer->adjust( attotime::from_usec(220), 0, attotime::from_usec(220) ); + m_keyb_signal_timer->adjust_periodic( attotime::from_usec(220) ); m_maincpu->set_input_line(INPUT_LINE_NMI, m_nmi_enabled && m_latch); } } diff --git a/src/mame/drivers/irisha.cpp b/src/mame/drivers/irisha.cpp index 0cea3986ce7..437afa70f6b 100644 --- a/src/mame/drivers/irisha.cpp +++ b/src/mame/drivers/irisha.cpp @@ -356,7 +356,7 @@ uint8_t irisha_state::keyboard_r() void irisha_state::machine_start() { m_key_timer = timer_alloc(*this, FUNC(irisha_state::irisha_key)); - m_key_timer->adjust(attotime::from_msec(30), 0, attotime::from_msec(30)); + m_key_timer->adjust_periodic(attotime::from_msec(30)); save_item(NAME(m_sg1_line)); save_item(NAME(m_keypressed)); save_item(NAME(m_keyboard_cnt)); diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp index e81fc17f07c..7287a89d9ac 100644 --- a/src/mame/drivers/jangou.cpp +++ b/src/mame/drivers/jangou.cpp @@ -915,7 +915,7 @@ void jangou_state::machine_start() /* Create a timer to feed the CVSD DAC with sample bits */ m_cvsd_bit_timer = timer_alloc(*this, FUNC(jangou_state::cvsd_bit_timer_callback)); - m_cvsd_bit_timer->adjust(attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024)); + m_cvsd_bit_timer->adjust_periodic(attotime::from_hz(MASTER_CLOCK / 1024)); } MACHINE_START_MEMBER(jangou_state,jngolady) diff --git a/src/mame/drivers/jpmsys5.cpp b/src/mame/drivers/jpmsys5.cpp index 3876b3e7b75..c906faf7601 100644 --- a/src/mame/drivers/jpmsys5.cpp +++ b/src/mame/drivers/jpmsys5.cpp @@ -552,7 +552,7 @@ INPUT_CHANGED_MEMBER(jpmsys5v_state::touchscreen_press) /* Start sending the data to the 68000 serially */ m_touch_data_count = 0; m_touch_state = START; - m_touch_timer->adjust(rx_period, 0, rx_period); + m_touch_timer->adjust_periodic(rx_period); } } diff --git a/src/mame/drivers/jr100.cpp b/src/mame/drivers/jr100.cpp index caf34e63a29..c3b3188b4e8 100644 --- a/src/mame/drivers/jr100.cpp +++ b/src/mame/drivers/jr100.cpp @@ -216,7 +216,7 @@ void jr100_state::machine_start() void jr100_state::machine_reset() { attotime timer_period = attotime::from_hz(XTAL(14'318'181) / 16); - m_sound_timer->adjust(timer_period, 0, timer_period); + m_sound_timer->adjust_periodic(timer_period); } uint32_t jr100_state::screen_update_jr100(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/drivers/jr200.cpp b/src/mame/drivers/jr200.cpp index 16dc37d6a20..7ba47854755 100644 --- a/src/mame/drivers/jr200.cpp +++ b/src/mame/drivers/jr200.cpp @@ -365,7 +365,7 @@ void jr200_state::mn1271_io_w(offs_t offset, uint8_t data) case 0xc816: if (data!=0) { m_timer_d->adjust(attotime::zero, 0, attotime::from_hz(XTAL(14'318'181)) * (m_mn1271_ram[0x17]*0x100 + m_mn1271_ram[0x18])); } else { - m_timer_d->adjust(attotime::zero, 0, attotime::zero); + m_timer_d->adjust(attotime::zero); } break; case 0xc819: jr200_beep_w(data); break; diff --git a/src/mame/drivers/m68705prg.cpp b/src/mame/drivers/m68705prg.cpp index 30d67862ce0..520de2fb37a 100644 --- a/src/mame/drivers/m68705prg.cpp +++ b/src/mame/drivers/m68705prg.cpp @@ -107,7 +107,7 @@ protected: m_addr = 0x0000; m_pb_val = 0xff; - m_input_poll_timer->adjust(attotime::from_hz(120), 0, attotime::from_hz(120)); + m_input_poll_timer->adjust_periodic(attotime::from_hz(120)); } virtual void machine_reset() override diff --git a/src/mame/drivers/macprtb.cpp b/src/mame/drivers/macprtb.cpp index 71d1c6b42c4..0d156ae1a0f 100644 --- a/src/mame/drivers/macprtb.cpp +++ b/src/mame/drivers/macprtb.cpp @@ -305,7 +305,7 @@ void macportable_state::machine_reset() m_pmu_ack = 1; // start 60.15 Hz timer - m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); + m_6015_timer->adjust_periodic(attotime::from_hz(60.15)); // as with Egret/Cuda, the PMU starts the 68K when it's ready m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); diff --git a/src/mame/drivers/macpwrbk030.cpp b/src/mame/drivers/macpwrbk030.cpp index cd297d20819..6815a1eeffd 100644 --- a/src/mame/drivers/macpwrbk030.cpp +++ b/src/mame/drivers/macpwrbk030.cpp @@ -415,7 +415,7 @@ void macpb030_state::machine_reset() space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, m_rom_ptr); // start 60.15 Hz timer - m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); + m_6015_timer->adjust_periodic(attotime::from_hz(60.15)); } void macpb030_state::init_macpb140() diff --git a/src/mame/drivers/macquadra700.cpp b/src/mame/drivers/macquadra700.cpp index ea2906a6880..abfc8027eb4 100644 --- a/src/mame/drivers/macquadra700.cpp +++ b/src/mame/drivers/macquadra700.cpp @@ -272,7 +272,7 @@ void macquadra_state::machine_reset() space.install_rom(0x00000000, memory_end & ~memory_mirror, memory_mirror, m_rom_ptr); // start 60.15 Hz timer - m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); + m_6015_timer->adjust_periodic(attotime::from_hz(60.15)); } void macquadra_state::init_macqd700() diff --git a/src/mame/drivers/mc1502.cpp b/src/mame/drivers/mc1502.cpp index 200a7b3316e..d93a0e3cbeb 100644 --- a/src/mame/drivers/mc1502.cpp +++ b/src/mame/drivers/mc1502.cpp @@ -192,7 +192,7 @@ void mc1502_state::machine_start() memset(&m_kbd, 0, sizeof(m_kbd)); m_kbd.keyb_signal_timer = timer_alloc(*this, FUNC(mc1502_state::keyb_signal_callback)); - m_kbd.keyb_signal_timer->adjust(attotime::from_msec(20), 0, attotime::from_msec(20)); + m_kbd.keyb_signal_timer->adjust_periodic(attotime::from_msec(20)); } void mc1502_state::machine_reset() diff --git a/src/mame/drivers/mw8080bw.cpp b/src/mame/drivers/mw8080bw.cpp index 7d54095c433..01be5107240 100644 --- a/src/mame/drivers/mw8080bw.cpp +++ b/src/mame/drivers/mw8080bw.cpp @@ -887,7 +887,7 @@ MACHINE_START_MEMBER(mw8080bw_state,maze) /* create astable timer for IC B1 */ m_maze_tone_timer = timer_alloc(*this, FUNC(mw8080bw_state::maze_tone_timing_timer_callback)); - m_maze_tone_timer->adjust(MAZE_555_B1_PERIOD, 0, MAZE_555_B1_PERIOD); + m_maze_tone_timer->adjust_periodic(MAZE_555_B1_PERIOD); /* initialize state of Tone Timing FF, IC C1 */ m_maze_tone_timing_state = 0; diff --git a/src/mame/drivers/namcos22.cpp b/src/mame/drivers/namcos22.cpp index 0361499d8a2..2aa32500eb5 100644 --- a/src/mame/drivers/namcos22.cpp +++ b/src/mame/drivers/namcos22.cpp @@ -2904,7 +2904,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(namcos22s_state::propcycl_pedal_update) else { // not moving - m_pc_pedal_interrupt->adjust(attotime::never, 0, attotime::never); + m_pc_pedal_interrupt->adjust(attotime::never); } } @@ -2950,7 +2950,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(namcos22s_state::adillor_trackball_update) else { // not moving - m_ar_tb_interrupt[axis]->adjust(attotime::never, axis, attotime::never); + m_ar_tb_interrupt[axis]->adjust(attotime::never, axis); } } } diff --git a/src/mame/drivers/nds.cpp b/src/mame/drivers/nds.cpp index 6dbc11641dd..7c339a34216 100644 --- a/src/mame/drivers/nds.cpp +++ b/src/mame/drivers/nds.cpp @@ -247,7 +247,7 @@ void nds_state::arm7_io_w(offs_t offset, uint32_t data, uint32_t mem_mask) if( !(data & 0x40000) ) // if we're not in Count-Up mode { attotime time = attotime::from_hz(final); - m_tmr_timer[timer]->adjust(time, timer, time); + m_tmr_timer[timer]->adjust_periodic(time, timer); } } } @@ -877,7 +877,7 @@ TIMER_CALLBACK_MEMBER(nds_state::timer_expire) final = clocksel / rate; m_timer_hz[tmr] = final; time = attotime::from_hz(final); - m_tmr_timer[tmr]->adjust(time, tmr, time); + m_tmr_timer[tmr]->adjust_periodic(time, tmr); } // Handle count-up timing diff --git a/src/mame/drivers/news_38xx.cpp b/src/mame/drivers/news_38xx.cpp index 062389ce5d2..8c6818a00cb 100644 --- a/src/mame/drivers/news_38xx.cpp +++ b/src/mame/drivers/news_38xx.cpp @@ -175,7 +175,7 @@ void news_38xx_state::machine_reset() // eprom is mapped at 0 after reset m_iop->space(0).install_rom(0x00000000, 0x0000ffff, m_eprom); - m_timer->adjust(attotime::from_hz(100), 0, attotime::from_hz(100)); + m_timer->adjust_periodic(attotime::from_hz(100)); } void news_38xx_state::init_common() diff --git a/src/mame/drivers/news_r3k.cpp b/src/mame/drivers/news_r3k.cpp index c2163f26f78..95f99eac078 100644 --- a/src/mame/drivers/news_r3k.cpp +++ b/src/mame/drivers/news_r3k.cpp @@ -357,7 +357,7 @@ void news_r3k_state::itimer_w(u8 data) // TODO: assume 0xff stops the timer u8 const ticks = data + 1; - m_itimer->adjust(attotime::from_ticks(ticks, 800), 0, attotime::from_ticks(ticks, 800)); + m_itimer->adjust_periodic(attotime::from_ticks(ticks, 800)); } void news_r3k_state::itimer(void *ptr, s32 param) diff --git a/src/mame/drivers/ngp.cpp b/src/mame/drivers/ngp.cpp index 2be9e345da1..1418615cdc6 100644 --- a/src/mame/drivers/ngp.cpp +++ b/src/mame/drivers/ngp.cpp @@ -707,7 +707,7 @@ void ngp_state::machine_start() } m_seconds_timer = timer_alloc(*this, FUNC(ngp_state::ngp_seconds_callback)); - m_seconds_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_seconds_timer->adjust_periodic(attotime::from_seconds(1)); save_item(NAME(m_io_reg)); save_item(NAME(m_old_to3)); diff --git a/src/mame/drivers/nokia_3310.cpp b/src/mame/drivers/nokia_3310.cpp index f625317d309..5c03bfc3b27 100644 --- a/src/mame/drivers/nokia_3310.cpp +++ b/src/mame/drivers/nokia_3310.cpp @@ -256,10 +256,10 @@ void noki3310_state::machine_reset() m_timer1_counter = 0; m_timer0_counter = 0; - m_timer0->adjust(attotime::from_hz(33055 / (255 + 1)), 0, attotime::from_hz(33055 / (255 + 1))); // programmable through port 0x0f - m_timer1->adjust(attotime::from_hz(1057), 0, attotime::from_hz(1057)); - m_timer_watchdog->adjust(attotime::from_hz(1), 0, attotime::from_hz(1)); - m_timer_fiq8->adjust(attotime::from_hz(1000), 0, attotime::from_hz(1000)); + m_timer0->adjust_periodic(attotime::from_hz(33055 / (255 + 1))); // programmable through port 0x0f + m_timer1->adjust_periodic(attotime::from_hz(1057)); + m_timer_watchdog->adjust_periodic(attotime::from_hz(1)); + m_timer_fiq8->adjust_periodic(attotime::from_hz(1000)); // simulate power-on input if (machine().system().name[4] == '8' || machine().system().name[4] == '5') @@ -579,7 +579,7 @@ void noki3310_state::mad2_io_w(offs_t offset, uint8_t data) ack_irq((data << 3) & 0x100); break; case 0x0f: - m_timer0->adjust(attotime::from_hz(33055 / (data + 1)), 0, attotime::from_hz(33055 / (data + 1))); + m_timer0->adjust_periodic(attotime::from_hz(33055 / (data + 1))); break; case 0x16: ack_fiq((data << 7) & 0x100); diff --git a/src/mame/drivers/olyboss.cpp b/src/mame/drivers/olyboss.cpp index b3cd5a341ef..d174ea72c81 100644 --- a/src/mame/drivers/olyboss.cpp +++ b/src/mame/drivers/olyboss.cpp @@ -146,7 +146,7 @@ void olyboss_state::machine_reset() m_fdcctrl = 0; m_vchrmap = 0; m_vchrpage = 0; - m_timer->adjust(attotime::from_hz(30), 0, attotime::from_hz(30)); // unknown timer freq, possibly com2651 BRCLK + m_timer->adjust_periodic(attotime::from_hz(30)); // unknown timer freq, possibly com2651 BRCLK } void olyboss_state::device_timer(timer_instance const &timer) diff --git a/src/mame/drivers/omegrace.cpp b/src/mame/drivers/omegrace.cpp index a389e9e2782..0fee877b759 100644 --- a/src/mame/drivers/omegrace.cpp +++ b/src/mame/drivers/omegrace.cpp @@ -287,7 +287,7 @@ void omegrace_state::machine_start() // Interrupt caused by overflow pulses from 74LS161 clocked by 74LS393 dividing .75 MHz output of 74LS161 attotime period = attotime::from_hz(12_MHz_XTAL/16/256/12); // ~250 Hz m_gbnmi = timer_alloc(*this, FUNC(omegrace_state::periodic_int)); - m_gbnmi->adjust(period, 0, period); // first NMI must not arrive immediately + m_gbnmi->adjust_periodic(period); // first NMI must not arrive immediately } void omegrace_state::machine_reset() diff --git a/src/mame/drivers/oric.cpp b/src/mame/drivers/oric.cpp index 66c01e76656..99f2296b904 100644 --- a/src/mame/drivers/oric.cpp +++ b/src/mame/drivers/oric.cpp @@ -424,7 +424,7 @@ void oric_state::machine_start() void oric_state::machine_reset() { - m_tape_timer->adjust(attotime::from_hz(4800), 0, attotime::from_hz(4800)); + m_tape_timer->adjust_periodic(attotime::from_hz(4800)); } void telestrat_state::machine_start() @@ -456,7 +456,7 @@ void telestrat_state::machine_start() void telestrat_state::machine_reset() { - m_tape_timer->adjust(attotime::from_hz(4800), 0, attotime::from_hz(4800)); + m_tape_timer->adjust_periodic(attotime::from_hz(4800)); m_port_314 = 0x00; m_via2_a = 0xff; remap(); diff --git a/src/mame/drivers/pasopia.cpp b/src/mame/drivers/pasopia.cpp index fe925b07333..f99ce691bca 100644 --- a/src/mame/drivers/pasopia.cpp +++ b/src/mame/drivers/pasopia.cpp @@ -219,7 +219,7 @@ void pasopia_state::machine_start() m_p_vram = make_unique_clear<u16[]>(0x4000); m_pio_timer = timer_alloc(*this, FUNC(pasopia_state::pio_timer)); - m_pio_timer->adjust(attotime::from_hz(50), 0, attotime::from_hz(50)); + m_pio_timer->adjust_periodic(attotime::from_hz(50)); m_hblank = 0; m_spr_sw = false; diff --git a/src/mame/drivers/pasopia7.cpp b/src/mame/drivers/pasopia7.cpp index af6b0e96396..6b23b5f8e65 100644 --- a/src/mame/drivers/pasopia7.cpp +++ b/src/mame/drivers/pasopia7.cpp @@ -919,14 +919,14 @@ void pasopia7_state::init_p7_raster() { m_screen_type = 1; m_pio_timer = timer_alloc(*this, FUNC(pasopia7_state::pio_timer)); - m_pio_timer->adjust(attotime::from_hz(5000), 0, attotime::from_hz(5000)); + m_pio_timer->adjust_periodic(attotime::from_hz(5000)); } void pasopia7_state::init_p7_lcd() { m_screen_type = 0; m_pio_timer = timer_alloc(*this, FUNC(pasopia7_state::pio_timer)); - m_pio_timer->adjust(attotime::from_hz(5000), 0, attotime::from_hz(5000)); + m_pio_timer->adjust_periodic(attotime::from_hz(5000)); } } // Anonymous namespace diff --git a/src/mame/drivers/pb1000.cpp b/src/mame/drivers/pb1000.cpp index fdc07e73a8b..7acfb3cc273 100644 --- a/src/mame/drivers/pb1000.cpp +++ b/src/mame/drivers/pb1000.cpp @@ -403,16 +403,16 @@ void pb1000_state::kb_matrix_w(uint8_t data) if (BIT(data, 7)) { if (!BIT(m_kb_matrix, 7)) - m_kb_timer->adjust(attotime::never, 0, attotime::never); + m_kb_timer->adjust(attotime::never); } else { if (BIT(m_kb_matrix, 6) != BIT(data, 6)) { if (BIT(data, 6)) - m_kb_timer->adjust(attotime::from_hz(32), 0, attotime::from_hz(32)); + m_kb_timer->adjust_periodic(attotime::from_hz(32)); else - m_kb_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); + m_kb_timer->adjust_periodic(attotime::from_hz(256)); } } @@ -456,7 +456,7 @@ void pb1000_state::machine_start() membank("bank1")->set_base(m_rom_reg->base()); m_kb_timer = timer_alloc(*this, FUNC(pb1000_state::keyboard_timer)); - m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192)); + m_kb_timer->adjust_periodic(attotime::from_hz(192)); } void pb1000_state::pb1000(machine_config &config) diff --git a/src/mame/drivers/pc4.cpp b/src/mame/drivers/pc4.cpp index 99f3745b145..d396332fc7a 100644 --- a/src/mame/drivers/pc4.cpp +++ b/src/mame/drivers/pc4.cpp @@ -200,7 +200,7 @@ void pc4_state::machine_start() m_busy_timer = timer_alloc(BUSY_TIMER); m_blink_timer = timer_alloc(BLINKING_TIMER); - m_blink_timer->adjust(attotime::from_msec(409), 0, attotime::from_msec(409)); + m_blink_timer->adjust_periodic(attotime::from_msec(409)); for (int i=0; i<8; i++) { diff --git a/src/mame/drivers/pc6001.cpp b/src/mame/drivers/pc6001.cpp index 8f7ceae57f3..e9f09ec34ef 100644 --- a/src/mame/drivers/pc6001.cpp +++ b/src/mame/drivers/pc6001.cpp @@ -650,7 +650,7 @@ inline void pc6001_state::set_timer_divider(uint8_t data) { m_timer_hz_div = data; attotime period = attotime::from_hz((487.5*4)/(m_timer_hz_div+1)); - m_timer_irq_timer->adjust(period, 0, period); + m_timer_irq_timer->adjust_periodic(period); } void pc6001mk2_state::mk2_timer_adj_w(uint8_t data) diff --git a/src/mame/drivers/pcw.cpp b/src/mame/drivers/pcw.cpp index 2ca6c42131c..5b99b8e5da8 100644 --- a/src/mame/drivers/pcw.cpp +++ b/src/mame/drivers/pcw.cpp @@ -187,7 +187,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(pcw_state::pcw_timer_interrupt) m_timer_irq_flag = 1; pcw_update_irqs(); - m_pulse_timer->adjust(attotime::from_usec(100), 0, attotime::from_usec(100)); + m_pulse_timer->adjust_periodic(attotime::from_usec(100)); } /* PCW uses UPD765 in NON-DMA mode. FDC Ints are connected to /INT or diff --git a/src/mame/drivers/pdp1.cpp b/src/mame/drivers/pdp1.cpp index 538e685e770..25a37569c54 100644 --- a/src/mame/drivers/pdp1.cpp +++ b/src/mame/drivers/pdp1.cpp @@ -1315,7 +1315,7 @@ TIMER_CALLBACK_MEMBER(pdp1_cylinder_image_device::il_timer_callback) void pdp1_cylinder_image_device::parallel_drum_init(pdp1_state *state) { m_rotation_timer = machine().scheduler().timer_alloc(); - m_rotation_timer->adjust(PARALLEL_DRUM_ROTATION_TIME, 0, PARALLEL_DRUM_ROTATION_TIME); + m_rotation_timer->adjust_periodic(PARALLEL_DRUM_ROTATION_TIME); m_il_timer = timer_alloc(*this, FUNC(pdp1_cylinder_image_device::il_timer_callback)); set_il(0); diff --git a/src/mame/drivers/psion5.cpp b/src/mame/drivers/psion5.cpp index 969ef9d316a..a615fd3816b 100644 --- a/src/mame/drivers/psion5.cpp +++ b/src/mame/drivers/psion5.cpp @@ -109,9 +109,9 @@ void psion5mx_state::machine_reset() std::fill(std::begin(m_ports), std::end(m_ports), 0); - m_periodic->adjust(attotime::from_hz(64), 0, attotime::from_hz(64)); + m_periodic->adjust_periodic(attotime::from_hz(64)); - m_rtc_ticker->adjust(attotime::from_hz(64), 0, attotime::from_hz(64)); + m_rtc_ticker->adjust_periodic(attotime::from_hz(64)); } void psion5mx_state::check_interrupts() @@ -189,7 +189,7 @@ void psion5mx_state::set_timer_ctrl(int timer, uint32_t value) } else if (BIT(value, 7)) { - m_timers[timer]->adjust(interval, 0, interval); + m_timers[timer]->adjust_periodic(interval); } else { diff --git a/src/mame/drivers/pwrview.cpp b/src/mame/drivers/pwrview.cpp index a329922f526..b075eb35cfc 100644 --- a/src/mame/drivers/pwrview.cpp +++ b/src/mame/drivers/pwrview.cpp @@ -293,13 +293,13 @@ void pwrview_state::unk4_w(u8 data) switch(data & 7) // this is all hand tuned to match the expected ratio with the pit clock { case 2: - m_tmr0ext->adjust(attotime::from_hz(31500), 0, attotime::from_hz(31500)); + m_tmr0ext->adjust_periodic(attotime::from_hz(31500)); break; case 3: - m_tmr0ext->adjust(attotime::from_hz(90), 0, attotime::from_hz(90)); + m_tmr0ext->adjust_periodic(attotime::from_hz(90)); break; case 4: - m_tmr0ext->adjust(attotime::from_hz(500000), 0, attotime::from_hz(500000)); + m_tmr0ext->adjust_periodic(attotime::from_hz(500000)); break; } } diff --git a/src/mame/drivers/qdrmfgp.cpp b/src/mame/drivers/qdrmfgp.cpp index 59bd8d70c03..d8b320216fa 100644 --- a/src/mame/drivers/qdrmfgp.cpp +++ b/src/mame/drivers/qdrmfgp.cpp @@ -505,7 +505,7 @@ MACHINE_START_MEMBER(qdrmfgp_state,qdrmfgp2) { /* sound irq (CCU? 240Hz) */ m_gp2_timer = timer_alloc(*this, FUNC(qdrmfgp_state::gp2_timer_callback)); - m_gp2_timer->adjust(attotime::from_hz(XTAL(18'432'000)/76800), 0, attotime::from_hz(XTAL(18'432'000)/76800)); + m_gp2_timer->adjust_periodic(attotime::from_hz(XTAL(18'432'000)/76800)); MACHINE_START_CALL_MEMBER( qdrmfgp ); } diff --git a/src/mame/drivers/rastersp.cpp b/src/mame/drivers/rastersp.cpp index abfc4ca87c0..c09f4187e27 100644 --- a/src/mame/drivers/rastersp.cpp +++ b/src/mame/drivers/rastersp.cpp @@ -594,7 +594,7 @@ void rastersp_state::tms32031_control_w(offs_t offset, uint32_t data) period *= m_tms_io_regs[TIMER1_PERIOD]; - m_tms_timer1->adjust(period, 0, period); + m_tms_timer1->adjust_periodic(period); break; } @@ -617,7 +617,7 @@ void rastersp_state::tms32031_control_w(offs_t offset, uint32_t data) m_tms_io_regs[SPORT_GLOBAL_CTL] &= ~(1 << 3); // Run transmitter - m_tms_tx_timer->adjust(period, 0, period); + m_tms_tx_timer->adjust_periodic(period); } break; diff --git a/src/mame/drivers/sega_sawatte.cpp b/src/mame/drivers/sega_sawatte.cpp index 6887278365a..7e891373e01 100644 --- a/src/mame/drivers/sega_sawatte.cpp +++ b/src/mame/drivers/sega_sawatte.cpp @@ -164,7 +164,7 @@ void sawatte_state::irq3_timer_w(u8 data) else { attotime period = attotime::from_hz(10'000); // probably incorrect - m_irq3_timer->adjust(period, 0, period); + m_irq3_timer->adjust_periodic(period); } } @@ -175,7 +175,7 @@ void sawatte_state::irq4_timer_w(u8 data) else { attotime period = attotime::from_hz(8'000); // probably incorrect - m_irq4_timer->adjust(period, 0, period); + m_irq4_timer->adjust_periodic(period); } } diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp index ad97abf80bf..c0adbd47202 100644 --- a/src/mame/drivers/segas16b.cpp +++ b/src/mame/drivers/segas16b.cpp @@ -9706,7 +9706,7 @@ void segas16b_state::init_generic_korean() // allocate a sound timer emu_timer *timer = timer_alloc(TID_ATOMICP_SOUND_IRQ); - timer->adjust(attotime::from_hz(10000), 0, attotime::from_hz(10000)); + timer->adjust_periodic(attotime::from_hz(10000)); } void segas16b_state::init_lockonph() { diff --git a/src/mame/drivers/seta2.cpp b/src/mame/drivers/seta2.cpp index 402ce588f6a..3da72d30150 100644 --- a/src/mame/drivers/seta2.cpp +++ b/src/mame/drivers/seta2.cpp @@ -740,7 +740,7 @@ void funcube_touchscreen_device::device_start() set_tra_rate(9600); m_button_state = 0x00; emu_timer *tm = timer_alloc(0); - tm->adjust(attotime::from_ticks(1, clock()), 0, attotime::from_ticks(1, clock())); + tm->adjust_periodic(attotime::from_ticks(1, clock())); m_tx_cb.resolve_safe(); save_item(NAME(m_button_state)); diff --git a/src/mame/drivers/spg2xx_vii.cpp b/src/mame/drivers/spg2xx_vii.cpp index 1175342d63e..420cc947d3c 100644 --- a/src/mame/drivers/spg2xx_vii.cpp +++ b/src/mame/drivers/spg2xx_vii.cpp @@ -115,7 +115,7 @@ void vii_state::machine_reset() m_controller_input[6] = 0xff; m_controller_input[7] = 0; - m_ctrl_poll_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); + m_ctrl_poll_timer->adjust_periodic(attotime::from_hz(60)); } diff --git a/src/mame/drivers/spg2xx_wiwi.cpp b/src/mame/drivers/spg2xx_wiwi.cpp index 466dfff49bd..717aa3d7da8 100644 --- a/src/mame/drivers/spg2xx_wiwi.cpp +++ b/src/mame/drivers/spg2xx_wiwi.cpp @@ -289,7 +289,7 @@ void spg2xx_game_guitrbus_state::portb_w(offs_t offset, uint16_t data, uint16_t if ((data & 0x0002)) { logerror("ext timer reset\n"); - m_pulse_timer->adjust(attotime::from_hz(32), 0, attotime::from_hz(32)); + m_pulse_timer->adjust_periodic(attotime::from_hz(32)); } } @@ -331,7 +331,7 @@ void spg2xx_game_marc101_state::porta_w(offs_t offset, uint16_t data, uint16_t m if (!(data & 0x0400)) { //logerror("pulse / timer reset\n"); - m_pulse_timer->adjust(attotime::from_hz(32), 0, attotime::from_hz(32)); + m_pulse_timer->adjust_periodic(attotime::from_hz(32)); } } @@ -392,8 +392,8 @@ void spg2xx_game_marc250_state::porta_w(offs_t offset, uint16_t data, uint16_t m { // these values stop the marc250 menu from failing, but not the games //printf("pulse / timer reset\n"); - m_pulse_timer->adjust(attotime::from_hz(6), 0, attotime::from_hz(6)); - m_pulse_timer2->adjust(attotime::from_hz(12), 0, attotime::from_hz(12)); + m_pulse_timer->adjust_periodic(attotime::from_hz(6)); + m_pulse_timer2->adjust_periodic(attotime::from_hz(12)); } } @@ -422,7 +422,7 @@ void spg2xx_game_ddmsup_state::porta_w(offs_t offset, uint16_t data, uint16_t me if (data & 0x4000) { - m_pulse_timer->adjust(attotime::from_hz(6), 0, attotime::from_hz(6)); + m_pulse_timer->adjust_periodic(attotime::from_hz(6)); } m_prev_porta = data; diff --git a/src/mame/drivers/sun4.cpp b/src/mame/drivers/sun4.cpp index 14b14f88153..f5b8d03625b 100644 --- a/src/mame/drivers/sun4.cpp +++ b/src/mame/drivers/sun4.cpp @@ -839,8 +839,8 @@ void sun4_base_state::machine_start() // allocate timers for the built-in two channel timer m_c0_timer = timer_alloc(TIMER_0); m_c1_timer = timer_alloc(TIMER_1); - m_c0_timer->adjust(attotime::from_usec(1), 0, attotime::from_usec(1)); - m_c1_timer->adjust(attotime::from_usec(1), 0, attotime::from_usec(1)); + m_c0_timer->adjust_periodic(attotime::from_usec(1)); + m_c1_timer->adjust_periodic(attotime::from_usec(1)); save_item(NAME(m_auxio)); save_item(NAME(m_counter)); diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp index 84b15b304f0..23433bb5f47 100644 --- a/src/mame/drivers/tandy2k.cpp +++ b/src/mame/drivers/tandy2k.cpp @@ -270,7 +270,7 @@ void tandy2k_state::clkmouse_w(offs_t offset, uint8_t data) break; case 0x20: if(m_clkmouse_cmd[1] > 0) - m_mouse_timer->adjust(attotime::from_hz(40), 0, attotime::from_hz(40)); + m_mouse_timer->adjust_periodic(attotime::from_hz(40)); else m_mouse_timer->adjust(attotime::never); break; @@ -338,7 +338,7 @@ void tandy2k_state::addr_ctrl_w(uint8_t data) m_vac->set_unscaled_clock(busdotclk); - m_timer_vidldsh->adjust(attotime::from_hz(vidcclk), 0, attotime::from_hz(vidcclk)); + m_timer_vidldsh.adjust_periodic(attotime::from_hz(vidcclk)); m_clkspd = clkspd; m_clkcnt = clkcnt; @@ -649,7 +649,7 @@ CRT9021_DRAW_CHARACTER_MEMBER( tandy2k_state::vac_draw_character ) } } -TIMER_DEVICE_CALLBACK_MEMBER( tandy2k_state::vidldsh_tick ) +void tandy2k_state::vidldsh_tick() { m_drb0->rclk_w(0); m_drb0->wclk_w(0); @@ -923,6 +923,7 @@ void tandy2k_state::machine_start() m_mouse_timer = timer_alloc(MOUS_TIMER); m_mcu_delay = timer_alloc(MCU_DELAY); + m_timer_vidldsh.init(*this, FUNC(tandy2k_state::vidldsh_tick)); // register for state saving save_item(NAME(m_dma_mux)); @@ -1039,8 +1040,6 @@ void tandy2k_state::tandy2k(machine_config &config) ADDRESS_MAP_BANK(config, m_vrambank).set_map(&tandy2k_state::vrambank_mem).set_options(ENDIANNESS_LITTLE, 16, 17, 0x8000); - TIMER(config, "vidldsh").configure_generic(FUNC(tandy2k_state::vidldsh_tick)); - // sound hardware SPEAKER(config, "mono").front_center(); SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25); diff --git a/src/mame/drivers/techno.cpp b/src/mame/drivers/techno.cpp index 08032ad7b68..ac998d2fa24 100644 --- a/src/mame/drivers/techno.cpp +++ b/src/mame/drivers/techno.cpp @@ -291,7 +291,7 @@ void techno_state::machine_reset() m_digit = 0; attotime freq = attotime::from_hz(XTAL(8'000'000) / 256); // 31250Hz - m_irq_set_timer->adjust(freq, 0, freq); + m_irq_set_timer->adjust_periodic(freq); m_maincpu->set_input_line(M68K_IRQ_1, CLEAR_LINE); } diff --git a/src/mame/drivers/vis.cpp b/src/mame/drivers/vis.cpp index 17c10e2f838..2f3f5abd744 100644 --- a/src/mame/drivers/vis.cpp +++ b/src/mame/drivers/vis.cpp @@ -220,7 +220,7 @@ void vis_audio_device::pcm_w(offs_t offset, uint8_t data) m_sample_byte = 0; m_isa->drq7_w(ASSERT_LINE); attotime rate = attotime::from_ticks(1 << ((m_mode >> 5) & 3), 44100); // TODO : Unknown clock - m_pcm->adjust(rate, 0, rate); + m_pcm->adjust_periodic(rate); } else if(!(m_mode & 0x10)) m_pcm->adjust(attotime::never); diff --git a/src/mame/drivers/wpc_an.cpp b/src/mame/drivers/wpc_an.cpp index b66a41bea2f..fa45bf684ec 100644 --- a/src/mame/drivers/wpc_an.cpp +++ b/src/mame/drivers/wpc_an.cpp @@ -394,9 +394,9 @@ void wpc_an_state::init_wpc_an() m_cpubank->set_entry(0); m_vblank_timer = timer_alloc(TIMER_VBLANK); - m_vblank_timer->adjust(attotime::from_hz(60),0,attotime::from_hz(60)); + m_vblank_timer->adjust_periodic(attotime::from_hz(60)); m_irq_timer = timer_alloc(TIMER_IRQ); - m_irq_timer->adjust(attotime::from_hz(976),0,attotime::from_hz(976)); + m_irq_timer->adjust_periodic(attotime::from_hz(976)); m_bankmask = ((memregion("maincpu")->bytes()-0x10000) >> 14) - 1; diff --git a/src/mame/drivers/wpc_dot.cpp b/src/mame/drivers/wpc_dot.cpp index 7f3c7a79e9a..75884347602 100644 --- a/src/mame/drivers/wpc_dot.cpp +++ b/src/mame/drivers/wpc_dot.cpp @@ -185,7 +185,7 @@ void wpc_dot_state::init_wpc_dot() m_vblank_timer = timer_alloc(TIMER_VBLANK); m_vblank_timer->adjust(attotime::from_hz(60),0,attotime::from_hz(60*4)); m_irq_timer = timer_alloc(TIMER_IRQ); - m_irq_timer->adjust(attotime::from_hz(976),0,attotime::from_hz(976)); + m_irq_timer->adjust_periodic(attotime::from_hz(976)); m_bankmask = (memregion("code")->bytes() >> 14) - 1; logerror("WPC: ROM bank mask = %02x\n",m_bankmask); memset(m_ram,0,0x3000); diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp index a5a65d2ef7c..f468542ec54 100644 --- a/src/mame/drivers/x07.cpp +++ b/src/mame/drivers/x07.cpp @@ -725,7 +725,7 @@ void x07_state::cassette_load() logerror("Invalid data: %d %f\n", (m_cass_clk & 0x7f), m_cassette->get_position()); } - m_cass_tick->adjust(attotime::from_hz(12000), 0, attotime::from_hz(12000)); + m_cass_tick->adjust_periodic(attotime::from_hz(12000)); } m_cass_state = cass; @@ -1182,7 +1182,7 @@ void x07_state::x07_io_w(offs_t offset, uint8_t data) if (m_cass_motor) { m_cassette->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); - m_cass_poll->adjust(attotime::from_hz(48000), 0, attotime::from_hz(48000)); + m_cass_poll->adjust_periodic(attotime::from_hz(48000)); } else { diff --git a/src/mame/drivers/x68k.cpp b/src/mame/drivers/x68k.cpp index e402550ecee..c02a7926b5a 100644 --- a/src/mame/drivers/x68k.cpp +++ b/src/mame/drivers/x68k.cpp @@ -321,7 +321,7 @@ void x68k_state::set_adpcm() { uint32_t rate = adpcm_div[m_adpcm.rate]; uint32_t res_clock = adpcm_clock[m_adpcm.clock]/2; - m_adpcm_timer->adjust(attotime::from_ticks(rate, res_clock), 0, attotime::from_ticks(rate, res_clock)); + m_adpcm_timer->adjust_periodic(attotime::from_ticks(rate, res_clock)); } // Megadrive 3 button gamepad @@ -1011,7 +1011,7 @@ void x68k_state::dma_end(offs_t offset, uint8_t data) { if(offset == 0) { - m_fdc_tc->adjust(attotime::from_usec(1), 0, attotime::never); + m_fdc_tc->adjust(attotime::from_usec(1)); } } diff --git a/src/mame/etc/opwolf_cchip.txt b/src/mame/etc/opwolf_cchip.txt index 46dbcff8777..bff4cec0cb0 100644 --- a/src/mame/etc/opwolf_cchip.txt +++ b/src/mame/etc/opwolf_cchip.txt @@ -1153,7 +1153,7 @@ void opwolf_state::opwolf_cchip_init( ) m_cchip_credits_for_coin[1] = 1; m_cchip_timer = timer_alloc(TIMER_CCHIP); - m_cchip_timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); + m_cchip_timer->adjust_periodic(attotime::from_hz(60)); } diff --git a/src/mame/includes/exterm.h b/src/mame/includes/exterm.h index 4810f69a202..380fcc1b693 100644 --- a/src/mame/includes/exterm.h +++ b/src/mame/includes/exterm.h @@ -12,7 +12,6 @@ #include "cpu/tms34010/tms34010.h" #include "machine/gen_latch.h" -#include "machine/timer.h" #include "sound/ymopm.h" #include "emupal.h" @@ -27,7 +26,6 @@ public: m_soundlatch(*this, "soundlatch%u", 1), m_slave(*this, "slave"), m_ym2151(*this, "ymsnd"), - m_nmi_timer(*this, "snd_nmi_timer"), m_master_videoram(*this, "master_videoram"), m_slave_videoram(*this, "slave_videoram"), m_dial(*this, "DIAL%u", 0U), @@ -46,7 +44,6 @@ private: required_device_array<generic_latch_8_device, 2> m_soundlatch; required_device<tms34010_device> m_slave; required_device<ym2151_device> m_ym2151; - required_device<timer_device> m_nmi_timer; required_shared_ptr<uint16_t> m_master_videoram; required_shared_ptr<uint16_t> m_slave_videoram; @@ -58,6 +55,7 @@ private: uint8_t m_trackball_old[2]; uint8_t m_sound_control; uint16_t m_last; + persistent_timer m_nmi_timer; void host_data_w(offs_t offset, uint16_t data); uint16_t host_data_r(offs_t offset); @@ -69,7 +67,7 @@ private: void sound_control_w(uint8_t data); void ym2151_data_latch_w(uint8_t data); void exterm_palette(palette_device &palette) const; - TIMER_DEVICE_CALLBACK_MEMBER(master_sound_nmi_callback); + void master_sound_nmi_callback(); TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update); TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg_master); TMS340X0_FROM_SHIFTREG_CB_MEMBER(from_shiftreg_master); diff --git a/src/mame/includes/gaelco3d.h b/src/mame/includes/gaelco3d.h index d4394d99a0d..1694fbe69e3 100644 --- a/src/mame/includes/gaelco3d.h +++ b/src/mame/includes/gaelco3d.h @@ -18,7 +18,6 @@ #include "machine/eepromser.h" #include "machine/gaelco3d.h" #include "machine/gen_latch.h" -#include "machine/timer.h" #include "sound/dmadac.h" #include "video/poly.h" #include "screen.h" @@ -46,7 +45,6 @@ public: , m_soundlatch(*this, "soundlatch") , m_mainlatch(*this, "mainlatch") , m_outlatch(*this, "outlatch") - , m_adsp_autobuffer_timer(*this, "adsp_timer") , m_paletteram16(*this, "paletteram16") , m_paletteram32(*this, "paletteram32") , m_analog(*this, "ANALOG%u", 0U) @@ -117,7 +115,6 @@ private: required_device<generic_latch_8_device> m_soundlatch; required_device<ls259_device> m_mainlatch; required_device<ls259_device> m_outlatch; - required_device<timer_device> m_adsp_autobuffer_timer; optional_shared_ptr<uint16_t> m_paletteram16; optional_shared_ptr<uint32_t> m_paletteram32; @@ -141,6 +138,7 @@ private: int m_lastscan; int m_video_changed; std::unique_ptr<gaelco3d_renderer> m_poly; + persistent_timer m_adsp_autobuffer_timer; void irq_ack_w(uint16_t data); uint16_t sound_status_r(offs_t offset, uint16_t mem_mask = ~0); @@ -168,7 +166,7 @@ private: DECLARE_MACHINE_RESET(common); uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(vblank_gen); - TIMER_DEVICE_CALLBACK_MEMBER(adsp_autobuffer_irq); + void adsp_autobuffer_irq(); void gaelco3d_render(screen_device &screen); void adsp_tx_callback(offs_t offset, uint32_t data); DECLARE_WRITE_LINE_MEMBER(fp_analog_clock_w); diff --git a/src/mame/includes/tandy2k.h b/src/mame/includes/tandy2k.h index 6d63fc1f567..87bf7eed8e9 100644 --- a/src/mame/includes/tandy2k.h +++ b/src/mame/includes/tandy2k.h @@ -17,7 +17,6 @@ #include "machine/pic8259.h" #include "machine/ram.h" #include "machine/tandy2kb.h" -#include "machine/timer.h" #include "machine/upd765.h" #include "machine/bankdev.h" #include "sound/spkrdev.h" @@ -61,7 +60,6 @@ public: m_vac(*this, CRT9021B_TAG), m_colpal(*this, "colpal"), m_vrambank(*this, "vrambank"), - m_timer_vidldsh(*this, "vidldsh"), m_centronics(*this, CENTRONICS_TAG), m_speaker(*this, "speaker"), m_ram(*this, RAM_TAG), @@ -129,7 +127,6 @@ private: required_device<crt9021_device> m_vac; required_device<palette_device> m_colpal; required_device<address_map_bank_device> m_vrambank; - required_device<timer_device> m_timer_vidldsh; required_device<centronics_device> m_centronics; required_device<speaker_sound_device> m_speaker; required_device<ram_device> m_ram; @@ -192,7 +189,7 @@ private: DECLARE_WRITE_LINE_MEMBER(write_centronics_select); DECLARE_WRITE_LINE_MEMBER(write_centronics_fault); CRT9021_DRAW_CHARACTER_MEMBER( vac_draw_character ); - TIMER_DEVICE_CALLBACK_MEMBER( vidldsh_tick ); + void vidldsh_tick(); static void floppy_formats(format_registration &fr); static rgb_t IRGB(uint32_t raw); @@ -273,6 +270,7 @@ private: void vrambank_mem(address_map &map); required_ioport m_buttons, m_x_axis, m_y_axis; + persistent_timer m_timer_vidldsh; }; #endif // MAME_INCLUDES_TANDY2K_H diff --git a/src/mame/includes/xevious.h b/src/mame/includes/xevious.h index 8f26e9abdfe..f3dff107bbd 100644 --- a/src/mame/includes/xevious.h +++ b/src/mame/includes/xevious.h @@ -6,7 +6,6 @@ #pragma once -#include "machine/timer.h" #include "tilemap.h" class xevious_state : public galaga_state @@ -65,8 +64,7 @@ class battles_state : public xevious_state { public: battles_state(const machine_config &mconfig, device_type type, const char *tag) - : xevious_state(mconfig, type, tag), - m_nmi_timer(*this, "nmi") + : xevious_state(mconfig, type, tag) { } @@ -75,11 +73,12 @@ public: void battles(machine_config &config); protected: + virtual void machine_start() override; virtual void machine_reset() override; private: DECLARE_WRITE_LINE_MEMBER(interrupt_4); - TIMER_DEVICE_CALLBACK_MEMBER(nmi_generate); + void nmi_generate(); void battles_mem4(address_map &map); @@ -97,14 +96,14 @@ private: void cpu4_coin_w(uint8_t data); void noise_sound_w(offs_t offset, uint8_t data); - required_device<timer_device> m_nmi_timer; - uint8_t m_customio[16]; char m_customio_command; char m_customio_prev_command; char m_customio_command_count; char m_customio_data; char m_sound_played; + + persistent_timer m_nmi_timer; }; #endif // MAME_INCLUDES_XEVIOUS diff --git a/src/mame/machine/archimedes_keyb.cpp b/src/mame/machine/archimedes_keyb.cpp index 658ebafb8c6..c048a7a50f9 100644 --- a/src/mame/machine/archimedes_keyb.cpp +++ b/src/mame/machine/archimedes_keyb.cpp @@ -268,7 +268,7 @@ void archimedes_keyboard_device::device_reset() transmit_register_reset(); receive_register_reset(); - m_mouse_timer->adjust(attotime::from_hz(1000 * 4), 0, attotime::from_hz(1000 * 4)); + m_mouse_timer->adjust_periodic(attotime::from_hz(1000 * 4)); } //------------------------------------------------- diff --git a/src/mame/machine/bk.cpp b/src/mame/machine/bk.cpp index def436905c4..128f85f135d 100644 --- a/src/mame/machine/bk.cpp +++ b/src/mame/machine/bk.cpp @@ -64,7 +64,7 @@ void bk_state::machine_start() m_maincpu->set_input_line(t11_device::VEC_LINE, ASSERT_LINE); m_kbd_timer = timer_alloc(*this, FUNC(bk_state::keyboard_callback)); - m_kbd_timer->adjust(attotime::from_hz(2400), 0, attotime::from_hz(2400)); + m_kbd_timer->adjust_periodic(attotime::from_hz(2400)); } uint8_t bk_state::irq_callback(offs_t offset) diff --git a/src/mame/machine/cmi_mkbd.cpp b/src/mame/machine/cmi_mkbd.cpp index 7dad35dac78..d45eb12e206 100644 --- a/src/mame/machine/cmi_mkbd.cpp +++ b/src/mame/machine/cmi_mkbd.cpp @@ -75,7 +75,7 @@ void cmi_music_keyboard_device::device_start() { m_cmi10_scnd_timer = timer_alloc(TIMER_CMI10_SCND); - m_cmi10_scnd_timer->adjust(attotime::from_hz(4000000 / 4 / 2048 / 2), 0, attotime::from_hz(4000000 / 4 / 2048 / 2)); + m_cmi10_scnd_timer->adjust_periodic(attotime::from_hz(4000000 / 4 / 2048 / 2)); m_scnd = 0; } diff --git a/src/mame/machine/cuda.cpp b/src/mame/machine/cuda.cpp index 2a8266ff656..26be22713af 100644 --- a/src/mame/machine/cuda.cpp +++ b/src/mame/machine/cuda.cpp @@ -349,7 +349,7 @@ uint8_t cuda_device::onesec_r() void cuda_device::onesec_w(uint8_t data) { - m_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_timer->adjust_periodic(attotime::from_seconds(1)); if ((onesec & 0x40) && !(data & 0x40)) { diff --git a/src/mame/machine/dec_lk201.cpp b/src/mame/machine/dec_lk201.cpp index 6caa127b643..c5176392ac1 100644 --- a/src/mame/machine/dec_lk201.cpp +++ b/src/mame/machine/dec_lk201.cpp @@ -551,7 +551,7 @@ void lk201_device::device_reset() set_data_frame(1, 8, PARITY_NONE, STOP_BITS_1); set_rate(4800); - m_count->adjust(attotime::from_hz(1200), 0, attotime::from_hz(1200)); + m_count->adjust_periodic(attotime::from_hz(1200)); memset(m_timer.regs, 0, sizeof(m_timer.regs)); sci_status = (SCSR_TC | SCSR_TDRE); diff --git a/src/mame/machine/decocass_tape.cpp b/src/mame/machine/decocass_tape.cpp index fc821eb0f0e..b9657ef0eaa 100644 --- a/src/mame/machine/decocass_tape.cpp +++ b/src/mame/machine/decocass_tape.cpp @@ -366,6 +366,6 @@ void decocass_tape_device::change_speed(int8_t newspeed) newperiod = attotime::from_hz(TAPE_CLOCKRATE * absnewspeed); /* set the new speed */ - m_tape_timer->adjust(newperiod, 0, newperiod); + m_tape_timer->adjust_periodic(newperiod); m_speed = newspeed; } diff --git a/src/mame/machine/egret.cpp b/src/mame/machine/egret.cpp index 0ba4ca818fd..648c288e6aa 100644 --- a/src/mame/machine/egret.cpp +++ b/src/mame/machine/egret.cpp @@ -338,7 +338,7 @@ void egret_device::onesec_w(uint8_t data) { // printf("%02x to one-second control\n", data); - m_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_timer->adjust_periodic(attotime::from_seconds(1)); if ((onesec & 0x40) && !(data & 0x40)) { diff --git a/src/mame/machine/fidel_clockdiv.cpp b/src/mame/machine/fidel_clockdiv.cpp index 26a86a43917..57ca5683708 100644 --- a/src/mame/machine/fidel_clockdiv.cpp +++ b/src/mame/machine/fidel_clockdiv.cpp @@ -78,7 +78,7 @@ void fidel_clockdiv_state::div_refresh(ioport_value val) // 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); + m_div_timer->adjust_periodic(period); // set up memory passthroughs if (m_read_tap) diff --git a/src/mame/machine/gamecom.cpp b/src/mame/machine/gamecom.cpp index 757dad76dd7..c937aeba43c 100644 --- a/src/mame/machine/gamecom.cpp +++ b/src/mame/machine/gamecom.cpp @@ -22,7 +22,7 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_sound0_timer_callback) { if (m_sound.sg0t > 0) { - m_sound0_timer->adjust(attotime::from_hz(2764800/m_sound.sg0t), 0, attotime::from_hz(2764800/m_sound.sg0t)); + m_sound0_timer->adjust_periodic(attotime::from_hz(2764800/m_sound.sg0t)); if ((m_sound.sgc & 0x81) == 0x81) m_sound0_cnt = 0; } @@ -40,7 +40,7 @@ TIMER_CALLBACK_MEMBER(gamecom_state::gamecom_sound1_timer_callback) { if (m_sound.sg1t > 0) { - m_sound1_timer->adjust(attotime::from_hz(2764800/m_sound.sg1t), 0, attotime::from_hz(2764800/m_sound.sg1t)); + m_sound1_timer->adjust_periodic(attotime::from_hz(2764800/m_sound.sg1t)); if ((m_sound.sgc & 0x82) == 0x82) m_sound1_cnt = 0; } @@ -317,12 +317,12 @@ void gamecom_state::gamecom_internal_w(offs_t offset, uint8_t data) if ( data & 0x40 ) { /* timer resolution 1 minute */ - m_clock_timer->adjust(attotime::from_seconds(60), 0, attotime::from_seconds(60)); + m_clock_timer->adjust_periodic(attotime::from_seconds(60)); } else { /* TImer resolution 1 second */ - m_clock_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_clock_timer->adjust_periodic(attotime::from_seconds(1)); } } else @@ -614,8 +614,8 @@ void gamecom_state::init_gamecom() m_clock_timer = timer_alloc(*this, FUNC(gamecom_state::gamecom_clock_timer_callback)); m_sound0_timer = timer_alloc(*this, FUNC(gamecom_state::gamecom_sound0_timer_callback)); m_sound1_timer = timer_alloc(*this, FUNC(gamecom_state::gamecom_sound1_timer_callback)); - m_sound0_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); - m_sound1_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_sound0_timer->adjust_periodic(attotime::from_seconds(1)); + m_sound1_timer->adjust_periodic(attotime::from_seconds(1)); m_p_ram = m_share_maincpu; // required here because pio_w gets called before machine_reset } diff --git a/src/mame/machine/hp48.cpp b/src/mame/machine/hp48.cpp index 571dd885efb..74fc699a597 100644 --- a/src/mame/machine/hp48.cpp +++ b/src/mame/machine/hp48.cpp @@ -977,14 +977,14 @@ void hp48_state::base_machine_start(hp48_models model) /* timers */ m_1st_timer = timer_alloc(*this, FUNC(hp48_state::timer1_cb)); - m_1st_timer->adjust(attotime::from_hz(16), 0, attotime::from_hz(16)); + m_1st_timer->adjust_periodic(attotime::from_hz(16)); m_2nd_timer = timer_alloc(*this, FUNC(hp48_state::timer2_cb)); - m_2nd_timer->adjust(attotime::from_hz(8192), 0, attotime::from_hz(8192)); + m_2nd_timer->adjust_periodic(attotime::from_hz(8192)); /* 1ms keyboard polling */ m_kbd_timer = timer_alloc(*this, FUNC(hp48_state::kbd_cb)); - m_kbd_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + m_kbd_timer->adjust_periodic(attotime::from_msec(1)); m_rs232_byte_recv_cb.init(*this, FUNC(hp48_state::rs232_byte_recv_cb)); m_rs232_byte_sent_cb.init(*this, FUNC(hp48_state::rs232_byte_sent_cb)); diff --git a/src/mame/machine/interpro_ioga.cpp b/src/mame/machine/interpro_ioga.cpp index c6854b8b18d..c7e6741f6d4 100644 --- a/src/mame/machine/interpro_ioga.cpp +++ b/src/mame/machine/interpro_ioga.cpp @@ -1051,7 +1051,7 @@ void interpro_ioga_device::timer0_w(offs_t offset, u32 data, u32 mem_mask) // restart the timer attotime period = attotime::from_ticks(m_prescaler ? m_prescaler & 0xffff : 0x10000, 10_MHz_XTAL); - m_timer0->adjust(period, 0, period); + m_timer0->adjust_periodic(period); } TIMER_CALLBACK_MEMBER(interpro_ioga_device::timer0) @@ -1114,7 +1114,7 @@ void interpro_ioga_device::timer1_w(offs_t offset, u32 data, u32 mem_mask) attotime period = attotime::from_ticks(m_prescaler ? m_prescaler & 0xffff : 0x10000, 10_MHz_XTAL); - m_timer1->adjust(period, 0, period); + m_timer1->adjust_periodic(period); } } diff --git a/src/mame/machine/k7659kb.cpp b/src/mame/machine/k7659kb.cpp index 2cb4bfefaa7..09b879069c7 100644 --- a/src/mame/machine/k7659kb.cpp +++ b/src/mame/machine/k7659kb.cpp @@ -221,7 +221,7 @@ void k7659_keyboard_device::device_reset() { m_lookup = 0; m_p_rom = memregion("k7659")->base(); - m_timer->adjust(attotime::from_hz(200), 0, attotime::from_hz(200)); + m_timer->adjust_periodic(attotime::from_hz(200)); } void k7659_keyboard_device::device_timer(timer_instance const &timer) diff --git a/src/mame/machine/kc_keyb.cpp b/src/mame/machine/kc_keyb.cpp index 7b375b5aa38..7adb6044b4e 100644 --- a/src/mame/machine/kc_keyb.cpp +++ b/src/mame/machine/kc_keyb.cpp @@ -460,7 +460,7 @@ void kc_keyboard_device::device_start() m_timer_transmit_pulse = timer_alloc(TIMER_TRANSMIT_PULSE); - m_timer_transmit_pulse->adjust(attotime::from_usec(1024), 0, attotime::from_usec(1024)); + m_timer_transmit_pulse->adjust_periodic(attotime::from_usec(1024)); } //------------------------------------------------- diff --git a/src/mame/machine/lisa.cpp b/src/mame/machine/lisa.cpp index bb98579bc49..9b87980509f 100644 --- a/src/mame/machine/lisa.cpp +++ b/src/mame/machine/lisa.cpp @@ -938,7 +938,7 @@ void lisa_state::machine_start() /* read command every ms (don't know the real value) */ m_cops_ready_timer = timer_alloc(*this, FUNC(lisa_state::set_COPS_ready)); - m_cops_ready_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + m_cops_ready_timer->adjust_periodic(attotime::from_msec(1)); m_read_COPS_command.init(*this, FUNC(lisa_state::read_COPS_command)); diff --git a/src/mame/machine/mac.cpp b/src/mame/machine/mac.cpp index e0ccba7fedb..b4ecce08bea 100644 --- a/src/mame/machine/mac.cpp +++ b/src/mame/machine/mac.cpp @@ -1051,7 +1051,7 @@ void mac_state::machine_reset() // start 60.15 Hz timer for most systems if (((m_model >= MODEL_MAC_IICI) && (m_model <= MODEL_MAC_IIFX)) || (m_model >= MODEL_MAC_LC)) { - m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); + m_6015_timer->adjust_periodic(attotime::from_hz(60.15)); } // default to 32-bit mode on LC diff --git a/src/mame/machine/mace.cpp b/src/mame/machine/mace.cpp index 17f46510352..a752dfcd47b 100644 --- a/src/mame/machine/mace.cpp +++ b/src/mame/machine/mace.cpp @@ -97,8 +97,8 @@ void mace_device::device_reset() memset(&m_isa, 0, sizeof(isa_t)); memset(&m_ust_msc, 0, sizeof(ust_msc_t)); - m_timer_ust->adjust(attotime::from_nsec(960), 0, attotime::from_nsec(960)); - m_timer_msc->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + m_timer_ust->adjust_periodic(attotime::from_nsec(960)); + m_timer_msc->adjust_periodic(attotime::from_msec(1)); } //************************************************************************** diff --git a/src/mame/machine/macpci.cpp b/src/mame/machine/macpci.cpp index d4db4dee7b4..18b11dd06df 100644 --- a/src/mame/machine/macpci.cpp +++ b/src/mame/machine/macpci.cpp @@ -113,7 +113,7 @@ void macpci_state::machine_start() void macpci_state::machine_reset() { - m_6015_timer->adjust(attotime::from_hz(60.15), 0, attotime::from_hz(60.15)); + m_6015_timer->adjust_periodic(attotime::from_hz(60.15)); m_via_cycles = -256; // for a 66 MHz PowerMac diff --git a/src/mame/machine/macrtc.cpp b/src/mame/machine/macrtc.cpp index cd27f21fdfc..db79ed1f003 100644 --- a/src/mame/machine/macrtc.cpp +++ b/src/mame/machine/macrtc.cpp @@ -55,7 +55,7 @@ void rtc3430042_device::device_start() { // allocate timers m_clock_timer = timer_alloc(); - m_clock_timer->adjust(attotime::from_hz(clock() / 32768), 0, attotime::from_hz(clock() / 32768)); + m_clock_timer->adjust_periodic(attotime::from_hz(clock() / 32768)); // state saving } diff --git a/src/mame/machine/mct_adr.cpp b/src/mame/machine/mct_adr.cpp index f669d8a825a..88054116677 100644 --- a/src/mame/machine/mct_adr.cpp +++ b/src/mame/machine/mct_adr.cpp @@ -117,7 +117,7 @@ void mct_adr_device::map(address_map &map) attotime interval = attotime::from_ticks((data + 1) & 0x1ff, 1000); - m_interval_timer->adjust(interval, 0, interval); + m_interval_timer->adjust_periodic(interval); }, "interrupt_interval"); map(0x230, 0x237).lr32([this] () { if (m_out_int_timer_asserted) { m_out_int_timer_asserted = false; m_out_int_timer(0); } return m_interval_timer->remaining().as_ticks(1000); }, "interval_timer"); map(0x238, 0x23b).lr32(NAME([this] () { return m_eisa_iack(); })); @@ -183,7 +183,7 @@ void mct_adr_device::device_reset() m_isr = 0; m_imr = 0x10; // firmware diagnostic expects network interrupts to be unmasked at boot - m_interval_timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + m_interval_timer->adjust_periodic(attotime::from_msec(1)); irq_check(nullptr, 0); } diff --git a/src/mame/machine/midikbd.cpp b/src/mame/machine/midikbd.cpp index 9178061e491..0fb075f6a14 100644 --- a/src/mame/machine/midikbd.cpp +++ b/src/mame/machine/midikbd.cpp @@ -87,7 +87,7 @@ void midi_keyboard_device::device_start() m_out_tx_func.resolve_safe(); m_head = m_tail = 0; m_keyboard_timer = timer_alloc(); - m_keyboard_timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10)); + m_keyboard_timer->adjust_periodic(attotime::from_msec(10)); } void midi_keyboard_device::tra_callback() diff --git a/src/mame/machine/mips_rambo.cpp b/src/mame/machine/mips_rambo.cpp index db1eea5a324..6be8f9bf798 100644 --- a/src/mame/machine/mips_rambo.cpp +++ b/src/mame/machine/mips_rambo.cpp @@ -160,7 +160,7 @@ void mips_rambo_device::control_w(u32 data) { attotime const period = attotime::from_ticks(1 << ((data & CONTROL_BUZZMASK) >> 4), 1524_Hz_XTAL); - m_buzzer->adjust(period, 0, period); + m_buzzer->adjust_periodic(period); } } diff --git a/src/mame/machine/mm1kb.cpp b/src/mame/machine/mm1kb.cpp index bbe69ceeed8..7be63b95fee 100644 --- a/src/mame/machine/mm1kb.cpp +++ b/src/mame/machine/mm1kb.cpp @@ -227,7 +227,7 @@ void mm1_keyboard_device::device_start() // allocate timers m_scan_timer = timer_alloc(SCAN_TIMER); - m_scan_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_scan_timer->adjust_periodic(attotime::from_hz(clock())); // add notification request for system shut down (to play back the power switch sound once more) machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(&mm1_keyboard_device::shut_down_mm1, this)); diff --git a/src/mame/machine/nb1412m2.cpp b/src/mame/machine/nb1412m2.cpp index 085c4d1e27f..360d1f0c76e 100644 --- a/src/mame/machine/nb1412m2.cpp +++ b/src/mame/machine/nb1412m2.cpp @@ -220,8 +220,7 @@ void nb1412m2_device::rom_op_w(uint8_t data) if(data == 2) { m_dac_current_address = m_dac_start_address; - m_dac_timer->adjust(attotime::never); - m_dac_timer->adjust(attotime::from_hz(m_dac_frequency), 0, attotime::from_hz(m_dac_frequency)); + m_dac_timer->adjust_periodic(attotime::from_hz(m_dac_frequency)); m_dac_playback = true; } // TODO: data == 5 probably loads the result into 0x37 diff --git a/src/mame/machine/nextkbd.cpp b/src/mame/machine/nextkbd.cpp index aa4c3fe954e..b6fa968199c 100644 --- a/src/mame/machine/nextkbd.cpp +++ b/src/mame/machine/nextkbd.cpp @@ -69,7 +69,7 @@ void nextkbd_device::device_reset() prev_mousey = 0; prev_mousebtn = 0; km_address = 0; - poll_timer->adjust(attotime::from_hz(200), 0, attotime::from_hz(200)); + poll_timer->adjust_periodic(attotime::from_hz(200)); } void nextkbd_device::send() diff --git a/src/mame/machine/p2000t_mdcr.cpp b/src/mame/machine/p2000t_mdcr.cpp index 0f26fedcbe4..437b4f279e2 100644 --- a/src/mame/machine/p2000t_mdcr.cpp +++ b/src/mame/machine/p2000t_mdcr.cpp @@ -102,7 +102,7 @@ mdcr_device::mdcr_device(machine_config const &mconfig, char const *tag, device_ void mdcr_device::device_start() { m_read_timer = timer_alloc(); - m_read_timer->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); + m_read_timer->adjust_periodic(attotime::from_hz(44100)); save_item(NAME(m_fwd)); save_item(NAME(m_rev)); diff --git a/src/mame/machine/pc9801_kbd.cpp b/src/mame/machine/pc9801_kbd.cpp index e6643b4a96b..e9851f771b6 100644 --- a/src/mame/machine/pc9801_kbd.cpp +++ b/src/mame/machine/pc9801_kbd.cpp @@ -241,7 +241,7 @@ void pc9801_kbd_device::device_start() m_write_irq.resolve_safe(); m_rxtimer = timer_alloc(RX_TIMER); - m_rxtimer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_rxtimer->adjust_periodic(attotime::from_hz(clock())); } diff --git a/src/mame/machine/pce220_ser.cpp b/src/mame/machine/pce220_ser.cpp index 7e9c6407c1e..52aa81ee2b8 100644 --- a/src/mame/machine/pce220_ser.cpp +++ b/src/mame/machine/pce220_ser.cpp @@ -215,7 +215,7 @@ image_init_result pce220_serial_device::call_load() { m_state = SIO_WAIT; m_bytes_count = 0; - m_send_timer->adjust(attotime::from_hz(SIO_BAUD_RATE), 0, attotime::from_hz(SIO_BAUD_RATE)); + m_send_timer->adjust_periodic(attotime::from_hz(SIO_BAUD_RATE)); //read the first byte fread(&m_current_byte, 1); @@ -232,7 +232,7 @@ image_init_result pce220_serial_device::call_create(int format_type, util::optio m_state = SIO_WAIT; m_bytes_count = 0; m_current_byte = 0; - m_receive_timer->adjust(attotime::from_hz(SIO_BAUD_RATE), 0, attotime::from_hz(SIO_BAUD_RATE)); + m_receive_timer->adjust_periodic(attotime::from_hz(SIO_BAUD_RATE)); return image_init_result::PASS; } diff --git a/src/mame/machine/pce_cd.cpp b/src/mame/machine/pce_cd.cpp index 0fbc43de97f..f725195bc7b 100644 --- a/src/mame/machine/pce_cd.cpp +++ b/src/mame/machine/pce_cd.cpp @@ -432,7 +432,7 @@ void pce_cd_device::read_6() } else { - m_data_timer->adjust(attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND), 0, attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND)); + m_data_timer->adjust_periodic(attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND)); } /* TODO: correct place? */ @@ -1266,7 +1266,7 @@ void pce_cd_device::adpcm_dma_control_w(uint8_t data) { if (data & 3) { - m_adpcm_dma_timer->adjust(attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND * 2048), 0, attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND * 2048)); + m_adpcm_dma_timer->adjust_periodic(attotime::from_hz(PCE_CD_DATA_FRAMES_PER_SECOND * 2048)); m_adpcm_status |= 4; } m_adpcm_dma_reg = data; diff --git a/src/mame/machine/psxcd.cpp b/src/mame/machine/psxcd.cpp index 5e297a1d46f..966bb1917da 100644 --- a/src/mame/machine/psxcd.cpp +++ b/src/mame/machine/psxcd.cpp @@ -162,7 +162,7 @@ void psxcd_device::device_reset() for (int i = 0; i < MAX_PSXCD_TIMERS; i++) { - m_timers[i]->adjust(attotime::never, 0, attotime::never); + m_timers[i]->adjust(attotime::never); m_timerinuse[i] = false; } open = true; @@ -903,7 +903,7 @@ void psxcd_device::send_result(uint8_t res, uint8_t *data, int sz, int delay, ui if ((next_read_event != -1) && ((systime+delay)>(next_sector_t))) { uint32_t hz = m_sysclock / (delay + 2000); - m_timers[next_read_event]->adjust(attotime::from_hz(hz), 0, attotime::never); + m_timers[next_read_event]->adjust(attotime::from_hz(hz)); } add_system_event(event_cmd_complete, delay, prepare_result(res, data, sz, errcode)); @@ -1172,7 +1172,7 @@ void psxcd_device::stop_read() if (next_read_event != -1) { - m_timers[next_read_event]->adjust(attotime::never, 0, attotime::never); + m_timers[next_read_event]->adjust(attotime::never); m_timerinuse[next_read_event] = false; next_read_event = -1; } @@ -1224,7 +1224,7 @@ int psxcd_device::add_system_event(int type, uint64_t t, command_result *ptr) { if(!m_timerinuse[i]) { - m_timers[i]->adjust(attotime::from_hz(hz), type, attotime::never); + m_timers[i]->adjust(attotime::from_hz(hz), type); if (ptr != nullptr) { m_command_result[i] = *ptr; diff --git a/src/mame/machine/qx10kbd.cpp b/src/mame/machine/qx10kbd.cpp index 8fb196214b6..d47ce08e590 100644 --- a/src/mame/machine/qx10kbd.cpp +++ b/src/mame/machine/qx10kbd.cpp @@ -28,7 +28,7 @@ tiny_rom_entry const *qx10_keyboard_device::device_rom_region() const void qx10_keyboard_device::device_start() { m_bit_timer = timer_alloc(); - m_bit_timer->adjust(attotime::from_hz(2400), 0, attotime::from_hz(2400)); + m_bit_timer->adjust_periodic(attotime::from_hz(2400)); m_clk_state = 0; } diff --git a/src/mame/machine/rm380z.cpp b/src/mame/machine/rm380z.cpp index eae9b86cb0f..5a0c8cc6d88 100644 --- a/src/mame/machine/rm380z.cpp +++ b/src/mame/machine/rm380z.cpp @@ -227,7 +227,7 @@ void rm380z_state::disk_0_control(uint8_t data) void rm380z_state::machine_start() { m_static_vblank_timer = timer_alloc(*this, FUNC(rm380z_state::static_vblank_timer)); - m_static_vblank_timer->adjust(attotime::from_hz(TIMER_SPEED), 0, attotime::from_hz(TIMER_SPEED)); + m_static_vblank_timer->adjust_periodic(attotime::from_hz(TIMER_SPEED)); } void rm380z_state::init_rm380z() diff --git a/src/mame/machine/sgi.cpp b/src/mame/machine/sgi.cpp index 31e68b1b472..e987899d4bd 100644 --- a/src/mame/machine/sgi.cpp +++ b/src/mame/machine/sgi.cpp @@ -173,7 +173,7 @@ void sgi_mc_device::device_reset() m_dma_run = 0; m_eeprom_ctrl = 0; memset(m_semaphore, 0, sizeof(uint32_t) * 16); - m_rpss_timer->adjust(attotime::from_hz(10000000), 0, attotime::from_hz(10000000)); + m_rpss_timer->adjust_periodic(attotime::from_hz(10000000)); m_rpss_divide_counter = 4; m_rpss_divide_count = 4; m_rpss_increment = 1; @@ -680,7 +680,7 @@ void sgi_mc_device::write(offs_t offset, uint32_t data, uint32_t mem_mask) if (data & 1) { m_dma_run |= 0x40; - m_dma_timer->adjust(attotime::from_hz(33333333), 0, attotime::from_hz(33333333)); + m_dma_timer->adjust_periodic(attotime::from_hz(33333333)); } break; case 0x2070/4: @@ -691,7 +691,7 @@ void sgi_mc_device::write(offs_t offset, uint32_t data, uint32_t mem_mask) m_dma_count = 0x0001000c; m_dma_mode = 0x00000028; m_dma_run |= 0x40; - m_dma_timer->adjust(attotime::from_hz(33333333), 0, attotime::from_hz(33333333)); + m_dma_timer->adjust_periodic(attotime::from_hz(33333333)); break; case 0x10000/4: case 0x11000/4: diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp index cd8182d5c9c..8f44b3ddcce 100644 --- a/src/mame/machine/thomson.cpp +++ b/src/mame/machine/thomson.cpp @@ -868,7 +868,7 @@ void thomson_state::to7_game_init() { LOG (( "to7_game_init called\n" )); m_to7_game_timer = timer_alloc(*this, FUNC(thomson_state::to7_game_update_cb)); - m_to7_game_timer->adjust(TO7_GAME_POLL_PERIOD, 0, TO7_GAME_POLL_PERIOD); + m_to7_game_timer->adjust_periodic(TO7_GAME_POLL_PERIOD); save_item(NAME(m_to7_game_sound)); save_item(NAME(m_to7_game_mute)); } @@ -4002,7 +4002,7 @@ void mo6_state::mo6_game_init() { LOG (( "mo6_game_init called\n" )); 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); + m_to7_game_timer->adjust_periodic(TO7_GAME_POLL_PERIOD); save_item(NAME(m_to7_game_sound)); save_item(NAME(m_to7_game_mute)); } @@ -4424,7 +4424,7 @@ void mo5nr_state::mo5nr_game_init() { LOG (( "mo5nr_game_init called\n" )); 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 ); + m_to7_game_timer->adjust_periodic( TO7_GAME_POLL_PERIOD ); save_item(NAME(m_to7_game_sound)); save_item(NAME(m_to7_game_mute)); } diff --git a/src/mame/machine/ti85.cpp b/src/mame/machine/ti85.cpp index 1e608f6d2ee..b71d459899c 100644 --- a/src/mame/machine/ti85.cpp +++ b/src/mame/machine/ti85.cpp @@ -256,7 +256,7 @@ void ti85_state::machine_start() m_ti81_port_7_data = 0; m_ti85_timer = timer_alloc(*this, FUNC(ti85_state::ti85_timer_callback)); - m_ti85_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); + m_ti85_timer->adjust_periodic(attotime::from_hz(256)); space.unmap_write(0x0000, 0x3fff); space.unmap_write(0x4000, 0x7fff); @@ -361,9 +361,9 @@ MACHINE_START_MEMBER(ti85_state,ti83p) ti85_state::update_ti83p_memory(); m_ti83_1st_timer = timer_alloc(*this, FUNC(ti85_state::ti83_timer1_callback)); - m_ti83_1st_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); + m_ti83_1st_timer->adjust_periodic(attotime::from_hz(256)); m_ti83_2nd_timer = timer_alloc(*this, FUNC(ti85_state::ti83_timer2_callback)); - m_ti83_2nd_timer->adjust(attotime::from_hz(512), 0, attotime::from_hz(512)); + m_ti83_2nd_timer->adjust_periodic(attotime::from_hz(512)); /* save states and debugging */ save_item(NAME(m_timer_interrupt_status)); @@ -401,9 +401,9 @@ void ti85_state::ti8xpse_init_common() ti85_state::update_ti83pse_memory(); m_ti83_1st_timer = timer_alloc(*this, FUNC(ti85_state::ti83_timer1_callback)); - m_ti83_1st_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); + m_ti83_1st_timer->adjust_periodic(attotime::from_hz(256)); m_ti83_2nd_timer = timer_alloc(*this, FUNC(ti85_state::ti83_timer2_callback)); - m_ti83_2nd_timer->adjust(attotime::from_hz(512), 0, attotime::from_hz(512)); + m_ti83_2nd_timer->adjust_periodic(attotime::from_hz(512)); m_crystal_timer1 = timer_alloc(CRYSTAL_TIMER1); m_crystal_timer2 = timer_alloc(CRYSTAL_TIMER2); @@ -473,7 +473,7 @@ MACHINE_START_MEMBER(ti85_state,ti86) subdevice<nvram_device>("nvram")->set_base(m_ti8x_ram.get(), sizeof(uint8_t)*128*1024); m_ti85_timer = timer_alloc(*this, FUNC(ti85_state::ti85_timer_callback)); - m_ti85_timer->adjust(attotime::from_hz(256), 0, attotime::from_hz(256)); + m_ti85_timer->adjust_periodic(attotime::from_hz(256)); } diff --git a/src/mame/machine/tv955kb.cpp b/src/mame/machine/tv955kb.cpp index 5976866236b..16a9320ae51 100644 --- a/src/mame/machine/tv955kb.cpp +++ b/src/mame/machine/tv955kb.cpp @@ -97,7 +97,7 @@ WRITE_LINE_MEMBER(tv955kb_device::bell_w) { // Speaker driven through 2N4401 from Q8 output of MC14040 clocked by ALE attotime period = m_mcu->cycles_to_attotime(128); - m_bell_timer->adjust(period, 0, period); + m_bell_timer->adjust_periodic(period); } } diff --git a/src/mame/machine/upd65031.cpp b/src/mame/machine/upd65031.cpp index 6e930e3ac3e..4ef71e320a2 100644 --- a/src/mame/machine/upd65031.cpp +++ b/src/mame/machine/upd65031.cpp @@ -228,8 +228,8 @@ void upd65031_device::device_start() m_rtc_timer = timer_alloc(TIMER_RTC); m_flash_timer = timer_alloc(TIMER_FLASH); m_speaker_timer = timer_alloc(TIMER_SPEAKER); - m_rtc_timer->adjust(attotime::from_msec(5), 0, attotime::from_msec(5)); - m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); + m_rtc_timer->adjust_periodic(attotime::from_msec(5)); + m_flash_timer->adjust_periodic(attotime::from_hz(2)); m_speaker_timer->reset(); // state saving @@ -494,7 +494,7 @@ void upd65031_device::write(offs_t offset, uint8_t data) if ((data & COM_SRUN) && !(data & COM_SBIT)) { // constant tone used for keyclick and alarm - m_speaker_timer->adjust(SPEAKER_ALARM_FREQ, 0, SPEAKER_ALARM_FREQ); + m_speaker_timer->adjust_periodic(SPEAKER_ALARM_FREQ); } else { diff --git a/src/mame/machine/victor9k_fdc.cpp b/src/mame/machine/victor9k_fdc.cpp index 32719b2eb6f..9561e4bcbde 100644 --- a/src/mame/machine/victor9k_fdc.cpp +++ b/src/mame/machine/victor9k_fdc.cpp @@ -604,7 +604,7 @@ void victor_9000_fdc_device::update_rpm(floppy_image_device *floppy, emu_timer * floppy->set_rpm(rpm[da]); bool enabled = t_tach->enabled(); - t_tach->adjust(attotime::from_hz(tach*2), 0, attotime::from_hz(tach*2)); + t_tach->adjust_periodic(attotime::from_hz(tach*2)); t_tach->enable(enabled); } #endif diff --git a/src/mame/machine/vino.cpp b/src/mame/machine/vino.cpp index 3abdca812bb..8e0eae1e814 100644 --- a/src/mame/machine/vino.cpp +++ b/src/mame/machine/vino.cpp @@ -1028,7 +1028,7 @@ void vino_device::control_w(uint32_t data) LOGMASKED(LOG_DMA, "Enabling DMA on channel %c\n", channel ? 'B' : 'A'); chan.m_field_counter = 0; attotime fetch_rate = calculate_fetch_rate(channel); - chan.m_fetch_timer->adjust(fetch_rate, 0, fetch_rate); + chan.m_fetch_timer->adjust_periodic(fetch_rate); chan.m_field_pixels_remaining[0] = chan.m_pixels_per_odd_field; chan.m_field_pixels_remaining[1] = chan.m_pixels_per_even_field; chan.m_field_x = 0; diff --git a/src/mame/machine/vt1682_timer.cpp b/src/mame/machine/vt1682_timer.cpp index afe5bdc2697..0a003b7379f 100644 --- a/src/mame/machine/vt1682_timer.cpp +++ b/src/mame/machine/vt1682_timer.cpp @@ -21,7 +21,6 @@ DEFINE_DEVICE_TYPE(VT_VT1682_TIMER, vrt_vt1682_timer_device, "vt1682timer", "VRT vrt_vt1682_timer_device::vrt_vt1682_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, VT_VT1682_TIMER, tag, owner, clock), - m_timer(*this, "snd_timera"), m_irq_cb(*this) { } @@ -32,6 +31,8 @@ void vrt_vt1682_timer_device::device_start() save_item(NAME(m_timer_preload_15_8)); save_item(NAME(m_timer_enable)); + m_timer.init(*this, FUNC(vrt_vt1682_timer_device::timer_expired)); + m_irq_cb.resolve(); } @@ -103,7 +104,7 @@ void vrt_vt1682_timer_device::update_timer() { uint16_t preload = (m_timer_preload_15_8 << 8) | m_timer_preload_7_0; int realpreload = 65536 - preload; - m_timer->adjust(attotime::from_hz(clock()) * realpreload, 0, attotime::from_hz(clock()) * realpreload); + m_timer.adjust_periodic(attotime::from_hz(clock()) * realpreload); } } @@ -162,11 +163,11 @@ void vrt_vt1682_timer_device::vt1682_timer_enable_w(uint8_t data) } else { - m_timer->adjust(attotime::never); + m_timer.adjust(attotime::never); } } -TIMER_DEVICE_CALLBACK_MEMBER(vrt_vt1682_timer_device::timer_expired) +void vrt_vt1682_timer_device::timer_expired() { if (m_timer_enable & 0x02) { @@ -197,11 +198,6 @@ void vrt_vt1682_timer_device::vt1682_timer_irqclear_w(uint8_t data) m_irq_cb(false); } -void vrt_vt1682_timer_device::device_add_mconfig(machine_config& config) -{ - TIMER(config, m_timer).configure_generic(FUNC(vrt_vt1682_timer_device::timer_expired)); -} - void vrt_vt1682_timer_device::change_clock() { notify_clock_changed(); diff --git a/src/mame/machine/vt1682_timer.h b/src/mame/machine/vt1682_timer.h index d2e35280a33..49d55ed0f43 100644 --- a/src/mame/machine/vt1682_timer.h +++ b/src/mame/machine/vt1682_timer.h @@ -6,8 +6,6 @@ #pragma once -#include "machine/timer.h" - DECLARE_DEVICE_TYPE(VT_VT1682_TIMER, vrt_vt1682_timer_device) class vrt_vt1682_timer_device : public device_t @@ -37,11 +35,9 @@ public: protected: virtual void device_start() override; virtual void device_reset() override; - virtual void device_add_mconfig(machine_config &config) override; private: bool m_is_sound_timer; - required_device<timer_device> m_timer; void update_timer(void); @@ -49,9 +45,10 @@ private: uint8_t m_timer_preload_15_8; uint8_t m_timer_enable; - TIMER_DEVICE_CALLBACK_MEMBER(timer_expired); + void timer_expired(); devcb_write_line m_irq_cb; + persistent_timer m_timer; }; #endif // MAME_MACHINE_VT1682_TIMER_H diff --git a/src/mame/machine/wpc.cpp b/src/mame/machine/wpc.cpp index 496139f579d..18668475427 100644 --- a/src/mame/machine/wpc.cpp +++ b/src/mame/machine/wpc.cpp @@ -43,7 +43,7 @@ void wpc_device::device_start() m_dmdbank_w.resolve_safe(); m_zc_timer = timer_alloc(TIMER_ZEROCROSS); - m_zc_timer->adjust(attotime::from_hz(120),0,attotime::from_hz(120)); + m_zc_timer->adjust_periodic(attotime::from_hz(120)); } void wpc_device::device_reset() diff --git a/src/mame/machine/wpc_lamp.cpp b/src/mame/machine/wpc_lamp.cpp index 575933ebd5d..6a1aad47b5f 100644 --- a/src/mame/machine/wpc_lamp.cpp +++ b/src/mame/machine/wpc_lamp.cpp @@ -54,7 +54,7 @@ void wpc_lamp_device::device_start() void wpc_lamp_device::device_reset() { memset(state, 0x00, 64); - timer->adjust(attotime::from_hz(60), 0, attotime::from_hz(60)); + timer->adjust_periodic(attotime::from_hz(60)); } void wpc_lamp_device::device_timer(timer_instance const &timer) diff --git a/src/mame/machine/wpc_out.cpp b/src/mame/machine/wpc_out.cpp index 78ae12ece96..1515d783ac8 100644 --- a/src/mame/machine/wpc_out.cpp +++ b/src/mame/machine/wpc_out.cpp @@ -129,7 +129,7 @@ void wpc_out_device::device_reset() gi = 0x00; previous_gi_update = attotime::zero; memset(gi_time, 0, sizeof(gi_time)); - timer->adjust(attotime::from_hz(10), 0, attotime::from_hz(10)); + timer->adjust_periodic(attotime::from_hz(10)); } void wpc_out_device::device_timer(timer_instance const &timer) diff --git a/src/mame/machine/xbox_pci.cpp b/src/mame/machine/xbox_pci.cpp index 919b836203a..99c133bbec7 100644 --- a/src/mame/machine/xbox_pci.cpp +++ b/src/mame/machine/xbox_pci.cpp @@ -938,7 +938,7 @@ void mcpx_apu_device::apu_w(offs_t offset, uint32_t data, uint32_t mem_mask) apust.gpdsp_sgblocks = data; apust.gpdsp_address = apust.space->read_dword(apust.gpdsp_sgaddress); // memory address of first block apust.timer->enable(); - apust.timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + apust.timer->adjust_periodic(attotime::from_msec(1)); } if (offset == 0x02048 / 4) // (epdsp scratch dma) apust.epdsp_sgaddress = data; diff --git a/src/mame/machine/xbox_usb.cpp b/src/mame/machine/xbox_usb.cpp index 36648b05e11..a3bf8f7927a 100644 --- a/src/mame/machine/xbox_usb.cpp +++ b/src/mame/machine/xbox_usb.cpp @@ -109,7 +109,7 @@ void ohci_usb_controller::write(offs_t offset, uint32_t data) hcfs = (data >> 6) & 3; // HostControllerFunctionalState if (hcfs == UsbOperational) { ohcist.timer->enable(); - ohcist.timer->adjust(attotime::from_msec(1), 0, attotime::from_msec(1)); + ohcist.timer->adjust_periodic(attotime::from_msec(1)); ohcist.writebackdonehadcounter = 7; // need to load the FrameRemaining field of HcFmRemaining with the value of the FrameInterval field in HcFmInterval } diff --git a/src/mame/machine/xevious.cpp b/src/mame/machine/xevious.cpp index ea662444e5b..95bb2a1b153 100644 --- a/src/mame/machine/xevious.cpp +++ b/src/mame/machine/xevious.cpp @@ -20,7 +20,7 @@ ***************************************************************************/ -TIMER_DEVICE_CALLBACK_MEMBER(battles_state::nmi_generate) +void battles_state::nmi_generate() { m_customio_prev_command = m_customio_command; @@ -81,10 +81,10 @@ void battles_state::customio0_w(uint8_t data) switch (data) { case 0x10: - m_nmi_timer->reset(); + m_nmi_timer.reset(); return; /* nop */ } - m_nmi_timer->adjust(attotime::from_usec(166), 0, attotime::from_usec(166)); + m_nmi_timer.adjust_periodic(attotime::from_usec(166)); } diff --git a/src/mame/machine/z80ne.cpp b/src/mame/machine/z80ne.cpp index 461205d7994..291a5dbe086 100644 --- a/src/mame/machine/z80ne.cpp +++ b/src/mame/machine/z80ne.cpp @@ -345,7 +345,7 @@ void z80ne_state::machine_start() m_lx385_ctrl = 0x1f; m_cassette_timer = timer_alloc(*this, FUNC(z80ne_state::z80ne_cassette_tc)); m_kbd_timer = timer_alloc(*this, FUNC(z80ne_state::z80ne_kbd_scan)); - m_kbd_timer->adjust(attotime::from_hz(1000), 0, attotime::from_hz(1000)); + m_kbd_timer->adjust_periodic(attotime::from_hz(1000)); } void z80netf_state::machine_start() diff --git a/src/mame/machine/zx.cpp b/src/mame/machine/zx.cpp index 3f95ecbf971..7903a4d35d1 100644 --- a/src/mame/machine/zx.cpp +++ b/src/mame/machine/zx.cpp @@ -38,7 +38,7 @@ void zx_state::machine_reset() m_cassette_cur_level = 0; - m_tape_input->adjust(attotime::from_hz(44100), 0, attotime::from_hz(44100)); + m_tape_input->adjust_periodic(attotime::from_hz(44100)); } void zx_state::zx_tape_input() diff --git a/src/mame/video/abc80.cpp b/src/mame/video/abc80.cpp index 98f3675146f..f4c73190534 100644 --- a/src/mame/video/abc80.cpp +++ b/src/mame/video/abc80.cpp @@ -163,7 +163,7 @@ void abc80_state::video_start() m_scanline_timer->adjust(m_screen->time_until_pos(0, ABC80_HBEND), 0, m_screen->scan_period()); m_blink_timer = timer_alloc(TIMER_ID_BLINK); - m_blink_timer->adjust(attotime::from_hz(XTAL(11'980'800)/2/6/64/312/16), 0, attotime::from_hz(XTAL(11'980'800)/2/6/64/312/16)); + m_blink_timer->adjust_periodic(attotime::from_hz(XTAL(11'980'800)/2/6/64/312/16)); m_vsync_on_timer = timer_alloc(TIMER_ID_VSYNC_ON); m_vsync_on_timer->adjust(m_screen->time_until_pos(0, 0), 0, m_screen->frame_period()); diff --git a/src/mame/video/dday.cpp b/src/mame/video/dday.cpp index 642bb4a4d7e..90d7c059617 100644 --- a/src/mame/video/dday.cpp +++ b/src/mame/video/dday.cpp @@ -37,7 +37,7 @@ void dday_state::start_countdown_timer() { m_timer_value = 0; - m_countdown_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); + m_countdown_timer->adjust_periodic(attotime::from_seconds(1)); } diff --git a/src/mame/video/dpb_combiner.cpp b/src/mame/video/dpb_combiner.cpp index 64bc7ca03cf..f5947a54cd3 100644 --- a/src/mame/video/dpb_combiner.cpp +++ b/src/mame/video/dpb_combiner.cpp @@ -125,7 +125,7 @@ void dpb7000_combiner_card_device::device_reset() memset(m_matte_u, 0, 2); memset(m_matte_v, 0, 2); - m_fsck_timer->adjust(attotime::from_hz(clock()), 0, attotime::from_hz(clock())); + m_fsck_timer->adjust_periodic(attotime::from_hz(clock())); } void dpb7000_combiner_card_device::device_add_mconfig(machine_config &config) diff --git a/src/mame/video/galaxold.cpp b/src/mame/video/galaxold.cpp index 0e3f7557347..869c84ba8be 100644 --- a/src/mame/video/galaxold.cpp +++ b/src/mame/video/galaxold.cpp @@ -1475,7 +1475,7 @@ void galaxold_state::start_stars_blink_timer(double ra, double rb, double c) int period_in_ms = 693 * (ra + 2.0 * rb) * c; - m_stars_blink_timer->adjust(attotime::from_msec(period_in_ms), 0, attotime::from_msec(period_in_ms)); + m_stars_blink_timer->adjust_periodic(attotime::from_msec(period_in_ms)); } diff --git a/src/mame/video/vectrex.cpp b/src/mame/video/vectrex.cpp index ac963d9a536..9a4bfdaf041 100644 --- a/src/mame/video/vectrex.cpp +++ b/src/mame/video/vectrex.cpp @@ -94,7 +94,7 @@ void vectrex_base_state::vectrex_via_w(offs_t offset, uint8_t data) period = m_maincpu->cycles_to_attotime(m_via_timer2); if (m_reset_refresh) - m_refresh->adjust(period, 0, period); + m_refresh->adjust_periodic(period); else m_refresh->adjust( std::min(period, m_refresh->remaining()), @@ -261,7 +261,7 @@ void vectrex_state::video_start() m_imager_freq = 1; m_imager_timer = timer_alloc(TIMER_VECTREX_IMAGER_EYE); - m_imager_timer->adjust(attotime::from_hz(m_imager_freq), 2, attotime::from_hz(m_imager_freq)); + m_imager_timer->adjust_periodic(attotime::from_hz(m_imager_freq), 2); m_lp_t = timer_alloc(TIMER_LIGHTPEN_TRIGGER); } diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp index 9887619a556..a5df7318f4f 100644 --- a/src/mame/video/vtvideo.cpp +++ b/src/mame/video/vtvideo.cpp @@ -112,7 +112,7 @@ void vt100_video_device::device_start() // LBA7 is scan line frequency update m_lba7_change_timer = timer_alloc(*this, FUNC(vt100_video_device::lba7_change)); - m_lba7_change_timer->adjust(clocks_to_attotime(765), 0, clocks_to_attotime(765)); + m_lba7_change_timer->adjust_periodic(clocks_to_attotime(765)); // LBA3 and LBA4 are first two stages of divide-by-17 counter m_lba3_change_timer = timer_alloc(*this, FUNC(vt100_video_device::lba3_change)); diff --git a/src/mame/video/wswan.cpp b/src/mame/video/wswan.cpp index 181ef6aae48..e8bb9706211 100644 --- a/src/mame/video/wswan.cpp +++ b/src/mame/video/wswan.cpp @@ -91,7 +91,7 @@ void wswan_video_device::device_start() screen().register_screen_bitmap(m_bitmap); m_timer = timer_alloc(TIMER_SCANLINE); - m_timer->adjust(attotime::from_ticks(256, clock()), 0, attotime::from_ticks(256, clock())); + m_timer->adjust_periodic(attotime::from_ticks(256, clock())); // bind callbacks m_set_irq_cb.resolve(); diff --git a/src/mame/video/zx8301.cpp b/src/mame/video/zx8301.cpp index ff601f70831..f0efc22ea7d 100644 --- a/src/mame/video/zx8301.cpp +++ b/src/mame/video/zx8301.cpp @@ -142,7 +142,7 @@ void zx8301_device::device_start() // adjust timer periods m_vsync_timer->adjust(attotime::zero, 0, attotime::from_hz(50)); - m_flash_timer->adjust(attotime::from_hz(2), 0, attotime::from_hz(2)); + m_flash_timer->adjust_periodic(attotime::from_hz(2)); // register for state saving save_item(NAME(m_dispoff)); diff --git a/src/osd/osdnet.cpp b/src/osd/osdnet.cpp index 9a40df90dbc..6573466f5ee 100644 --- a/src/osd/osdnet.cpp +++ b/src/osd/osdnet.cpp @@ -39,7 +39,7 @@ osd_netdev::osd_netdev(class device_network_interface *ifdev, int rate) { m_dev = ifdev; m_timer.init(ifdev->device().scheduler(), *this, FUNC(osd_netdev::recv)); - m_timer.adjust(attotime::from_hz(rate), 0, attotime::from_hz(rate)); + m_timer.adjust_periodic(attotime::from_hz(rate)); } osd_netdev::~osd_netdev() |