diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index a59b28563..156892cf6 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -857,6 +857,32 @@ string CartDebug::listConfig(int bank) return buf.str(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +string CartDebug::clearConfig(int bank) +{ + uInt32 startbank = 0, endbank = bankCount(); + if(bank >= 0 && bank < bankCount()) + { + startbank = bank; + endbank = startbank + 1; + } + + uInt32 count = 0; + for(uInt32 b = startbank; b < endbank; ++b) + { + count += myBankInfo[b].directiveList.size(); + myBankInfo[b].directiveList.clear(); + } + + ostringstream buf; + if(count > 0) + buf << "removed " << dec << count << " directives from " + << dec << (endbank - startbank) << " banks"; + else + buf << "no directives present"; + return buf.str(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartDebug::getCompletions(const char* in, StringList& completions) const { diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index fd4b17534..85e70967b 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -223,10 +223,16 @@ class CartDebug : public DebuggerSystem /** Show Distella directives (both set by the user and determined by Distella) - for the given bank (or all banks, if no bank is specified. + for the given bank (or all banks, if no bank is specified). */ string listConfig(int bank = -1); + /** + Clear Distella directives (set by the user) for the given bank + (or all banks, if no bank is specified.) + */ + string clearConfig(int bank = -1); + /** Methods used by the command parser for tab-completion In this case, return completions from the equate list(s) diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 1575452a7..3b3fd33ee 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -766,6 +766,16 @@ void DebuggerParser::executeClearbreaks() commandResult << "all breakpoints cleared"; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// "clearconfig" +void DebuggerParser::executeClearconfig() +{ + if(argCount == 1) + commandResult << debugger->cartDebug().clearConfig(args[0]); + else + commandResult << debugger->cartDebug().clearConfig(); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // "cleartraps" void DebuggerParser::executeCleartraps() @@ -1568,6 +1578,15 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = { &DebuggerParser::executeClearbreaks }, + { + "clearconfig", + "Clear Distella config directives [bank xx]", + false, + false, + { kARG_WORD, kARG_MULTI_BYTE }, + &DebuggerParser::executeClearconfig + }, + { "cleartraps", "Clear all traps", diff --git a/src/debugger/DebuggerParser.hxx b/src/debugger/DebuggerParser.hxx index 45d97d574..de5e17e98 100644 --- a/src/debugger/DebuggerParser.hxx +++ b/src/debugger/DebuggerParser.hxx @@ -83,7 +83,7 @@ class DebuggerParser private: enum { - kNumCommands = 64, + kNumCommands = 65, kMAX_ARG_TYPES = 10 }; @@ -142,6 +142,7 @@ class DebuggerParser void executeC(); void executeCheat(); void executeClearbreaks(); + void executeClearconfig(); void executeCleartraps(); void executeClearwatches(); void executeCls(); diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index f6024e388..dac625605 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -804,22 +804,6 @@ void DiStella::addEntry(CartDebug::DisasmType type) tag.disasm = " "; break; } -/* - switch(myDisasmBuf.peek()) - { - case ' ': - tag.disasm = " "; - break; - case '.': - getline(myDisasmBuf, tag.disasm); - break; - default: - getline(myDisasmBuf, tag.disasm, '\''); - getline(myDisasmBuf, tag.ccount, '\''); - getline(myDisasmBuf, tag.bytes); - break; - } -*/ myList.push_back(tag); DONE_WITH_ADD: