* Tracer: only output "from $XXXX" when the subroutine was called by JSR (fixes possible errors in those cases when the subroutine was called using stack magic)

This commit is contained in:
ansstuff 2013-07-03 13:20:04 +00:00
parent 4a9a8f9bdd
commit 440550a02d
1 changed files with 7 additions and 3 deletions

View File

@ -411,10 +411,14 @@ void FCEUD_TraceInstruction(uint8 *opcode, int size)
{
// add the beginning address of the subroutine that we exit from
unsigned int caller_addr = GetMem(((X.S) + 1)|0x0100) + (GetMem(((X.S) + 2)|0x0100) << 8) - 0x2;
if (GetMem(caller_addr) == 0x20)
{
// this was a JSR instruction - take the subroutine address from it
unsigned int call_addr = GetMem(caller_addr + 1) + (GetMem(caller_addr + 2) << 8);
sprintf(str_decoration, " (from $%04X)", call_addr);
strcat(a, str_decoration);
}
}
break;
}
case 2: