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

View File

@ -1341,6 +1341,11 @@ void DrawConsoleInput ()
// Disassembly ____________________________________________________________________________________ // 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. // Get the data needed to disassemble one line of opcodes. Fills in the DisasmLine info.
// Disassembly formatting flags returned // Disassembly formatting flags returned
@ -1525,15 +1530,8 @@ int GetDisassemblyLine ( WORD nBaseAddress, DisasmLine_t & line_ )
int nTargetPartial2; int nTargetPartial2;
int nTargetPointer; int nTargetPointer;
WORD nTargetValue = 0; // de-ref WORD nTargetValue = 0; // de-ref
int nTargetBytes; _6502_GetTargets( nBaseAddress, &nTargetPartial, &nTargetPartial2, &nTargetPointer, NULL );
_6502_GetTargets( nBaseAddress, &nTargetPartial, &nTargetPartial2, &nTargetPointer, &nTargetBytes ); GetTargets_IgnoreDirectJSRJMP(iOpcode, nTargetPointer); // For *direct* JSR/JMP, don't show 'addr16:byte char'
// For *direct* JSR/JMP, don't show 'addr16:byte char'
if (iOpcode == OPCODE_JSR || iOpcode == OPCODE_JMP_A)
{
nTargetPointer = NO_6502_TARGET;
nTargetBytes = 0;
}
if (nTargetPointer != NO_6502_TARGET) if (nTargetPointer != NO_6502_TARGET)
{ {
@ -1542,7 +1540,6 @@ int GetDisassemblyLine ( WORD nBaseAddress, DisasmLine_t & line_ )
nTargetValue = *(mem + nTargetPointer) | (*(mem + ((nTargetPointer + 1) & 0xffff)) << 8); nTargetValue = *(mem + nTargetPointer) | (*(mem + ((nTargetPointer + 1) & 0xffff)) << 8);
// if (((iOpmode >= AM_A) && (iOpmode <= AM_NZ)) && (iOpmode != AM_R)) // 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 // sprintf( sTargetValue_, "%04X", nTargetValue ); // & 0xFFFF
if (g_iConfigDisasmTargets & DISASM_TARGET_ADDR) if (g_iConfigDisasmTargets & DISASM_TARGET_ADDR)
@ -3221,12 +3218,7 @@ void DrawTargets ( int line)
int aTarget[3]; int aTarget[3];
_6502_GetTargets( regs.pc, &aTarget[0],&aTarget[1],&aTarget[2], NULL ); _6502_GetTargets( regs.pc, &aTarget[0],&aTarget[1],&aTarget[2], NULL );
GetTargets_IgnoreDirectJSRJMP(mem[regs.pc], aTarget[2]);
const BYTE iOpcode = mem[regs.pc];
if (iOpcode == OPCODE_JSR || iOpcode == OPCODE_JMP_A)
{
aTarget[2] = NO_6502_TARGET;
}
aTarget[1] = aTarget[2]; // Move down as we only have 2 lines aTarget[1] = aTarget[2]; // Move down as we only have 2 lines