diff options
Diffstat (limited to 'src/devices/machine/mm58167.cpp')
-rw-r--r-- | src/devices/machine/mm58167.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/devices/machine/mm58167.cpp b/src/devices/machine/mm58167.cpp index f226590e9d2..203b0bf45c4 100644 --- a/src/devices/machine/mm58167.cpp +++ b/src/devices/machine/mm58167.cpp @@ -22,14 +22,14 @@ DEFINE_DEVICE_TYPE(MM58167, mm58167_device, "mm58167", "National Semiconductor M // registers (0-7 are the live data, 8-f are the setting for the compare IRQ) typedef enum { - R_CNT_MILLISECONDS = 0, // 0 = milliseconds - R_CNT_HUNDTENTHS, // 1 = hundreds and tenths of seconds - R_CNT_SECONDS, // 2 = seconds - R_CNT_MINUTES, // 3 = minutes - R_CNT_HOURS, // 4 = hours - R_CNT_DAYOFWEEK, // 5 = day of the week - R_CNT_DAYOFMONTH, // 6 = day of the month - R_CNT_MONTH, // 7 = month + R_CNT_MILLISECONDS = 0, // 0 = milliseconds [0..9] + R_CNT_HUNDTENTHS, // 1 = hundreds and tenths of seconds [0..99] + R_CNT_SECONDS, // 2 = seconds [0..59] + R_CNT_MINUTES, // 3 = minutes [0..59] + R_CNT_HOURS, // 4 = hours [0..23] + R_CNT_DAYOFWEEK, // 5 = day of the week [1..7, Sunday = 1] + R_CNT_DAYOFMONTH, // 6 = day of the month [1..31; but Feb 29 = Mar 0] + R_CNT_MONTH, // 7 = month [1..12] R_RAM_MILLISECONDS, // 8 = milliseconds R_RAM_HUNDTENTHS, // 9 = hundreds and tenths of seconds R_RAM_SECONDS, // a = seconds @@ -67,11 +67,9 @@ mm58167_device::mm58167_device(const machine_config &mconfig, const char *tag, d void mm58167_device::device_start() { // allocate timers - m_clock_timer = timer_alloc(); + m_clock_timer = timer_alloc(FUNC(mm58167_device::clock_tick), this); m_clock_timer->adjust(attotime::from_hz(clock() / 32.768f), 0, attotime::from_hz(clock() / 32.768f)); - m_irq_w.resolve_safe(); - // state saving save_item(NAME(m_regs)); save_item(NAME(m_milliseconds)); @@ -94,10 +92,10 @@ void mm58167_device::device_reset() //------------------------------------------------- -// device_timer - handler timer events +// clock_tick - advance the RTC's registers //------------------------------------------------- -void mm58167_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_CALLBACK_MEMBER(mm58167_device::clock_tick) { m_milliseconds++; @@ -227,10 +225,14 @@ void mm58167_device::write(offs_t offset, uint8_t data) case R_CTL_RESETCOUNTERS: if (data == 0xff) { - for (int i = R_CNT_MILLISECONDS; i <= R_CNT_MONTH; i++) - { - m_regs[i] = 0; - } + m_regs[R_CNT_MILLISECONDS] = 0; + m_regs[R_CNT_HUNDTENTHS] = 0; + m_regs[R_CNT_SECONDS] = 0; + m_regs[R_CNT_MINUTES] = 0; + m_regs[R_CNT_HOURS] = 0; + m_regs[R_CNT_DAYOFWEEK] = 1; + m_regs[R_CNT_DAYOFMONTH] = 1; + m_regs[R_CNT_MONTH] = 1; update_rtc(); } @@ -247,10 +249,7 @@ void mm58167_device::write(offs_t offset, uint8_t data) break; case R_CTL_IRQCONTROL: - if (data != 0) - { - logerror("MM58167: IRQs not implemented\n"); - } + m_regs[R_CTL_IRQCONTROL]=data; break; } } |