added "swchb" command to debugger

This commit is contained in:
Thomas Jentzsch 2022-08-20 20:00:03 +02:00
parent 08a2c63a0b
commit ea05619402
5 changed files with 34 additions and 3 deletions

View File

@ -1017,6 +1017,7 @@ clearSaveStateIfs - Clear all saveState points
scanLine - Advance emulation by <xx> scanlines (default=1)
step - Single step CPU [with count xx]
stepWhile - Single step CPU while <condition> is true
swchb - Set SWCHB to value xx
tia - Show TIA state
trace - Single step CPU over subroutines [with count xx]
trap - Trap read/write access to address(es) xx [yy]

View File

@ -148,7 +148,9 @@ string DebuggerParser::exec(const FSNode& file, StringList* history)
if(!getline(in, command))
break;
++execDepth;
run(command);
--execDepth;
if (history != nullptr)
history->push_back(command);
count++;
@ -1315,9 +1317,7 @@ void DebuggerParser::executeExec()
// make sure the commands are added to prompt history
StringList history;
++execDepth;
commandResult << exec(node, &history);
--execDepth;
for(const auto& item: history)
debugger.prompt().addToHistory(item.c_str());
@ -2159,6 +2159,14 @@ void DebuggerParser::executeStepWhile()
commandResult << "executed " << ncycles << " cycles";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "swchb"
void DebuggerParser::executeSwchb()
{
debugger.riotDebug().switches(args[0]);
commandResult << "SWCHB set to " << std::hex << std::setw(2) << std::setfill('0') << args[0];
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "tia"
void DebuggerParser::executeTia()
@ -3381,6 +3389,16 @@ DebuggerParser::CommandArray DebuggerParser::commands = { {
std::mem_fn(&DebuggerParser::executeStepWhile)
},
{
"swchb",
"Set SWCHB to xx",
"Example: swchb fe",
true,
true,
{ Parameters::ARG_WORD, Parameters::ARG_END_ARGS },
std::mem_fn(&DebuggerParser::executeSwchb)
},
{
"tia",
"Show TIA state",

View File

@ -101,7 +101,7 @@ class DebuggerParser
std::array<Parameters, 10> parms;
std::function<void (DebuggerParser*)> executor;
};
using CommandArray = std::array<Command, 103>;
using CommandArray = std::array<Command, 104>;
static CommandArray commands;
struct Trap
@ -234,6 +234,7 @@ class DebuggerParser
void executeScanLine();
void executeStep();
void executeStepWhile();
void executeSwchb();
void executeTia();
void executeTrace();
void executeTrap();

View File

@ -257,6 +257,16 @@ int RiotDebug::timReadCycles() const
return mySystem.m6532().myTimReadCycles;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool RiotDebug::switches(int newVal)
{
uInt8& switches = myConsole.switches().mySwitches;
if(newVal > -1)
switches = newVal;
return switches;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool RiotDebug::diffP0(int newVal)
{

View File

@ -89,6 +89,7 @@ class RiotDebug : public DebuggerSystem
int intimAsInt() const { return static_cast<int>(intim()); } // so we can use _inTim pseudo-register
/* Console switches */
bool switches(int newVal = -1);
bool diffP0(int newVal = -1);
bool diffP1(int newVal = -1);
bool tvType(int newVal = -1);