diff options
author | 2021-06-01 18:22:39 -0400 | |
---|---|---|
committer | 2021-06-01 18:22:39 -0400 | |
commit | 7a262b51b69d06c96b165ca23e50b565bfa38054 (patch) | |
tree | 99f26bf779c5d97304638387afa61abed20fcfbe /src/devices/machine/rtc65271.cpp | |
parent | 57ea2eb1b51bf938171f193de65852c5b76a9526 (diff) | |
parent | 32fbe7135f0bc08ec881457d6c7988ed43b2e697 (diff) |
Merge pull request #8016 from 987123879113/add_default_nvram_rtc65271
rtc65271, firebeat: Add way to use default data for nvram initialization
Diffstat (limited to 'src/devices/machine/rtc65271.cpp')
-rw-r--r-- | src/devices/machine/rtc65271.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/devices/machine/rtc65271.cpp b/src/devices/machine/rtc65271.cpp index 1eb84d89171..b39730fb372 100644 --- a/src/devices/machine/rtc65271.cpp +++ b/src/devices/machine/rtc65271.cpp @@ -162,10 +162,18 @@ static uint8_t BCD_to_binary(uint8_t data) void rtc65271_device::nvram_default() { - memset(m_regs,0, sizeof(m_regs)); - memset(m_xram,0, sizeof(m_xram)); - - m_regs[reg_B] |= reg_B_DM; // Firebeat assumes the chip factory defaults to non-BCD mode (or maybe Konami programs it that way?) + if (m_default_data.found()) + { + emu_file file(OPEN_FLAG_READ); + file.open_ram(m_default_data, m_default_data.bytes()); + nvram_read(file); + } + else + { + memset(m_regs, 0, sizeof(m_regs)); + memset(m_xram, 0, sizeof(m_xram)); + m_regs[reg_B] |= reg_B_DM; // Firebeat assumes the chip factory defaults to non-BCD mode (or maybe Konami programs it that way?) + } } //------------------------------------------------- @@ -660,6 +668,7 @@ rtc65271_device::rtc65271_device(const machine_config &mconfig, const char *tag, : device_t(mconfig, RTC65271, tag, owner, clock) , device_nvram_interface(mconfig, *this) , m_interrupt_cb(*this) + , m_default_data(*this, DEVICE_SELF) { } |