First pass at making Distella aware of labels defined in a .sym file

or from the user.  Before this is done, the parser needs to recognize
variable-length labels (right now, it used fixed spacing and assumes
the largest label is 8 characters).

Fixed bug in Distella; a label was being printed with an incorrect
quote symbol, which would break parsing of that line.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2038 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-05-12 00:04:14 +00:00
parent dfd4d0cb22
commit 0c1029076c
4 changed files with 13 additions and 5 deletions

View File

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

View File

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

View File

@ -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 << "' '";

View File

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