From 640927b1c68b7bbddb5283cfa9717c11dc5c9b6c Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 17 May 2013 01:05:50 +0000 Subject: [PATCH] The debugger disassembly (both in the ROM view and the prompt) and the listconfig command are now synchronized, and produce the same output. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2736 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/CartDebug.cxx | 29 ++++++----------------------- src/debugger/DiStella.cxx | 14 +++++++++++++- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index ab7e0040f..5ba0b9a2e 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -339,33 +339,16 @@ int CartDebug::addressToLine(uInt16 address) const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string CartDebug::disassemble(uInt16 start, uInt16 lines) const { - Disassembly disasm; - - BankInfo info; - info.addressList.push_back(start); - if(start & 0x1000) - { - int banksize = 0; - myConsole.cartridge().getImage(banksize); - info.size = BSPF_min(banksize, 4096); - } - else - info.size = 128; - - DiStella distella(*this, disasm.list, info, DiStella::settings, - (uInt8*)myDisLabels, (uInt8*)myDisDirectives, - (ReservedEquates&)myReserved, false); - // Fill the string with disassembled data start &= 0xFFF; ostringstream buffer; // First find the lines in the range, and determine the longest string - uInt32 list_size = disasm.list.size(); + uInt32 list_size = myDisassembly.list.size(); uInt32 begin = list_size, end = 0, length = 0; for(end = 0; end < list_size && lines > 0; ++end) { - const CartDebug::DisassemblyTag& tag = disasm.list[end]; + const CartDebug::DisassemblyTag& tag = myDisassembly.list[end]; if((tag.address & 0xfff) >= start) { if(begin == list_size) begin = end; @@ -379,7 +362,7 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const // Now output the disassembly, using as little space as possible for(uInt32 i = begin; i < end; ++i) { - const CartDebug::DisassemblyTag& tag = disasm.list[i]; + const CartDebug::DisassemblyTag& tag = myDisassembly.list[i]; if(tag.type == CartDebug::NONE) continue; else if(tag.address) @@ -388,9 +371,9 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const else buffer << " "; - buffer << tag.disasm << setw(length - tag.disasm.length() + 1) + buffer << tag.disasm << setw(length - tag.disasm.length() + 2) << setfill(' ') << " " - << tag.ccount << " " << tag.bytes << endl; + << setw(4) << left << tag.ccount << " " << tag.bytes << endl; } return buffer.str(); @@ -1181,7 +1164,7 @@ CartDebug::DisasmType CartDebug::disasmTypeAbsolute(uInt8 flags) const if(flags & CartDebug::CODE) return CartDebug::CODE; else if(flags & CartDebug::PCODE) - return CartDebug::PCODE; + return CartDebug::CODE; // TODO - should this be separate?? else if(flags & CartDebug::GFX) return CartDebug::GFX; else if(flags & CartDebug::PGFX) diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index b89d65942..3c91cb3c0 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -175,6 +175,15 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, } for (int k = 0; k <= myAppData.end; k++) { + // Let the emulation core know about preliminary code + if(check_bit(k, CartDebug::CODE) && + !(Debugger::debugger().getAccessFlags(k+myOffset) & CartDebug::CODE) + && myOffset != 0) + { + Debugger::debugger().setAccessFlags(k+myOffset, CartDebug::PCODE); + } + + // Must be ROW / unused bytes if (!check_bit(k, CartDebug::CODE | CartDebug::GFX | CartDebug::PGFX | CartDebug::DATA)) mark(k+myOffset, CartDebug::ROW); @@ -1020,8 +1029,11 @@ void DiStella::addEntry(CartDebug::DisasmType type) // Since it is impossible to tell the difference, marking the address // in the disassembly at least tells the user about it if(!(Debugger::debugger().getAccessFlags(tag.address) & CartDebug::CODE) - && myAppData.length >= 4096) + && myOffset != 0) + { tag.ccount += " *"; + Debugger::debugger().setAccessFlags(tag.address, CartDebug::PCODE); + } break; case CartDebug::GFX: case CartDebug::PGFX: