feat: Implement Deadlock Detection and Improve Emulator Shutdown Logging

- Added deadlock detection in the emulator's main loop to identify when the CPU is stuck, enhancing debugging capabilities.
- Updated logging during emulator shutdown to provide clearer status messages, including final CPU state and resource cleanup.
- Refactored audio and texture cleanup processes to ensure proper resource management during shutdown.
This commit is contained in:
scawful
2025-10-06 15:21:48 -04:00
parent 673201e4fd
commit a09d7d10c8
3 changed files with 47 additions and 15 deletions

View File

@@ -1106,11 +1106,14 @@ void Spc700::ExecuteInstructions(uint8_t opcode) {
break;
}
case 0xcb: { // movsy dp
uint16_t addr = dp();
if (addr == 0x00F4) {
// CRITICAL: Only call dp() once in bstep=0, reuse saved address in bstep=1
if (bstep == 0) {
adr = dp(); // Save address for bstep=1
}
if (adr == 0x00F4 && bstep == 1) {
LOG_INFO("SPC", "MOVSY writing Y=$%02X to F4 at PC=$%04X", Y, PC);
}
MOVSY(addr);
MOVSY(adr); // Use saved address
break;
}
case 0xcc: { // movsy abs