fix DiStella configuration output

This commit is contained in:
thrust26 2020-03-29 13:02:58 +02:00
parent 1beaf64edd
commit cf25b18867
3 changed files with 41 additions and 55 deletions

View File

@ -886,47 +886,47 @@ string CartDebug::loadConfigFile()
// TODO - figure out what to do with this
buf >> hex >> start;
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::CODE"))
else if(BSPF::startsWithIgnoreCase(directive, "CODE"))
{
buf >> hex >> start >> hex >> end;
addDirective(Device::CODE, start, end, currentbank);
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::GFX"))
else if(BSPF::startsWithIgnoreCase(directive, "GFX"))
{
buf >> hex >> start >> hex >> end;
addDirective(Device::GFX, start, end, currentbank);
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::PGFX"))
else if(BSPF::startsWithIgnoreCase(directive, "PGFX"))
{
buf >> hex >> start >> hex >> end;
addDirective(Device::PGFX, start, end, currentbank);
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::COL"))
else if(BSPF::startsWithIgnoreCase(directive, "COL"))
{
buf >> hex >> start >> hex >> end;
addDirective(Device::COL, start, end, currentbank);
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::PCOL"))
else if(BSPF::startsWithIgnoreCase(directive, "PCOL"))
{
buf >> hex >> start >> hex >> end;
addDirective(Device::PCOL, start, end, currentbank);
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::BCOL"))
else if(BSPF::startsWithIgnoreCase(directive, "BCOL"))
{
buf >> hex >> start >> hex >> end;
addDirective(Device::BCOL, start, end, currentbank);
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::AUD"))
else if(BSPF::startsWithIgnoreCase(directive, "AUD"))
{
buf >> hex >> start >> hex >> end;
addDirective(Device::AUD, start, end, currentbank);
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::DATA"))
else if(BSPF::startsWithIgnoreCase(directive, "DATA"))
{
buf >> hex >> start >> hex >> end;
addDirective(Device::DATA, start, end, currentbank);
}
else if(BSPF::startsWithIgnoreCase(directive, "Device::ROW"))
else if(BSPF::startsWithIgnoreCase(directive, "ROW"))
{
buf >> hex >> start;
buf >> hex >> end;
@ -1304,9 +1304,6 @@ string CartDebug::saveRom()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::listConfig(int bank)
{
if(myConsole.cartridge().bankCount() > 1)
return DebuggerParser::red("config file for multi-bank ROM not yet supported");
uInt32 startbank = 0, endbank = bankCount();
if(bank >= 0 && bank < bankCount())
{
@ -1319,7 +1316,7 @@ string CartDebug::listConfig(int bank)
for(uInt32 b = startbank; b < endbank; ++b)
{
BankInfo& info = myBankInfo[b];
buf << "[" << b << "]" << endl;
buf << "Bank [" << b << "]" << endl;
for(const auto& i: info.directiveList)
{
if(i.type != Device::NONE)
@ -1332,6 +1329,9 @@ string CartDebug::listConfig(int bank)
getBankDirectives(buf, info);
}
if(myConsole.cartridge().bankCount() > 1)
buf << DebuggerParser::red("config file for multi-bank ROM not fully supported") << endl;
return buf.str();
}
@ -1499,16 +1499,16 @@ void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessType type) const
{
switch(type)
{
case Device::CODE: buf << "Device::CODE"; break;
case Device::TCODE: buf << "Device::TCODE"; break;
case Device::GFX: buf << "Device::GFX"; break;
case Device::PGFX: buf << "Device::PGFX"; break;
case Device::COL: buf << "Device::COL"; break;
case Device::PCOL: buf << "Device::PCOL"; break;
case Device::BCOL: buf << "Device::BCOL"; break;
case Device::AUD: buf << "Device::AUD"; break;
case Device::DATA: buf << "Device::DATA"; break;
case Device::ROW: buf << "Device::ROW"; break;
case Device::CODE: buf << "CODE"; break;
case Device::TCODE: buf << "TCODE"; break;
case Device::GFX: buf << "GFX"; break;
case Device::PGFX: buf << "PGFX"; break;
case Device::COL: buf << "COL"; break;
case Device::PCOL: buf << "PCOL"; break;
case Device::BCOL: buf << "BCOL"; break;
case Device::AUD: buf << "AUD"; break;
case Device::DATA: buf << "DATA"; break;
case Device::ROW: buf << "ROW"; break;
case Device::REFERENCED:
case Device::VALID_ENTRY:
case Device::NONE: break;
@ -1521,29 +1521,29 @@ void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessFlags flags) cons
if(flags)
{
if(flags & Device::CODE)
buf << "Device::CODE ";
buf << "CODE ";
if(flags & Device::TCODE)
buf << "Device::TCODE ";
buf << "TCODE ";
if(flags & Device::GFX)
buf << "Device::GFX ";
buf << "GFX ";
if(flags & Device::PGFX)
buf << "Device::PGFX ";
buf << "PGFX ";
if(flags & Device::COL)
buf << "Device::COL ";
buf << "COL ";
if(flags & Device::PCOL)
buf << "Device::PCOL ";
buf << "PCOL ";
if(flags & Device::BCOL)
buf << "Device::BCOL ";
buf << "BCOL ";
if(flags & Device::AUD)
buf << "Device::AUD ";
buf << "AUD ";
if(flags & Device::DATA)
buf << "Device::DATA ";
buf << "DATA ";
if(flags & Device::ROW)
buf << "Device::ROW ";
buf << "ROW ";
if(flags & Device::REFERENCED)
buf << "*Device::REFERENCED ";
buf << "*REFERENCED ";
if(flags & Device::VALID_ENTRY)
buf << "*Device::VALID_ENTRY ";
buf << "*VALID_ENTRY ";
}
else
buf << "no flags set";

View File

@ -237,6 +237,9 @@ class CartDebug : public DebuggerSystem
// Convert given address to corresponding access type and append to buf
void accessTypeAsString(ostream& buf, uInt16 addr) const;
// Convert access enum type to corresponding string and append to buf
void AccessTypeAsString(ostream& buf, Device::AccessType type) const;
private:
using AddrToLabel = std::map<uInt16, string>;
using LabelToAddr = std::map<string, uInt16,
@ -286,9 +289,6 @@ class CartDebug : public DebuggerSystem
// Get access enum type from 'flags', taking precendence into account
Device::AccessType accessTypeAbsolute(Device::AccessFlags flags) const;
// Convert access enum type to corresponding string and append to buf
void AccessTypeAsString(ostream& buf, Device::AccessType type) const;
// Convert all access types in 'flags' to corresponding string and
// append to buf
void AccessTypeAsString(ostream& buf, Device::AccessFlags flags) const;

View File

@ -694,24 +694,10 @@ void DebuggerParser::executeDirective(Device::AccessType type)
}
bool result = debugger.cartDebug().addDirective(type, args[0], args[1]);
string typeStr;
switch(type)
{
case Device::CODE: typeStr = "CODE"; break;
case Device::GFX: typeStr = "GFX"; break;
case Device::PGFX: typeStr = "PGFX"; break;
case Device::COL: typeStr = "COL"; break;
case Device::PCOL: typeStr = "PCOL"; break;
case Device::BCOL: typeStr = "BCOL"; break;
case Device::AUD: typeStr = "AUD"; break;
case Device::DATA: typeStr = "DATA"; break;
case Device::ROW: typeStr = "ROW"; break;
default: typeStr = "NONE";
}
commandResult << (result ? "added " : "removed ")
<< typeStr << " directive on range $"
commandResult << (result ? "added " : "removed ");
debugger.cartDebug().AccessTypeAsString(commandResult, type);
commandResult << " directive on range $"
<< hex << args[0] << " $" << hex << args[1];
debugger.rom().invalidate();
}