fix DiStella configuration output

This commit is contained in:
thrust26 2020-03-29 13:02:58 +02:00
parent d9a207786d
commit 49a9f07452
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 // TODO - figure out what to do with this
buf >> hex >> start; buf >> hex >> start;
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::CODE")) else if(BSPF::startsWithIgnoreCase(directive, "CODE"))
{ {
buf >> hex >> start >> hex >> end; buf >> hex >> start >> hex >> end;
addDirective(Device::CODE, start, end, currentbank); addDirective(Device::CODE, start, end, currentbank);
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::GFX")) else if(BSPF::startsWithIgnoreCase(directive, "GFX"))
{ {
buf >> hex >> start >> hex >> end; buf >> hex >> start >> hex >> end;
addDirective(Device::GFX, start, end, currentbank); addDirective(Device::GFX, start, end, currentbank);
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::PGFX")) else if(BSPF::startsWithIgnoreCase(directive, "PGFX"))
{ {
buf >> hex >> start >> hex >> end; buf >> hex >> start >> hex >> end;
addDirective(Device::PGFX, start, end, currentbank); addDirective(Device::PGFX, start, end, currentbank);
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::COL")) else if(BSPF::startsWithIgnoreCase(directive, "COL"))
{ {
buf >> hex >> start >> hex >> end; buf >> hex >> start >> hex >> end;
addDirective(Device::COL, start, end, currentbank); addDirective(Device::COL, start, end, currentbank);
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::PCOL")) else if(BSPF::startsWithIgnoreCase(directive, "PCOL"))
{ {
buf >> hex >> start >> hex >> end; buf >> hex >> start >> hex >> end;
addDirective(Device::PCOL, start, end, currentbank); addDirective(Device::PCOL, start, end, currentbank);
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::BCOL")) else if(BSPF::startsWithIgnoreCase(directive, "BCOL"))
{ {
buf >> hex >> start >> hex >> end; buf >> hex >> start >> hex >> end;
addDirective(Device::BCOL, start, end, currentbank); addDirective(Device::BCOL, start, end, currentbank);
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::AUD")) else if(BSPF::startsWithIgnoreCase(directive, "AUD"))
{ {
buf >> hex >> start >> hex >> end; buf >> hex >> start >> hex >> end;
addDirective(Device::AUD, start, end, currentbank); addDirective(Device::AUD, start, end, currentbank);
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::DATA")) else if(BSPF::startsWithIgnoreCase(directive, "DATA"))
{ {
buf >> hex >> start >> hex >> end; buf >> hex >> start >> hex >> end;
addDirective(Device::DATA, start, end, currentbank); addDirective(Device::DATA, start, end, currentbank);
} }
else if(BSPF::startsWithIgnoreCase(directive, "Device::ROW")) else if(BSPF::startsWithIgnoreCase(directive, "ROW"))
{ {
buf >> hex >> start; buf >> hex >> start;
buf >> hex >> end; buf >> hex >> end;
@ -1304,9 +1304,6 @@ string CartDebug::saveRom()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::listConfig(int bank) 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(); uInt32 startbank = 0, endbank = bankCount();
if(bank >= 0 && bank < bankCount()) if(bank >= 0 && bank < bankCount())
{ {
@ -1319,7 +1316,7 @@ string CartDebug::listConfig(int bank)
for(uInt32 b = startbank; b < endbank; ++b) for(uInt32 b = startbank; b < endbank; ++b)
{ {
BankInfo& info = myBankInfo[b]; BankInfo& info = myBankInfo[b];
buf << "[" << b << "]" << endl; buf << "Bank [" << b << "]" << endl;
for(const auto& i: info.directiveList) for(const auto& i: info.directiveList)
{ {
if(i.type != Device::NONE) if(i.type != Device::NONE)
@ -1332,6 +1329,9 @@ string CartDebug::listConfig(int bank)
getBankDirectives(buf, info); getBankDirectives(buf, info);
} }
if(myConsole.cartridge().bankCount() > 1)
buf << DebuggerParser::red("config file for multi-bank ROM not fully supported") << endl;
return buf.str(); return buf.str();
} }
@ -1499,16 +1499,16 @@ void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessType type) const
{ {
switch(type) switch(type)
{ {
case Device::CODE: buf << "Device::CODE"; break; case Device::CODE: buf << "CODE"; break;
case Device::TCODE: buf << "Device::TCODE"; break; case Device::TCODE: buf << "TCODE"; break;
case Device::GFX: buf << "Device::GFX"; break; case Device::GFX: buf << "GFX"; break;
case Device::PGFX: buf << "Device::PGFX"; break; case Device::PGFX: buf << "PGFX"; break;
case Device::COL: buf << "Device::COL"; break; case Device::COL: buf << "COL"; break;
case Device::PCOL: buf << "Device::PCOL"; break; case Device::PCOL: buf << "PCOL"; break;
case Device::BCOL: buf << "Device::BCOL"; break; case Device::BCOL: buf << "BCOL"; break;
case Device::AUD: buf << "Device::AUD"; break; case Device::AUD: buf << "AUD"; break;
case Device::DATA: buf << "Device::DATA"; break; case Device::DATA: buf << "DATA"; break;
case Device::ROW: buf << "Device::ROW"; break; case Device::ROW: buf << "ROW"; break;
case Device::REFERENCED: case Device::REFERENCED:
case Device::VALID_ENTRY: case Device::VALID_ENTRY:
case Device::NONE: break; case Device::NONE: break;
@ -1521,29 +1521,29 @@ void CartDebug::AccessTypeAsString(ostream& buf, Device::AccessFlags flags) cons
if(flags) if(flags)
{ {
if(flags & Device::CODE) if(flags & Device::CODE)
buf << "Device::CODE "; buf << "CODE ";
if(flags & Device::TCODE) if(flags & Device::TCODE)
buf << "Device::TCODE "; buf << "TCODE ";
if(flags & Device::GFX) if(flags & Device::GFX)
buf << "Device::GFX "; buf << "GFX ";
if(flags & Device::PGFX) if(flags & Device::PGFX)
buf << "Device::PGFX "; buf << "PGFX ";
if(flags & Device::COL) if(flags & Device::COL)
buf << "Device::COL "; buf << "COL ";
if(flags & Device::PCOL) if(flags & Device::PCOL)
buf << "Device::PCOL "; buf << "PCOL ";
if(flags & Device::BCOL) if(flags & Device::BCOL)
buf << "Device::BCOL "; buf << "BCOL ";
if(flags & Device::AUD) if(flags & Device::AUD)
buf << "Device::AUD "; buf << "AUD ";
if(flags & Device::DATA) if(flags & Device::DATA)
buf << "Device::DATA "; buf << "DATA ";
if(flags & Device::ROW) if(flags & Device::ROW)
buf << "Device::ROW "; buf << "ROW ";
if(flags & Device::REFERENCED) if(flags & Device::REFERENCED)
buf << "*Device::REFERENCED "; buf << "*REFERENCED ";
if(flags & Device::VALID_ENTRY) if(flags & Device::VALID_ENTRY)
buf << "*Device::VALID_ENTRY "; buf << "*VALID_ENTRY ";
} }
else else
buf << "no flags set"; 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 // Convert given address to corresponding access type and append to buf
void accessTypeAsString(ostream& buf, uInt16 addr) const; 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: private:
using AddrToLabel = std::map<uInt16, string>; using AddrToLabel = std::map<uInt16, string>;
using LabelToAddr = std::map<string, uInt16, using LabelToAddr = std::map<string, uInt16,
@ -286,9 +289,6 @@ class CartDebug : public DebuggerSystem
// Get access enum type from 'flags', taking precendence into account // Get access enum type from 'flags', taking precendence into account
Device::AccessType accessTypeAbsolute(Device::AccessFlags flags) const; 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 // Convert all access types in 'flags' to corresponding string and
// append to buf // append to buf
void AccessTypeAsString(ostream& buf, Device::AccessFlags flags) const; 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]); bool result = debugger.cartDebug().addDirective(type, args[0], args[1]);
string typeStr;
switch(type) commandResult << (result ? "added " : "removed ");
{ debugger.cartDebug().AccessTypeAsString(commandResult, type);
case Device::CODE: typeStr = "CODE"; break; commandResult << " directive on range $"
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 $"
<< hex << args[0] << " $" << hex << args[1]; << hex << args[0] << " $" << hex << args[1];
debugger.rom().invalidate(); debugger.rom().invalidate();
} }