diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index cf1475974..fb1d780f9 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -27,7 +27,8 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartDebug::CartDebug(Debugger& dbg, Console& console, const RamAreaList& areas) : DebuggerSystem(dbg, console), - myRWPortAddress(0) + myRWPortAddress(0), + myLabelLength(6) // longest pre-defined label { // Zero-page RAM is always present addRamArea(0x80, 128, 0, 0); @@ -252,7 +253,7 @@ bool CartDebug::fillDisassemblyList(uInt16 start, bool resolvedata, uInt16 searc bool found = false; myDisassembly.clear(); - DiStella distella(myDisassembly, start, resolvedata); + DiStella distella(myDisassembly, start, resolvedata, myLabelLength); // Parts of the disassembly will be accessed later in different ways // We place those parts in separate maps, to speed up access @@ -336,6 +337,8 @@ bool CartDebug::addLabel(const string& label, uInt16 address) removeLabel(label); myUserAddresses.insert(make_pair(label, address)); myUserLabels.insert(make_pair(address, label)); + myLabelLength = BSPF_max(myLabelLength, (uInt16)label.size()); + mySystem.setDirtyPage(address); return true; } } diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index 6426d97e0..74930282a 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -240,6 +240,9 @@ class CartDebug : public DebuggerSystem // occurred uInt16 myRWPortAddress; + // The maximum length of all labels currently defined + uInt16 myLabelLength; + /// Table of instruction mnemonics static const char* ourTIAMnemonicR[16]; // read mode static const char* ourTIAMnemonicW[64]; // write mode diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index 58580ed6c..10947241c 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -23,7 +23,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - DiStella::DiStella(CartDebug::DisassemblyList& list, uInt16 start, - bool resolvedata) + bool resolvedata, uInt16 labellength) : myList(list) { while(!myAddressQueue.empty()) @@ -112,7 +112,7 @@ void DiStella::disasm(uInt32 distart, int pass) else if (pass == 3) { if (check_bit(labels[myPC],REFERENCED)) - myDisasmBuf << HEX4 << myPC+myOffset << "'L'" << HEX4 << myPC+myOffset << "'"; + myDisasmBuf << HEX4 << myPC+myOffset << "'L" << HEX4 << myPC+myOffset << "'"; else myDisasmBuf << HEX4 << myPC+myOffset << "' '"; diff --git a/src/debugger/DiStella.hxx b/src/debugger/DiStella.hxx index 1ec2fb04a..e373a02e2 100644 --- a/src/debugger/DiStella.hxx +++ b/src/debugger/DiStella.hxx @@ -49,8 +49,10 @@ class DiStella @param list The results of the disassembly are placed here @param start The address at which to start disassembly @param resolvedata If enabled, try to determine code vs. data sections + @param labellength The maximum length of a label */ - DiStella(CartDebug::DisassemblyList& list, uInt16 start, bool resolvedata = true); + DiStella(CartDebug::DisassemblyList& list, uInt16 start, bool resolvedata = true, + uInt16 labellength = 6); ~DiStella();