Debugger: refactor common code into GetTargets_IgnoreDirectJSRJMP()

This commit is contained in:
tomcw 2019-12-09 21:00:58 +00:00
parent 87677ed4c3
commit d2010860ef
1 changed files with 8 additions and 16 deletions

View File

@ -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