diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index 3e559a972..bbed933ea 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -102,8 +102,25 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, myAddressQueue.pop(); disasm(myPC, 1); if(myPCBeg <= myPCEnd) + { + // Tentatively mark all addresses in the range as CODE + // Note that this is a 'best-effort' approach, since + // Distella will normally keep going until the end of the + // range or branch is encountered + // However, addresses *specifically* marked as DATA/GFX/PGFX + // in the emulation core indicate that the CODE range has finished + // Therefore, we stop at the first such address encountered for (uInt32 k = myPCBeg; k <= myPCEnd; k++) + { + if(Debugger::debugger().getAddressDisasmType(k) & + (CartDebug::DATA|CartDebug::GFX|CartDebug::PGFX)) + { + myPCEnd = k - 1; + break; + } mark(k, CartDebug::CODE); + } + } // When we get to this point, all addresses have been processed // starting from the initial one in the address list diff --git a/src/emucore/M6502.ins b/src/emucore/M6502.ins index c60e2ab39..41623269d 100644 --- a/src/emucore/M6502.ins +++ b/src/emucore/M6502.ins @@ -14,7 +14,7 @@ // See the file "License.txt" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502.m4 2157 2010-10-21 21:01:00Z stephena $ +// $Id: M6502.m4 2158 2010-10-21 21:16:55Z stephena $ //============================================================================ /** @@ -24,7 +24,7 @@ 'm4 M6502.m4 > M6502.ins' @author Bradford W. Mott - @version $Id: M6502.m4 2157 2010-10-21 21:01:00Z stephena $ + @version $Id: M6502.m4 2158 2010-10-21 21:16:55Z stephena $ */ #ifndef NOTSAMEPAGE @@ -916,10 +916,10 @@ case 0x90: { if(!C) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } } @@ -933,10 +933,10 @@ case 0xb0: { if(C) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } } @@ -950,10 +950,10 @@ case 0xf0: { if(!notZ) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } } @@ -993,10 +993,10 @@ case 0x30: { if(N) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } } @@ -1010,10 +1010,10 @@ case 0xD0: { if(notZ) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } } @@ -1027,10 +1027,10 @@ case 0x10: { if(!N) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } } @@ -1062,10 +1062,10 @@ case 0x50: { if(!V) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } } @@ -1079,10 +1079,10 @@ case 0x70: { if(V) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } } diff --git a/src/emucore/M6502.m4 b/src/emucore/M6502.m4 index 1de77dfff..9d05aefff 100644 --- a/src/emucore/M6502.m4 +++ b/src/emucore/M6502.m4 @@ -268,10 +268,10 @@ define(M6502_INDIRECTY_READMODIFYWRITE, `{ define(M6502_BCC, `{ if(!C) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } }') @@ -279,10 +279,10 @@ define(M6502_BCC, `{ define(M6502_BCS, `{ if(C) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } }') @@ -290,10 +290,10 @@ define(M6502_BCS, `{ define(M6502_BEQ, `{ if(!notZ) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } }') @@ -301,10 +301,10 @@ define(M6502_BEQ, `{ define(M6502_BMI, `{ if(N) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } }') @@ -312,10 +312,10 @@ define(M6502_BMI, `{ define(M6502_BNE, `{ if(notZ) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } }') @@ -323,10 +323,10 @@ define(M6502_BNE, `{ define(M6502_BPL, `{ if(!N) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } }') @@ -334,10 +334,10 @@ define(M6502_BPL, `{ define(M6502_BVC, `{ if(!V) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } }') @@ -345,10 +345,10 @@ define(M6502_BVC, `{ define(M6502_BVS, `{ if(V) { - peek(PC, DISASM_DATA); + peek(PC, DISASM_NONE); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) - peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); + peek((PC & 0xFF00) | (address & 0x00FF), DISASM_NONE); PC = address; } }')