diff options
Diffstat (limited to 'src/devices/cpu/m6502/m5074x.cpp')
-rw-r--r-- | src/devices/cpu/m6502/m5074x.cpp | 88 |
1 files changed, 38 insertions, 50 deletions
diff --git a/src/devices/cpu/m6502/m5074x.cpp b/src/devices/cpu/m6502/m5074x.cpp index 251902f3f0f..2d961b694a5 100644 --- a/src/devices/cpu/m6502/m5074x.cpp +++ b/src/devices/cpu/m6502/m5074x.cpp @@ -69,10 +69,10 @@ void m5074x_device::device_start() m_read_p.resolve_all_safe(0); m_write_p.resolve_all_safe(); - for (int i = 0; i < NUM_TIMERS; i++) - { - m_timers[i] = timer_alloc(i); - } + m_timers[TIMER_1] = timer_alloc(FUNC(m5074x_device::timer1_tick), this); + m_timers[TIMER_2] = timer_alloc(FUNC(m5074x_device::timer2_tick), this); + m_timers[TIMER_X] = timer_alloc(FUNC(m5074x_device::timerx_tick), this); + m_timers[TIMER_ADC] = timer_alloc(FUNC(m5074x_device::adc_complete), this); m740_device::device_start(); @@ -122,42 +122,39 @@ void m5074x_device::device_reset() m_tmr1 = m_tmr2 = m_tmrx = 0; } -void m5074x_device::device_timer(emu_timer &timer, device_timer_id id, int param) +TIMER_CALLBACK_MEMBER(m5074x_device::timer1_tick) { - switch (id) - { - case TIMER_1: - m_tmr1--; + m_tmr1--; - if (m_tmr1 <= 0) - { - m_intctrl |= IRQ_TMR1REQ; - m_tmr1 = m_tmr1latch; - recalc_irqs(); - } - break; + if (m_tmr1 <= 0) + { + m_intctrl |= IRQ_TMR1REQ; + m_tmr1 = m_tmr1latch; + recalc_irqs(); + } +} - case TIMER_2: - m_tmr2--; +TIMER_CALLBACK_MEMBER(m5074x_device::timer2_tick) +{ + m_tmr2--; - if (m_tmr2 <= 0) - { - m_intctrl |= IRQ_TMR2REQ; - m_tmr2 = m_tmr2latch; - recalc_irqs(); - } - break; + if (m_tmr2 <= 0) + { + m_intctrl |= IRQ_TMR2REQ; + m_tmr2 = m_tmr2latch; + recalc_irqs(); + } +} - case TIMER_X: - m_tmrx--; +TIMER_CALLBACK_MEMBER(m5074x_device::timerx_tick) +{ + m_tmrx--; - if (m_tmrx <= 0) - { - m_tmrctrl |= TMRC_TMRXREQ; - m_tmrx = m_tmrxlatch; - recalc_irqs(); - } - break; + if (m_tmrx <= 0) + { + m_tmrctrl |= TMRC_TMRXREQ; + m_tmrx = m_tmrxlatch; + recalc_irqs(); } } @@ -607,23 +604,14 @@ void m50753_device::execute_set_input(int inputnum, int state) recalc_irqs(); } -void m50753_device::device_timer(emu_timer &timer, device_timer_id id, int param) +TIMER_CALLBACK_MEMBER(m50753_device::adc_complete) { - switch (id) - { - case TIMER_ADC: - m_timers[TIMER_ADC]->adjust(attotime::never); + m_timers[TIMER_ADC]->adjust(attotime::never); - // if interrupt source is the ADC, do it. - if (m_ad_control & 4) - { - m_intctrl |= IRQ_50753_INTADC; - recalc_irqs(); - } - break; - - default: - m5074x_device::device_timer(timer, id, param); - break; + // if interrupt source is the ADC, do it. + if (m_ad_control & 4) + { + m_intctrl |= IRQ_50753_INTADC; + recalc_irqs(); } } |