From e10ca8e694700b2b5abc1a202da86f0f7fb5c594 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Mon, 2 Oct 2017 22:12:10 +0200 Subject: [PATCH] removed 'echo' and enhanced 'print' instead --- src/debugger/DebuggerParser.cxx | 65 +++++++++++---------------------- src/debugger/DebuggerParser.hxx | 3 +- 2 files changed, 22 insertions(+), 46 deletions(-) diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 20ad001a2..c1a4b12ac 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -510,28 +510,29 @@ string DebuggerParser::eval() ostringstream buf; for(uInt32 i = 0; i < argCount; ++i) { - string rlabel = debugger.cartDebug().getLabel(args[i], true); - string wlabel = debugger.cartDebug().getLabel(args[i], false); - bool validR = rlabel != "" && rlabel[0] != '$', - validW = wlabel != "" && wlabel[0] != '$'; - if(validR && validW) + if(args[i] < 0x10000) { - if(rlabel == wlabel) - buf << rlabel << "(R/W): "; - else - buf << rlabel << "(R) / " << wlabel << "(W): "; + string rlabel = debugger.cartDebug().getLabel(args[i], true); + string wlabel = debugger.cartDebug().getLabel(args[i], false); + bool validR = rlabel != "" && rlabel[0] != '$', + validW = wlabel != "" && wlabel[0] != '$'; + if(validR && validW) + { + if(rlabel == wlabel) + buf << rlabel << "(R/W): "; + else + buf << rlabel << "(R) / " << wlabel << "(W): "; + } + else if(validR) + buf << rlabel << "(R): "; + else if(validW) + buf << wlabel << "(W): "; } - else if(validR) - buf << rlabel << "(R): "; - else if(validW) - buf << wlabel << "(W): "; - if(args[i] < 0x100) - buf << "$" << Base::toString(args[i], Base::F_16_2) - << " %" << Base::toString(args[i], Base::F_2_8); - else - buf << "$" << Base::toString(args[i], Base::F_16_4) - << " %" << Base::toString(args[i], Base::F_2_16); + buf << "$" << Base::toString(args[i], Base::F_16); + + if(args[i] < 0x10000) + buf << " %" << Base::toString(args[i], Base::F_2); buf << " #" << int(args[i]); if(i != argCount - 1) @@ -933,20 +934,6 @@ void DebuggerParser::executeDump() } } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// "echo" -void DebuggerParser::executeEcho() -{ - int res = YaccParser::parse(argStrings[0].c_str()); - if(res == 0) - { - unique_ptr expr(YaccParser::getResult()); - commandResult << expr->evaluate(); - } - else - commandResult << red("invalid expression"); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // "exec" void DebuggerParser::executeExec() @@ -1937,16 +1924,6 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = { std::mem_fn(&DebuggerParser::executeDump) }, - { - "echo", - "Echo expression result", - "Example: echo _fycles, echo _scan*#76, echo _bank==1", - false, - true, - { kARG_DWORD, kARG_END_ARGS }, - std::mem_fn(&DebuggerParser::executeEcho) - }, - { "exec", "Execute script file ", @@ -2125,7 +2102,7 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = { "Example: print pc, print f000", true, false, - { kARG_WORD, kARG_END_ARGS }, + { kARG_DWORD, kARG_END_ARGS }, std::mem_fn(&DebuggerParser::executePrint) }, diff --git a/src/debugger/DebuggerParser.hxx b/src/debugger/DebuggerParser.hxx index 154988db2..e9e403ac0 100644 --- a/src/debugger/DebuggerParser.hxx +++ b/src/debugger/DebuggerParser.hxx @@ -68,7 +68,7 @@ class DebuggerParser bool saveScriptFile(string file); private: - enum { kNumCommands = 73 }; + enum { kNumCommands = 72 }; // Constants for argument processing enum { @@ -144,7 +144,6 @@ class DebuggerParser void executeDelwatch(); void executeDisasm(); void executeDump(); - void executeEcho(); void executeExec(); void executeExitRom(); void executeFrame();