From d2010860ef9c317f9d57533c2de606ff00b0b628 Mon Sep 17 00:00:00 2001 From: tomcw Date: Mon, 9 Dec 2019 21:00:58 +0000 Subject: [PATCH] Debugger: refactor common code into GetTargets_IgnoreDirectJSRJMP() --- source/Debugger/Debugger_Display.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index 223caec4..82ec980e 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -1341,6 +1341,11 @@ void DrawConsoleInput () // Disassembly ____________________________________________________________________________________ +void GetTargets_IgnoreDirectJSRJMP(const BYTE iOpcode, int& nTargetPointer) +{ + if (iOpcode == OPCODE_JSR || iOpcode == OPCODE_JMP_A) + nTargetPointer = NO_6502_TARGET; +} // Get the data needed to disassemble one line of opcodes. Fills in the DisasmLine info. // Disassembly formatting flags returned @@ -1525,15 +1530,8 @@ int GetDisassemblyLine ( WORD nBaseAddress, DisasmLine_t & line_ ) int nTargetPartial2; int nTargetPointer; WORD nTargetValue = 0; // de-ref - int nTargetBytes; - _6502_GetTargets( nBaseAddress, &nTargetPartial, &nTargetPartial2, &nTargetPointer, &nTargetBytes ); - - // For *direct* JSR/JMP, don't show 'addr16:byte char' - if (iOpcode == OPCODE_JSR || iOpcode == OPCODE_JMP_A) - { - nTargetPointer = NO_6502_TARGET; - nTargetBytes = 0; - } + _6502_GetTargets( nBaseAddress, &nTargetPartial, &nTargetPartial2, &nTargetPointer, NULL ); + GetTargets_IgnoreDirectJSRJMP(iOpcode, nTargetPointer); // For *direct* JSR/JMP, don't show 'addr16:byte char' if (nTargetPointer != NO_6502_TARGET) { @@ -1542,7 +1540,6 @@ int GetDisassemblyLine ( WORD nBaseAddress, DisasmLine_t & line_ ) nTargetValue = *(mem + nTargetPointer) | (*(mem + ((nTargetPointer + 1) & 0xffff)) << 8); // if (((iOpmode >= AM_A) && (iOpmode <= AM_NZ)) && (iOpmode != AM_R)) - // nTargetBytes refers to size of pointer, not size of value // sprintf( sTargetValue_, "%04X", nTargetValue ); // & 0xFFFF if (g_iConfigDisasmTargets & DISASM_TARGET_ADDR) @@ -3221,12 +3218,7 @@ void DrawTargets ( int line) int aTarget[3]; _6502_GetTargets( regs.pc, &aTarget[0],&aTarget[1],&aTarget[2], NULL ); - - const BYTE iOpcode = mem[regs.pc]; - if (iOpcode == OPCODE_JSR || iOpcode == OPCODE_JMP_A) - { - aTarget[2] = NO_6502_TARGET; - } + GetTargets_IgnoreDirectJSRJMP(mem[regs.pc], aTarget[2]); aTarget[1] = aTarget[2]; // Move down as we only have 2 lines