diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 4c12c51c..f4205905 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -1127,7 +1127,10 @@ int CheckBreakpointsIO () int iTarget; int nAddress; - _6502_GetTargets( regs.pc, &aTarget[0], &aTarget[1], &aTarget[2], &nBytes, false ); + // bIgnoreNextOpcodeAddress = true: + // . JSR addr16: ignore addr16 as a target + // . RTS/RTI : ignore return as a target + _6502_GetTargets( regs.pc, &aTarget[0], &aTarget[1], &aTarget[2], &nBytes, true, true, true ); if (nBytes) { diff --git a/source/Debugger/Debugger_Assembler.cpp b/source/Debugger/Debugger_Assembler.cpp index 350fa207..2a292e66 100644 --- a/source/Debugger/Debugger_Assembler.cpp +++ b/source/Debugger/Debugger_Assembler.cpp @@ -583,7 +583,8 @@ bool _6502_GetStackReturnAddress ( WORD & nAddress_ ) //=========================================================================== -bool _6502_GetTargets ( WORD nAddress, int *pTargetPartial_, int *pTargetPartial2_, int *pTargetPointer_, int * pTargetBytes_, bool bIgnoreJSRJMP, bool bIgnoreBranch ) +bool _6502_GetTargets ( WORD nAddress, int *pTargetPartial_, int *pTargetPartial2_, int *pTargetPointer_, int * pTargetBytes_, + bool bIgnoreJSRJMP /*= true*/, bool bIgnoreBranch /*= true*/, bool bIgnoreNextOpcodeAddress /*= false*/ ) { bool bStatus = false; @@ -782,6 +783,13 @@ bool _6502_GetTargets ( WORD nAddress, int *pTargetPartial_, int *pTargetPartial *pTargetBytes_ = 0; } } + + if (bIgnoreNextOpcodeAddress) + { + *pTargetPointer_ = NO_6502_TARGET; + if (pTargetBytes_) + *pTargetBytes_ = 0; + } return bStatus; } diff --git a/source/Debugger/Debugger_Assembler.h b/source/Debugger/Debugger_Assembler.h index 61391901..c4976d1b 100644 --- a/source/Debugger/Debugger_Assembler.h +++ b/source/Debugger/Debugger_Assembler.h @@ -194,7 +194,7 @@ extern int g_aAssemblerFirstDirective[ NUM_ASSEMBLERS ]; void _6502_GetOpcodeOpmodeOpbyte( int & iOpcode_, int & iOpmode_, int & nOpbytes_ ); bool _6502_GetStackReturnAddress( WORD & nAddress_ ); bool _6502_GetTargets( WORD nAddress, int *pTargetPartial_, int *pTargetPartial2_, int *pTargetPointer_, int * pBytes_ - , const bool bIgnoreJSRJMP = true, bool bIgnoreBranch = true ); + , const bool bIgnoreJSRJMP = true, bool bIgnoreBranch = true, bool bIgnoreNextOpcodeAddress = false ); bool _6502_GetTargetAddress( const WORD & nAddress, WORD & nTarget_ ); bool _6502_IsOpcodeBranch( int nOpcode ); bool _6502_IsOpcodeValid( int nOpcode );