summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/imagedev/mfmhd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/imagedev/mfmhd.cpp')
-rw-r--r--src/devices/imagedev/mfmhd.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/devices/imagedev/mfmhd.cpp b/src/devices/imagedev/mfmhd.cpp
index 635aef90605..ecb886676a0 100644
--- a/src/devices/imagedev/mfmhd.cpp
+++ b/src/devices/imagedev/mfmhd.cpp
@@ -832,7 +832,9 @@ bool mfm_harddisk_device::read(attotime &from_when, const attotime &limit, uint1
if (track==nullptr)
{
// What shall we do in this case?
- throw emu_fatalerror("Cannot read CHD image");
+ // throw emu_fatalerror("Cannot read CHD image"); // a bit too harsh, just return a constant 0
+ cdata = 0;
+ return false;
}
// Get a copy for later debug output
@@ -871,7 +873,8 @@ bool mfm_harddisk_device::write(attotime &from_when, const attotime &limit, uint
if (track==nullptr)
{
// What shall we do in this case?
- throw emu_fatalerror("Cannot read CHD image");
+ // throw emu_fatalerror("Cannot read CHD image"); // a bit too harsh, just return without doing anything
+ return false;
}
int bytepos = 0;
@@ -1152,6 +1155,11 @@ uint16_t* mfmhd_trackimage_cache::get_trackimage(int cylinder, int head)
// Then look it up again, which will move it to the front
// previous points to the second to last element
+
+ // If still null, the cache was never initialized, which means there is no drive image
+ if (previous == nullptr)
+ return nullptr;
+
current = previous->next;
if (TRACE_CACHE) m_machine.logerror("[%s:cache] evict line (c=%d,h=%d)\n", m_mfmhd->tag(), current->cylinder, current->head);