diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 5eb7f3203..6f927c65f 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -286,7 +286,9 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const if((tag.address & 0xfff) >= start) { buffer << uppercase << hex << setw(4) << setfill('0') << tag.address - << ": " << tag.disasm << " " << tag.bytes << endl; + << ": " << tag.disasm << setw(myLabelLength - tag.disasm.length() + 10) + << setfill(' ') << " " + << tag.ccount << " " << tag.bytes << endl; --lines; } } diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index 22348669f..ce8d168e6 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -558,15 +558,10 @@ void DiStella::disasm(uInt32 distart, int pass) } else if (pass == 3) { - myDisasmBuf << nextline.str();; - uInt32 nextlinelen = nextline.str().length(); - if (nextlinelen <= 15) - { - /* Print spaces to align cycle count data */ - for (uInt32 charcnt=0;charcnt<15-nextlinelen;charcnt++) - myDisasmBuf << " "; - } - myDisasmBuf << ";" << dec << (int)ourLookup[op].cycles << "'" << nextlinebytes.str(); + // A complete line of disassembly (text, cycle count, and bytes) + myDisasmBuf << nextline.str() << "'" + << ";" << dec << (int)ourLookup[op].cycles << "'" + << nextlinebytes.str(); addEntry(); if (op == 0x40 || op == 0x60) { @@ -668,6 +663,7 @@ int DiStella::mark(uInt32 address, MarkType bit) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DiStella::showgfx(uInt8 c) { +#if 0 int i; myDisasmBuf << "|"; @@ -681,37 +677,51 @@ void DiStella::showgfx(uInt8 c) c = c << 1; } myDisasmBuf << "|"; +#endif } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DiStella::addEntry() { - const string& line = myDisasmBuf.str(); CartDebug::DisassemblyTag tag; - if(line[0] == ' ') + // Address + myDisasmBuf.seekg(0, ios::beg); + if(myDisasmBuf.peek() == ' ') tag.address = 0; else myDisasmBuf >> setw(4) >> hex >> tag.address; - if(line[5] != ' ') - tag.label = line.substr(5, 5); + // Label (a user-defined label always overrides any auto-generated one) + myDisasmBuf.seekg(5, ios::beg); + if(tag.address) + { + tag.label = myDbg.getLabel(tag.address, true); + if(tag.label == EmptyString && myDisasmBuf.peek() != ' ') + getline(myDisasmBuf, tag.label, '\''); + } - switch(line[11]) + // Disassembly + // Up to this point the field sizes are fixed, until we get to + // variable length labels, cycle counts, etc + myDisasmBuf.seekg(11, ios::beg); + switch(myDisasmBuf.peek()) { case ' ': tag.disasm = " "; break; case '.': - tag.disasm = line.substr(11); + getline(myDisasmBuf, tag.disasm); break; default: - tag.disasm = line.substr(11, 17); - tag.bytes = line.substr(29); + getline(myDisasmBuf, tag.disasm, '\''); + getline(myDisasmBuf, tag.ccount, '\''); + getline(myDisasmBuf, tag.bytes); break; } myList.push_back(tag); + myDisasmBuf.clear(); myDisasmBuf.str(""); } diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index d6d71a296..81c6f9d59 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -71,7 +71,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font, numchars = w / fontWidth; _labelWidth = BSPF_max(16, int(0.35 * (numchars - 12))) * fontWidth - 1; - _bytesWidth = 12 * fontWidth; + _bytesWidth = 10 * fontWidth; ////////////////////////////////////////////////////// // Add checkboxes @@ -424,7 +424,7 @@ void RomListWidget::drawWidget(bool hilite) // Draw the list items int large_disasmw = _w - l.x() - _labelWidth, - small_disasmw = large_disasmw - r.width(); + small_disasmw = large_disasmw - r.width() - 4 * _fontWidth; xpos = _x + CheckboxWidget::boxSize() + 10; ypos = _y + 2; for (i = 0, pos = _currentPos; i < _rows && pos < len; i++, pos++, ypos += _fontHeight) { @@ -458,9 +458,12 @@ void RomListWidget::drawWidget(bool hilite) // should get all remaining space if(dlist[pos].bytes != "") { - // Draw disassembly + // Draw disassembly and cycle count + // TODO - cycle count should be aligned as close as possible to the disassembly s.drawString(_font, dlist[pos].disasm, xpos + _labelWidth, ypos, small_disasmw, kTextColor); + s.drawString(_font, dlist[pos].ccount, xpos + _labelWidth + small_disasmw, ypos, + 2*_fontWidth, kTextColor); // Draw separator s.vLine(_x + r.x() - 7, ypos, ypos + _fontHeight - 1, kColor);