From 2bfe2358fb9d6b29830f4f9b71e91e76f4eca68c Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 1 Jan 2023 22:46:04 +0100 Subject: [PATCH] tms9900: fix crash at start --- src/devices/cpu/tms9900/tms9900.cpp | 4 ++-- src/devices/cpu/tms9900/tms9995.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/devices/cpu/tms9900/tms9900.cpp b/src/devices/cpu/tms9900/tms9900.cpp index 6f9ef5f7926..8c94a0662f8 100644 --- a/src/devices/cpu/tms9900/tms9900.cpp +++ b/src/devices/cpu/tms9900/tms9900.cpp @@ -341,7 +341,7 @@ void tms99xx_device::state_import(const device_state_entry &entry) break; default: // Workspace registers - if (index <= TMS9900_R15) + if (index <= TMS9900_R15 && started()) write_workspace_register_debug(index-TMS9900_R0, (uint16_t)m_state_any); break; } @@ -373,7 +373,7 @@ void tms99xx_device::state_export(const device_state_entry &entry) default: // Workspace registers if (index <= TMS9900_R15) - m_state_any = read_workspace_register_debug(index-TMS9900_R0); + m_state_any = started() ? read_workspace_register_debug(index-TMS9900_R0) : 0; break; } } diff --git a/src/devices/cpu/tms9900/tms9995.cpp b/src/devices/cpu/tms9900/tms9995.cpp index c1b07bcbc70..6cbb64a350c 100644 --- a/src/devices/cpu/tms9900/tms9995.cpp +++ b/src/devices/cpu/tms9900/tms9995.cpp @@ -339,7 +339,7 @@ void tms9995_device::state_import(const device_state_entry &entry) break; default: // Workspace registers - if (index <= TMS9995_R15) + if (index <= TMS9995_R15 && started()) write_workspace_register_debug(index-TMS9995_R0, (uint16_t)m_state_any); break; } @@ -371,7 +371,7 @@ void tms9995_device::state_export(const device_state_entry &entry) default: // Workspace registers if (index <= TMS9995_R15) - m_state_any = read_workspace_register_debug(index-TMS9995_R0); + m_state_any = started() ? read_workspace_register_debug(index-TMS9995_R0) : 0; break; } }