diff options
Diffstat (limited to 'src/emu/machine/rtc4543.c')
-rw-r--r-- | src/emu/machine/rtc4543.c | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/src/emu/machine/rtc4543.c b/src/emu/machine/rtc4543.c index 7bd9ad32fd4..e77f5d42552 100644 --- a/src/emu/machine/rtc4543.c +++ b/src/emu/machine/rtc4543.c @@ -28,8 +28,8 @@ const device_type RTC4543 = &device_creator<rtc4543_device>; //------------------------------------------------- rtc4543_device::rtc4543_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : device_t(mconfig, RTC4543, "Epson R4543", tag, owner, clock), - device_rtc_interface(mconfig, *this) + : device_t(mconfig, RTC4543, "Epson R4543", tag, owner, clock), + device_rtc_interface(mconfig, *this) { } @@ -62,11 +62,11 @@ void rtc4543_device::device_reset() { set_current_time(machine()); - m_ce = 0; - m_wr = 0; - m_clk = 0; - m_data = 0; - m_curreg = 0; + m_ce = 0; + m_wr = 0; + m_clk = 0; + m_data = 0; + m_curreg = 0; } @@ -76,7 +76,7 @@ void rtc4543_device::device_reset() void rtc4543_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - advance_seconds(); + advance_seconds(); } @@ -93,16 +93,16 @@ void rtc4543_device::rtc_clock_updated(int year, int month, int day, int day_of_ { static const int weekday[7] = { 7, 1, 2, 3, 4, 5, 6 }; - m_regs[0] = make_bcd(second); // seconds (BCD, 0-59) in bits 0-6, bit 7 = battery low - m_regs[1] = make_bcd(minute); // minutes (BCD, 0-59) - m_regs[2] = make_bcd(hour); // hour (BCD, 0-23) - m_regs[3] = make_bcd(weekday[day_of_week-1]); // low nibble = day of the week - m_regs[3] |= (make_bcd(day) & 0x0f)<<4; // high nibble = low digit of day - m_regs[4] = (make_bcd(day) >> 4); // low nibble = high digit of day - m_regs[4] |= (make_bcd(month & 0x0f)<<4); // high nibble = low digit of month - m_regs[5] = make_bcd(month & 0x0f) >> 4; // low nibble = high digit of month - m_regs[5] |= (make_bcd(year % 10) << 4); // high nibble = low digit of year - m_regs[6] = make_bcd(year % 100) >> 4; // low nibble = tens digit of year (BCD, 0-9) + m_regs[0] = make_bcd(second); // seconds (BCD, 0-59) in bits 0-6, bit 7 = battery low + m_regs[1] = make_bcd(minute); // minutes (BCD, 0-59) + m_regs[2] = make_bcd(hour); // hour (BCD, 0-23) + m_regs[3] = make_bcd(weekday[day_of_week-1]); // low nibble = day of the week + m_regs[3] |= (make_bcd(day) & 0x0f)<<4; // high nibble = low digit of day + m_regs[4] = (make_bcd(day) >> 4); // low nibble = high digit of day + m_regs[4] |= (make_bcd(month & 0x0f)<<4); // high nibble = low digit of month + m_regs[5] = make_bcd(month & 0x0f) >> 4; // low nibble = high digit of month + m_regs[5] |= (make_bcd(year % 10) << 4); // high nibble = low digit of year + m_regs[6] = make_bcd(year % 100) >> 4; // low nibble = tens digit of year (BCD, 0-9) } //------------------------------------------------- @@ -118,8 +118,8 @@ WRITE_LINE_MEMBER( rtc4543_device::ce_w ) } else if (state && !m_ce) // start new data transfer { - m_curreg = 0; - m_bit = 8; // force immediate reload of output data + m_curreg = 0; + m_bit = 8; // force immediate reload of output data } m_ce = state; @@ -148,17 +148,17 @@ WRITE_LINE_MEMBER( rtc4543_device::clk_w ) if (!m_clk && state) // rising edge - read data becomes valid here { - if (m_bit > 7) // reload data? - { - m_bit = 0; - m_data = m_regs[m_curreg++]; - } - else // no reload, just continue with the current byte - { - m_data <<= 1; - } - - m_bit++; + if (m_bit > 7) // reload data? + { + m_bit = 0; + m_data = m_regs[m_curreg++]; + } + else // no reload, just continue with the current byte + { + m_data <<= 1; + } + + m_bit++; } else if (m_clk && !state) // falling edge - write data becomes valid here { @@ -188,4 +188,3 @@ READ_LINE_MEMBER( rtc4543_device::data_r ) { return (m_data & 0x80) ? 1 : 0; } - |