From 028c041175d0d2df26168780e09d2482265f6265 Mon Sep 17 00:00:00 2001 From: tomcw Date: Fri, 15 Oct 2021 20:36:04 +0100 Subject: [PATCH] Debugger: fix for 6502 JMP (ABS) - compute correct NMOS target address --- source/Debugger/Debugger_Assembler.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/Debugger/Debugger_Assembler.cpp b/source/Debugger/Debugger_Assembler.cpp index dd84244f..c86483e1 100644 --- a/source/Debugger/Debugger_Assembler.cpp +++ b/source/Debugger/Debugger_Assembler.cpp @@ -703,9 +703,11 @@ bool _6502_GetTargets ( WORD nAddress, int *pTargetPartial_, int *pTargetPartial case AM_NA: // Indirect (Absolute) - ie. JMP (abs) _ASSERT(nOpcode == OPCODE_JMP_NA); *pTargetPartial_ = nTarget16; - *pTargetPartial2_ = nTarget16+1; + *pTargetPartial2_ = (nTarget16+1) & _6502_MEM_END; + if (GetMainCpu() == CPU_6502 && (nTarget16 & 0xff) == 0xff) + *pTargetPartial2_ = nTarget16 & 0xff00; if (bIncludeNextOpcodeAddress) - *pTargetPointer_ = mem[nTarget16] | (mem[(nTarget16+1)&0xFFFF]<<8); + *pTargetPointer_ = mem[*pTargetPartial_] | (mem[*pTargetPartial2_] << 8); if (pTargetBytes_) *pTargetBytes_ = 2; break;