Mostly completed support for showing .sym label information in the

disassembly output.  Still TODO is add some visual improvements
(ie, align the cycle counts to not take too much space, etc).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2041 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-06-04 16:33:56 +00:00
parent befafd5d62
commit 4735feda13
3 changed files with 36 additions and 21 deletions

View File

@ -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;
}
}

View File

@ -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("");
}

View File

@ -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);