From 4ca87ba76ba441e2c93206d675b3aedc2d9ba8ca Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 26 Mar 2010 00:03:35 +0000 Subject: [PATCH] Re-disassemble and reset the start vector in the debugger if the disassembly doesn't result in the PC being present. This fixes some bugs in the more esoteric bankswitch schemes, and also enables rewind to show the correct disassembled results. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1972 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/CartDebug.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index f198c1f7e..93b5d5381 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -189,14 +189,15 @@ bool CartDebug::disassemble(const string& autocode, bool force) // Test current disassembly; don't re-disassemble if it hasn't changed // Also check if the current PC is in the current list uInt16 PC = myDebugger.cpuDebug().pc(); + int pcline = addressToLine(PC); bool changed = force || myConsole.cartridge().bankChanged() || - (addressToLine(PC) == -1); + (pcline == -1); if(changed) { // Look at previous accesses to this bank to begin // If no previous address exists, use the current program counter uInt16 start = myStartAddresses[getBank()]; - if(start == 0) + if(start == 0 || pcline == -1) start = myStartAddresses[getBank()] = PC; // For now, DiStella can't handle address space below 0x1000 @@ -215,9 +216,9 @@ cerr << "current bank = " << getBank() << ", start bank = " << myConsole.cartrid // Check whether to use the 'autocode' functionality from Distella if(autocode == "0") // 'never' fillDisassemblyList(start, false, PC); - else if(autocode == "1") // always + else if(autocode == "1") // 'always' fillDisassemblyList(start, true, PC); - else // automatic + else // 'automatic' { // First try with autocode on, then turn off if PC isn't found if(!fillDisassemblyList(start, true, PC))