summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/mc146818.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/mc146818.cpp')
-rw-r--r--src/devices/machine/mc146818.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/devices/machine/mc146818.cpp b/src/devices/machine/mc146818.cpp
index 9166e189952..1b659a610a0 100644
--- a/src/devices/machine/mc146818.cpp
+++ b/src/devices/machine/mc146818.cpp
@@ -33,6 +33,7 @@ const device_type MC146818 = &device_creator<mc146818_device>;
mc146818_device::mc146818_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: device_t(mconfig, MC146818, "MC146818 RTC", tag, owner, clock, "mc146818", __FILE__),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_index(0),
m_last_refresh(attotime::zero), m_clock_timer(nullptr), m_periodic_timer(nullptr),
m_write_irq(*this),
@@ -48,6 +49,7 @@ mc146818_device::mc146818_device(const machine_config &mconfig, const char *tag,
mc146818_device::mc146818_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: device_t(mconfig, type, name, tag, owner, clock, shortname, source),
device_nvram_interface(mconfig, *this),
+ m_region(*this, DEVICE_SELF),
m_index(0),
m_last_refresh(attotime::zero), m_clock_timer(nullptr), m_periodic_timer(nullptr),
m_write_irq(*this),
@@ -193,14 +195,15 @@ void mc146818_device::device_timer(emu_timer &timer, device_timer_id id, int par
void mc146818_device::nvram_default()
{
// populate from a memory region if present
- if (m_region != nullptr)
+ memory_region *region = memregion(DEVICE_SELF);
+ if (region != nullptr)
{
- UINT32 bytes = m_region->bytes();
+ UINT32 bytes = region->bytes();
if (bytes > data_size())
bytes = data_size();
- memcpy(&m_data[0], m_region->base(), bytes);
+ memcpy(&m_data[0], region->base(), bytes);
}
else
{