summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/minx
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2025-03-30 14:44:55 +0200
committer hap <happppp@users.noreply.github.com>2025-03-30 14:44:55 +0200
commit04edb1b5543d7b961f51b96bdb6a3ee3be91465b (patch)
tree0091a8c416e31b90a0f3cf47d6c66f3f6abd7924 /src/devices/cpu/minx
parent8ca4fcbbf9896ae1afa1ec397d17a6a23081bdc0 (diff)
minx: don't crash mame on divide by 0
Diffstat (limited to 'src/devices/cpu/minx')
-rw-r--r--src/devices/cpu/minx/minx.cpp2
-rw-r--r--src/devices/cpu/minx/minxopce.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/devices/cpu/minx/minx.cpp b/src/devices/cpu/minx/minx.cpp
index 436cbf038ea..59c47039f13 100644
--- a/src/devices/cpu/minx/minx.cpp
+++ b/src/devices/cpu/minx/minx.cpp
@@ -41,7 +41,7 @@ TODO:
- Add support for O and C flags in NEG8 instruction
- Verify MUL (CE D8) and DIV (CE D9)
- Doublecheck behaviour of CMPN instructions ( CF 60 .. CF 63 )
-- DIV (CE D9) division by zero handling - is supposed to raise a EX4 exception. A real Pokemini unit will freeze. MAME currently will crash.
+- DIV (CE D9) division by zero handling - is supposed to raise a EX4 exception. A real Pokemini unit will freeze.
*/
diff --git a/src/devices/cpu/minx/minxopce.h b/src/devices/cpu/minx/minxopce.h
index ee322d668cb..f792e7898fa 100644
--- a/src/devices/cpu/minx/minxopce.h
+++ b/src/devices/cpu/minx/minxopce.h
@@ -454,7 +454,7 @@ void minx_cpu_device::execute_one_ce()
break;
case 0xD8: { m_HL = ( m_HL & 0x00FF ) * ( m_BA & 0x00FF ); }
break;
- case 0xD9: { int d = m_HL / ( m_BA & 0x00FF ); m_HL = ( ( m_HL - ( ( m_BA & 0x00FF ) * d ) ) << 8 ) | d; }
+ case 0xD9: { if ( m_BA & 0x00FF ) { int d = m_HL / ( m_BA & 0x00FF ); m_HL = ( ( m_HL - ( ( m_BA & 0x00FF ) * d ) ) << 8 ) | d; } }
break;
case 0xDA: { /* illegal operation? */ }
break;