Added "riot" command. It shows the RIOT regs in raw and decoded forms.

Currently, entering the debugger turns off all the joystick and button
inputs, so we're stuck showing "(no directions)" for the sticks. This
needs a change in EventHandler to fix (assuming it can even be done).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@600 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-03 08:15:31 +00:00
parent 94e4add1b7
commit 16a17330ed
5 changed files with 110 additions and 8 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Debugger.cxx,v 1.49 2005-07-03 01:36:39 urchlay Exp $
// $Id: Debugger.cxx,v 1.50 2005-07-03 08:15:31 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -243,6 +243,88 @@ const string Debugger::state()
return result;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/* The timers, joysticks, and switches can be read via peeks, so
I didn't write a separate RIOTDebug class. */
const string Debugger::riotState() {
string ret;
// TODO: inverse video for changed regs. Core needs to track this.
// TODO: keyboard controllers?
for(int i=0x280; i<0x284; i++) {
ret += valueToString(i);
ret += "/";
ret += equates()->getFormatted(i, 2);
ret += "=";
ret += valueToString(mySystem->peek(i));
ret += " ";
}
ret += "\n";
// These are squirrely: some symbol files will define these as
// 0x284-0x287. Doesn't actually matter, these registers repeat
// every 16 bytes.
ret += valueToString(0x294);
ret += "/TIM1T=";
ret += valueToString(mySystem->peek(0x294));
ret += " ";
ret += valueToString(0x295);
ret += "/TIM8T=";
ret += valueToString(mySystem->peek(0x295));
ret += " ";
ret += valueToString(0x296);
ret += "/TIM64T=";
ret += valueToString(mySystem->peek(0x296));
ret += " ";
ret += valueToString(0x297);
ret += "/TIM1024T=";
ret += valueToString(mySystem->peek(0x297));
ret += "\n";
ret += "Left/P0diff: ";
ret += (mySystem->peek(0x282) & 0x40) ? "hard/A" : "easy/B";
ret += " ";
ret += "Right/P1diff: ";
ret += (mySystem->peek(0x282) & 0x80) ? "hard/A" : "easy/B";
ret += "\n";
ret += "TVType: ";
ret += (mySystem->peek(0x282) & 0x8) ? "Color" : "B&W";
ret += " Switches: ";
ret += (mySystem->peek(0x282) & 0x2) ? "-" : "+";
ret += "select ";
ret += (mySystem->peek(0x282) & 0x1) ? "-" : "+";
ret += "reset";
ret += "\n";
// Yes, the fire buttons are in the TIA, but we might as well
// show them here for convenience.
ret += "Left/P0 stick: ";
ret += (mySystem->peek(0x280) & 0x80) ? "" : "right ";
ret += (mySystem->peek(0x280) & 0x40) ? "" : "left ";
ret += (mySystem->peek(0x280) & 0x20) ? "" : "down ";
ret += (mySystem->peek(0x280) & 0x10) ? "" : "up ";
ret += ((mySystem->peek(0x280) & 0xf0) == 0xf0) ? "(no directions) " : "";
ret += (mySystem->peek(0x03c) & 0x80) ? "" : "(button) ";
ret += "\n";
ret += "Right/P1 stick: ";
ret += (mySystem->peek(0x280) & 0x08) ? "" : "right ";
ret += (mySystem->peek(0x280) & 0x04) ? "" : "left ";
ret += (mySystem->peek(0x280) & 0x02) ? "" : "down ";
ret += (mySystem->peek(0x280) & 0x01) ? "" : "up ";
ret += ((mySystem->peek(0x280) & 0x0f) == 0x0f) ? "(no directions) " : "";
ret += (mySystem->peek(0x03d) & 0x80) ? "" : "(button) ";
//ret += "\n"; // caller will add
return ret;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::reset() {
int pc = myDebugger->dPeek(0xfffc);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: Debugger.hxx,v 1.39 2005-07-02 18:03:09 urchlay Exp $
// $Id: Debugger.hxx,v 1.40 2005-07-03 08:15:31 urchlay Exp $
//============================================================================
#ifndef DEBUGGER_HXX
@ -51,7 +51,7 @@ enum {
for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony
@version $Id: Debugger.hxx,v 1.39 2005-07-02 18:03:09 urchlay Exp $
@version $Id: Debugger.hxx,v 1.40 2005-07-03 08:15:31 urchlay Exp $
*/
class Debugger : public DialogContainer
{
@ -168,6 +168,11 @@ class Debugger : public DialogContainer
*/
const string state();
/**
Get contents of RIOT switch & timer registers
*/
const string riotState();
/**
Return a formatted string containing the contents of the specified
device.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerParser.cxx,v 1.46 2005-07-02 18:03:09 urchlay Exp $
// $Id: DebuggerParser.cxx,v 1.47 2005-07-03 08:15:31 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -242,6 +242,14 @@ Command DebuggerParser::commands[] = {
&DebuggerParser::executeReset
},
{
"riot",
"Show RIOT timer/input status",
false,
{ kARG_END_ARGS },
&DebuggerParser::executeRiot
},
{
"rom",
"Change ROM contents",
@ -1165,6 +1173,11 @@ void DebuggerParser::executeReset() {
commandResult = "reset CPU";
}
// "riot"
void DebuggerParser::executeRiot() {
commandResult = debugger->riotState();
}
// "rom"
void DebuggerParser::executeRom() {
int addr = args[0];

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: DebuggerParser.hxx,v 1.26 2005-07-02 18:34:53 stephena Exp $
// $Id: DebuggerParser.hxx,v 1.27 2005-07-03 08:15:31 urchlay Exp $
//============================================================================
#ifndef DEBUGGER_PARSER_HXX
@ -119,6 +119,7 @@ class DebuggerParser
void executeRam();
void executeReload();
void executeReset();
void executeRiot();
void executeRom();
void executeRun();
void executeS();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: TIADebug.cxx,v 1.6 2005-07-03 06:49:38 urchlay Exp $
// $Id: TIADebug.cxx,v 1.7 2005-07-03 08:15:31 urchlay Exp $
//============================================================================
#include "TIADebug.hxx"
@ -93,8 +93,7 @@ const string booleanWithLabel(string label, bool value) {
string TIADebug::state() {
string ret;
// TODO: prettier printing (table?)
// TODO: joysticks, switches (need a RIOTDebug class, not here)
// TODO: inverse video for changed regs. Core needs to track this.
// TODO: strobes? WSYNC RSYNC RESP0/1 RESM0/1 RESBL HMOVE HMCLR CXCLR
// TIA::myCOLUxx are stored 4 copies to each int, we need only 1
@ -144,6 +143,8 @@ string TIADebug::state() {
ret += booleanWithLabel("INPT4", myTIA->peek(0x0c) & 0x80);
ret += " ";
ret += booleanWithLabel("INPT5", myTIA->peek(0x0d) & 0x80);
ret += " ";
ret += booleanWithLabel("dump_gnd_0123", myTIA->myDumpEnabled);
ret += "\n";
ret += "COLUP0: ";