Skip to content

Commit

Permalink
Debugger: SPC - Add TCALL and PCALL opcodes to list of subroutine opc…
Browse files Browse the repository at this point in the history
…odes in SPC debugger (#20)
  • Loading branch information
KungFuFurby committed May 13, 2023
1 parent c926397 commit 8a08187
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Core/SNES/Debugger/SpcDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void SpcDebugger::ProcessInstruction()
_disassembler->BuildCache(addressInfo, 0, CpuType::Spc);

if(SpcDisUtils::IsJumpToSub(_prevOpCode)) {
//JSR, BRK
//JSR, BRK, PCALL, TCALL
uint8_t opSize = SpcDisUtils::GetOpSize(_prevOpCode);
uint16_t returnPc = _prevProgramCounter + opSize;
AddressInfo src = _spc->GetAbsoluteAddress(_prevProgramCounter);
Expand Down Expand Up @@ -185,8 +185,8 @@ void SpcDebugger::Step(int32_t stepCount, StepType type)
case StepType::Step: step.StepCount = stepCount; break;
case StepType::StepOut: step.BreakAddress = _callstackManager->GetReturnAddress(); break;
case StepType::StepOver:
if(_prevOpCode == 0x3F || _prevOpCode == 0x0F) {
//JSR, BRK
if(_prevOpCode == 0x3F || _prevOpCode == 0x0F || _prevOpCode == 0x4F || (_prevOpCode&0x0F) == 0x01) {
//JSR, BRK, PCALL, TCALL
step.BreakAddress = _prevProgramCounter + SpcDisUtils::GetOpSize(_prevOpCode);
} else {
//For any other instruction, step over is the same as step into
Expand Down
2 changes: 1 addition & 1 deletion Core/SNES/Debugger/SpcDisUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ bool SpcDisUtils::IsConditionalJump(uint8_t opCode)

bool SpcDisUtils::IsJumpToSub(uint8_t opCode)
{
return opCode == 0x3F || opCode == 0x0F; //JSR, BRK
return opCode == 0x3F || opCode == 0x0F || opCode == 0x4F || (opCode&0x0F) == 0x01; //JSR, BRK, PCALL, TCALL
}

bool SpcDisUtils::IsReturnInstruction(uint8_t opCode)
Expand Down

0 comments on commit 8a08187

Please sign in to comment.