mirror of https://github.com/stella-emu/stella.git
improved debugger's RAM labels
This commit is contained in:
parent
b338c1b0ad
commit
1637743d5e
|
@ -605,7 +605,8 @@ bool CartDebug::removeLabel(const string& label)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) const
|
bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead,
|
||||||
|
int places, bool isRam) const
|
||||||
{
|
{
|
||||||
switch(addressType(addr))
|
switch(addressType(addr))
|
||||||
{
|
{
|
||||||
|
@ -662,21 +663,24 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) con
|
||||||
{
|
{
|
||||||
// RAM can use user-defined labels; otherwise we default to
|
// RAM can use user-defined labels; otherwise we default to
|
||||||
// standard mnemonics
|
// standard mnemonics
|
||||||
auto iter = myUserLabels.find(addr);
|
AddrToLabel::const_iterator iter;
|
||||||
if(iter != myUserLabels.end())
|
uInt16 a = addr & 0xFF, offset = addr & 0xFF00;
|
||||||
{
|
bool found = false;
|
||||||
buf << iter->second;
|
|
||||||
}
|
// Search for nearest label
|
||||||
else
|
for(uInt16 i = a; i >= 0x80; --i)
|
||||||
{
|
if((iter = myUserLabels.find(i)) != myUserLabels.end())
|
||||||
uInt16 a = addr & 0xFF, offset = addr & 0xFF00;
|
{
|
||||||
if((iter = myUserLabels.find(a)) != myUserLabels.end())
|
|
||||||
buf << iter->second;
|
buf << iter->second;
|
||||||
else
|
if(a != i)
|
||||||
buf << ourZPMnemonic[a - 0x80];
|
buf << "+$" << Base::HEX1 << (a - i);
|
||||||
if(offset > 0)
|
found = true;
|
||||||
buf << "|$" << Base::HEX2 << offset;
|
break;
|
||||||
}
|
}
|
||||||
|
if(!found)
|
||||||
|
buf << ourZPMnemonic[a - 0x80];
|
||||||
|
if(offset > 0)
|
||||||
|
buf << "|$" << Base::HEX2 << offset;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -684,11 +688,28 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) con
|
||||||
case AddrType::ROM:
|
case AddrType::ROM:
|
||||||
{
|
{
|
||||||
// These addresses can never be in the system labels list
|
// These addresses can never be in the system labels list
|
||||||
const auto& iter = myUserLabels.find(addr);
|
if(isRam) // cartridge RAM
|
||||||
if(iter != myUserLabels.end())
|
|
||||||
{
|
{
|
||||||
buf << iter->second;
|
AddrToLabel::const_iterator iter;
|
||||||
return true;
|
|
||||||
|
// Search for nearest label
|
||||||
|
for(uInt16 i = addr; i >= (addr & 0xf000); --i)
|
||||||
|
if((iter = myUserLabels.find(i)) != myUserLabels.end())
|
||||||
|
{
|
||||||
|
buf << iter->second;
|
||||||
|
if(addr != i)
|
||||||
|
buf << "+$" << Base::HEX1 << (addr - i);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const auto& iter = myUserLabels.find(addr);
|
||||||
|
if(iter != myUserLabels.end())
|
||||||
|
{
|
||||||
|
buf << iter->second;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -713,10 +734,10 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) con
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string CartDebug::getLabel(uInt16 addr, bool isRead, int places) const
|
string CartDebug::getLabel(uInt16 addr, bool isRead, int places, bool isRam) const
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
getLabel(buf, addr, isRead, places);
|
getLabel(buf, addr, isRead, places, isRam);
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,8 +211,10 @@ class CartDebug : public DebuggerSystem
|
||||||
If places is not -1 and a label hasn't been defined, return a
|
If places is not -1 and a label hasn't been defined, return a
|
||||||
formatted hexidecimal address
|
formatted hexidecimal address
|
||||||
*/
|
*/
|
||||||
bool getLabel(ostream& buf, uInt16 addr, bool isRead, int places = -1) const;
|
bool getLabel(ostream& buf, uInt16 addr, bool isRead,
|
||||||
string getLabel(uInt16 addr, bool isRead, int places = -1) const;
|
int places = -1, bool isRam = false) const;
|
||||||
|
string getLabel(uInt16 addr, bool isRead,
|
||||||
|
int places = -1, bool isRam = false) const;
|
||||||
int getAddress(const string& label) const;
|
int getAddress(const string& label) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue