Skip to content

Commit

Permalink
Debugger: SNES - Fixed effective address display for indirect JMP
Browse files Browse the repository at this point in the history
Effective address always had the upper 8 bits of the address as 0 instead of using the current value of K
  • Loading branch information
SourMesen committed Nov 29, 2023
1 parent 9e1bde6 commit 3c94fe6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Core/SNES/Debugger/SnesDisUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ EffectiveAddressInfo SnesDisUtils::GetEffectiveAddress(DisassemblyInfo &info, Sn
if(isJump) {
if(info.GetOpSize() == 3) {
//For 3-byte jumps, return the target address, and show no value
return { dummyCpu.GetLastOperand(), 0, true };
if(SnesDisUtils::IsUnconditionalJump(info.GetOpCode())) {
//Display the dummy cpu's current address - this allows indirect jumps to display the correct address based on K
return { (dummyCpu.GetState().K << 16) | dummyCpu.GetState().PC, 0, true };
} else {
return { dummyCpu.GetLastOperand(), 0, true };
}
} else {
//Relative or long jumps already show the final address in the disassembly, show nothing
return {};
Expand Down

0 comments on commit 3c94fe6

Please sign in to comment.