diff options
Diffstat (limited to 'src/devices/cpu/h8/h8_timer8.cpp')
-rw-r--r-- | src/devices/cpu/h8/h8_timer8.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/devices/cpu/h8/h8_timer8.cpp b/src/devices/cpu/h8/h8_timer8.cpp index b652f091c07..29e156edfee 100644 --- a/src/devices/cpu/h8/h8_timer8.cpp +++ b/src/devices/cpu/h8/h8_timer8.cpp @@ -8,13 +8,15 @@ const device_type H8H_TIMER8_CHANNEL = &device_creator<h8h_timer8_channel_device h8_timer8_channel_device::h8_timer8_channel_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, H8_TIMER8_CHANNEL, "H8 8-bits timer channel", tag, owner, clock, "h8_8bits_timer_channel", __FILE__), - cpu(*this, "^") + cpu(*this, "^"), chained_timer(nullptr), intc(nullptr), chain_tag(nullptr), intc_tag(nullptr), irq_ca(0), irq_cb(0), irq_v(0), chain_type(0), tcr(0), tcsr(0), tcnt(0), extra_clock_bit(false), + has_adte(false), has_ice(false), clock_type(0), clock_divider(0), clear_type(0), counter_cycle(0), last_clock_update(0), event_time(0) { } h8_timer8_channel_device::h8_timer8_channel_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : device_t(mconfig, type, name, tag, owner, clock, shortname, source), - cpu(*this, "^") + cpu(*this, "^"), chained_timer(nullptr), intc(nullptr), chain_tag(nullptr), intc_tag(nullptr), irq_ca(0), irq_cb(0), irq_v(0), chain_type(0), tcr(0), tcsr(0), tcnt(0), extra_clock_bit(false), + has_adte(false), has_ice(false), clock_type(0), clock_divider(0), clear_type(0), counter_cycle(0), last_clock_update(0), event_time(0) { } @@ -24,7 +26,7 @@ void h8_timer8_channel_device::set_info(const char *intc, int _irq_ca, int _irq_ irq_ca = _irq_ca; irq_cb = _irq_cb; irq_v = _irq_v; - chain_tag = NULL; + chain_tag = nullptr; chain_type = STOPPED; has_adte = false; has_ice = false; @@ -177,7 +179,7 @@ void h8_timer8_channel_device::device_start() if(chain_tag) chained_timer = siblingdevice<h8_timer8_channel_device>(chain_tag); else - chained_timer = NULL; + chained_timer = nullptr; } void h8_timer8_channel_device::device_reset() @@ -276,16 +278,16 @@ void h8_timer8_channel_device::recalc_event(UINT64 cur_time) event_delay = counter_cycle; } - for(int i=0; i<2; i++) { + for(auto & elem : tcor) { UINT32 new_delay = 0xffffffff; - if(tcor[i] > tcnt) { - if(tcnt >= counter_cycle || tcor[i] <= counter_cycle) - new_delay = tcor[i] - tcnt; - } else if(tcor[i] <= counter_cycle) { + if(elem > tcnt) { + if(tcnt >= counter_cycle || elem <= counter_cycle) + new_delay = elem - tcnt; + } else if(elem <= counter_cycle) { if(tcnt < counter_cycle) - new_delay = (counter_cycle - tcnt) + tcor[i]; + new_delay = (counter_cycle - tcnt) + elem; else - new_delay = (0x100 - tcnt) + tcor[i]; + new_delay = (0x100 - tcnt) + elem; } if(event_delay > new_delay) event_delay = new_delay; |