From b76b3922aa6eb49fe35a85e7689bd1d709bbcaee Mon Sep 17 00:00:00 2001 From: Nigel Barnes Date: Mon, 12 Aug 2024 22:19:22 +0100 Subject: machine/mc146818.cpp: Implemented Valid RAM and Time (VRT) register. --- src/devices/machine/mc146818.cpp | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/devices/machine/mc146818.cpp b/src/devices/machine/mc146818.cpp index ae03165b819..2937e869218 100644 --- a/src/devices/machine/mc146818.cpp +++ b/src/devices/machine/mc146818.cpp @@ -56,22 +56,22 @@ ds1397_device::ds1397_device(const machine_config &mconfig, const char *tag, dev } mc146818_device::mc146818_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, type, tag, owner, clock), - device_nvram_interface(mconfig, *this), - device_rtc_interface(mconfig, *this), - m_region(*this, DEVICE_SELF), - m_index(0), - m_clock_timer(nullptr), - m_update_timer(nullptr), - m_periodic_timer(nullptr), - m_write_irq(*this), - m_write_sqw(*this), - m_century_index(-1), - m_epoch(0), - m_binary(false), - m_hour(false), - m_sqw_state(false), - m_tuc(0) + : device_t(mconfig, type, tag, owner, clock) + , device_nvram_interface(mconfig, *this) + , device_rtc_interface(mconfig, *this) + , m_region(*this, DEVICE_SELF) + , m_index(0) + , m_clock_timer(nullptr) + , m_update_timer(nullptr) + , m_periodic_timer(nullptr) + , m_write_irq(*this) + , m_write_sqw(*this) + , m_century_index(-1) + , m_epoch(0) + , m_binary(false) + , m_hour(false) + , m_sqw_state(false) + , m_tuc(0) { } @@ -256,6 +256,7 @@ void mc146818_device::nvram_default() bytes = data_size(); memcpy(&m_data[0], m_region->base(), bytes); + m_data[REG_D] |= REG_D_VRT; } else { @@ -284,6 +285,8 @@ bool mc146818_device::nvram_read(util::read_stream &file) if (err || (actual != size)) return false; + m_data[REG_D] |= REG_D_VRT; + update_timer(); update_irq(); @@ -663,8 +666,9 @@ uint8_t mc146818_device::internal_read(offs_t offset) break; case REG_D: - /* battery ok */ - data = m_data[REG_D] | REG_D_VRT; + data = m_data[REG_D]; + // valid RAM and time + m_data[REG_D] |= REG_D_VRT; break; default: -- cgit v1.2.3