diff options
Diffstat (limited to 'src/devices/bus/ti99/peb/horizon.cpp')
-rw-r--r-- | src/devices/bus/ti99/peb/horizon.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/devices/bus/ti99/peb/horizon.cpp b/src/devices/bus/ti99/peb/horizon.cpp index e335389220d..e0e226f646b 100644 --- a/src/devices/bus/ti99/peb/horizon.cpp +++ b/src/devices/bus/ti99/peb/horizon.cpp @@ -167,6 +167,7 @@ horizon_ramdisk_device::horizon_ramdisk_device(const machine_config &mconfig, co m_phoenix_split(false), m_hideswitch(false), m_rambo_supported(false), + m_modified(false), m_page(0), m_bank(0), m_ramsize(0), @@ -304,7 +305,10 @@ void horizon_ramdisk_device::read_write(offs_t offset, uint8_t *value, bool writ if (ramaddress < m_ramsize) { if (write) + { + m_modified = true; m_ram->write(ramaddress, *value); + } else *value = m_ram->read(ramaddress); @@ -451,6 +455,9 @@ void horizon_ramdisk_device::nvram_read(emu_file &file) int ramsize, dsrsize; get_mem_size(ramsize, dsrsize); + if (file.size() != ramsize + dsrsize) + LOGMASKED(LOG_WARN, "NVRAM file size (%d) does not match the current configuration. Check settings.\n", file.size()); + // NVRAM plus ROS, according to the current configuration auto buffer = make_unique_clear<uint8_t []>(ramsize + dsrsize); @@ -486,6 +493,15 @@ void horizon_ramdisk_device::nvram_write(emu_file &file) file.write(buffer.get(), ramsize + dsrsize); } +bool horizon_ramdisk_device::nvram_can_write() +{ + // Do not save if nothing was written. This is helpful to avoid loss of the + // contents when the settings were found to be different, and the emulation + // has to be restarted after restoring the settings. + return m_modified; +} + + void horizon_ramdisk_device::get_mem_size(int& ramsize, int& dsrsize) { int chipsize = 128*1024*((ioport("CHIPTYPE")->read()*3)+1); |