mirror of https://github.com/stella-emu/stella.git
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:
parent
dfd4d0cb22
commit
0c1029076c
|
@ -27,7 +27,8 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CartDebug::CartDebug(Debugger& dbg, Console& console, const RamAreaList& areas)
|
CartDebug::CartDebug(Debugger& dbg, Console& console, const RamAreaList& areas)
|
||||||
: DebuggerSystem(dbg, console),
|
: DebuggerSystem(dbg, console),
|
||||||
myRWPortAddress(0)
|
myRWPortAddress(0),
|
||||||
|
myLabelLength(6) // longest pre-defined label
|
||||||
{
|
{
|
||||||
// Zero-page RAM is always present
|
// Zero-page RAM is always present
|
||||||
addRamArea(0x80, 128, 0, 0);
|
addRamArea(0x80, 128, 0, 0);
|
||||||
|
@ -252,7 +253,7 @@ bool CartDebug::fillDisassemblyList(uInt16 start, bool resolvedata, uInt16 searc
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
myDisassembly.clear();
|
myDisassembly.clear();
|
||||||
DiStella distella(myDisassembly, start, resolvedata);
|
DiStella distella(myDisassembly, start, resolvedata, myLabelLength);
|
||||||
|
|
||||||
// Parts of the disassembly will be accessed later in different ways
|
// Parts of the disassembly will be accessed later in different ways
|
||||||
// We place those parts in separate maps, to speed up access
|
// 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);
|
removeLabel(label);
|
||||||
myUserAddresses.insert(make_pair(label, address));
|
myUserAddresses.insert(make_pair(label, address));
|
||||||
myUserLabels.insert(make_pair(address, label));
|
myUserLabels.insert(make_pair(address, label));
|
||||||
|
myLabelLength = BSPF_max(myLabelLength, (uInt16)label.size());
|
||||||
|
mySystem.setDirtyPage(address);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,6 +240,9 @@ class CartDebug : public DebuggerSystem
|
||||||
// occurred
|
// occurred
|
||||||
uInt16 myRWPortAddress;
|
uInt16 myRWPortAddress;
|
||||||
|
|
||||||
|
// The maximum length of all labels currently defined
|
||||||
|
uInt16 myLabelLength;
|
||||||
|
|
||||||
/// Table of instruction mnemonics
|
/// Table of instruction mnemonics
|
||||||
static const char* ourTIAMnemonicR[16]; // read mode
|
static const char* ourTIAMnemonicR[16]; // read mode
|
||||||
static const char* ourTIAMnemonicW[64]; // write mode
|
static const char* ourTIAMnemonicW[64]; // write mode
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
DiStella::DiStella(CartDebug::DisassemblyList& list, uInt16 start,
|
DiStella::DiStella(CartDebug::DisassemblyList& list, uInt16 start,
|
||||||
bool resolvedata)
|
bool resolvedata, uInt16 labellength)
|
||||||
: myList(list)
|
: myList(list)
|
||||||
{
|
{
|
||||||
while(!myAddressQueue.empty())
|
while(!myAddressQueue.empty())
|
||||||
|
@ -112,7 +112,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
else if (pass == 3)
|
else if (pass == 3)
|
||||||
{
|
{
|
||||||
if (check_bit(labels[myPC],REFERENCED))
|
if (check_bit(labels[myPC],REFERENCED))
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "'L'" << HEX4 << myPC+myOffset << "'";
|
myDisasmBuf << HEX4 << myPC+myOffset << "'L" << HEX4 << myPC+myOffset << "'";
|
||||||
else
|
else
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "' '";
|
myDisasmBuf << HEX4 << myPC+myOffset << "' '";
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,10 @@ class DiStella
|
||||||
@param list The results of the disassembly are placed here
|
@param list The results of the disassembly are placed here
|
||||||
@param start The address at which to start disassembly
|
@param start The address at which to start disassembly
|
||||||
@param resolvedata If enabled, try to determine code vs. data sections
|
@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();
|
~DiStella();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue