CPU: Stop emulation if CPU is deadlocked.

This commit is contained in:
BearOso 2024-04-27 17:44:21 -05:00
parent 986dd2a061
commit fdcff015dc
1 changed files with 8 additions and 0 deletions

View File

@ -143,6 +143,14 @@ void S9xMainLoop (void)
Op = CPU.PCBase[Registers.PCw]; Op = CPU.PCBase[Registers.PCw];
CPU.Cycles += CPU.MemSpeed; CPU.Cycles += CPU.MemSpeed;
Opcodes = ICPU.S9xOpcodes; Opcodes = ICPU.S9xOpcodes;
if (CPU.Cycles > 1000000)
{
Settings.StopEmulation = true;
CPU.Flags |= HALTED_FLAG;
S9xMessage(S9X_FATAL_ERROR, 0, "CPU is deadlocked");
return;
}
} }
else else
{ {