rtc_clock_updated day_of_week is 1-7 (fix wrong day shown, and possible array out of bounds access)

This commit is contained in:
Michaël Banaan Ananas 2012-12-21 23:03:35 +00:00
parent c9c27a89bc
commit b51b6898e7

View File

@ -96,7 +96,7 @@ void rtc4543_device::rtc_clock_updated(int year, int month, int day, int day_of_
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]); // low nibble = day of the week
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