diff --git a/Core/Console.cpp b/Core/Console.cpp index d5565ab..d21587b 100644 --- a/Core/Console.cpp +++ b/Core/Console.cpp @@ -566,7 +566,7 @@ void Console::PauseOnNextFrame() shared_ptr debugger = _debugger; if(debugger) { if(_settings->CheckFlag(EmulationFlags::GameboyMode)) { - debugger->Step(CpuType::Cpu, 144, StepType::SpecificScanline); + debugger->Step(CpuType::Gameboy, 144, StepType::SpecificScanline); } else { debugger->Step(CpuType::Cpu, 240, StepType::SpecificScanline); } diff --git a/Core/CpuDebugger.cpp b/Core/CpuDebugger.cpp index 37b6415..4245259 100644 --- a/Core/CpuDebugger.cpp +++ b/Core/CpuDebugger.cpp @@ -188,7 +188,7 @@ void CpuDebugger::Step(int32_t stepCount, StepType type) StepRequest step; if((type == StepType::StepOver || type == StepType::StepOut || type == StepType::Step) && GetState().StopState == CpuStopState::Stopped) { //If STP was called, the CPU isn't running anymore - use the PPU to break execution instead (useful for test roms that end with STP) - _debugger->Step(_cpuType, 1, StepType::PpuStep); + step.PpuStepCount = 1; } else { switch(type) { case StepType::Step: step.StepCount = stepCount; break; @@ -203,8 +203,8 @@ void CpuDebugger::Step(int32_t stepCount, StepType type) } break; - case StepType::PpuStep: step.PpuStepCount = stepCount; _step.reset(new StepRequest(step)); break; - case StepType::SpecificScanline: step.BreakScanline = stepCount; _step.reset(new StepRequest(step)); break; + case StepType::PpuStep: step.PpuStepCount = stepCount; break; + case StepType::SpecificScanline: step.BreakScanline = stepCount; break; } } _step.reset(new StepRequest(step)); diff --git a/Core/GbDebugger.cpp b/Core/GbDebugger.cpp index 8b98d63..9fc5d56 100644 --- a/Core/GbDebugger.cpp +++ b/Core/GbDebugger.cpp @@ -183,22 +183,27 @@ void GbDebugger::Step(int32_t stepCount, StepType type) { StepRequest step; - switch(type) { - case StepType::Step: step.StepCount = stepCount; break; - case StepType::StepOut: step.BreakAddress = _callstackManager->GetReturnAddress(); break; - case StepType::StepOver: - if(GameboyDisUtils::IsJumpToSub(_prevOpCode)) { - step.BreakAddress = _prevProgramCounter + DisassemblyInfo::GetOpSize(_prevOpCode, 0, CpuType::Gameboy); - } else { - //For any other instruction, step over is the same as step into - step.StepCount = 1; - } - break; + GbCpuState gbState = _gameboy->GetState().Cpu; + if((type == StepType::StepOver || type == StepType::StepOut || type == StepType::Step) && gbState.Halted) { + //CPU isn't running - use the PPU to break execution instead + step.PpuStepCount = 1; + } else { + switch(type) { + case StepType::Step: step.StepCount = stepCount; break; + case StepType::StepOut: step.BreakAddress = _callstackManager->GetReturnAddress(); break; + case StepType::StepOver: + if(GameboyDisUtils::IsJumpToSub(_prevOpCode)) { + step.BreakAddress = _prevProgramCounter + DisassemblyInfo::GetOpSize(_prevOpCode, 0, CpuType::Gameboy); + } else { + //For any other instruction, step over is the same as step into + step.StepCount = 1; + } + break; - case StepType::PpuStep: step.PpuStepCount = stepCount; _step.reset(new StepRequest(step)); break; - case StepType::SpecificScanline: step.BreakScanline = stepCount; _step.reset(new StepRequest(step)); break; + case StepType::PpuStep: step.PpuStepCount = stepCount; break; + case StepType::SpecificScanline: step.BreakScanline = stepCount; break; + } } - _step.reset(new StepRequest(step)); }