minx: don't crash mame on divide by 0

This commit is contained in:
hap 2025-03-30 14:44:55 +02:00
parent 8ca4fcbbf9
commit 04edb1b554
2 changed files with 2 additions and 2 deletions

View File

@ -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.
*/

View File

@ -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;