Prompt status line displays changed registers in inverse video. We check

for changes on step, trace, and run commands.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@590 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-07-02 15:31:30 +00:00
parent 31708d4a7f
commit 584baab7d1
5 changed files with 59 additions and 19 deletions

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Debugger.cxx,v 1.43 2005-07-01 04:22:27 urchlay Exp $ // $Id: Debugger.cxx,v 1.44 2005-07-02 15:31:30 urchlay Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -54,6 +54,8 @@ Debugger::Debugger(OSystem* osystem)
breakPoints = new PackedBitArray(0x10000); breakPoints = new PackedBitArray(0x10000);
readTraps = new PackedBitArray(0x10000); readTraps = new PackedBitArray(0x10000);
writeTraps = new PackedBitArray(0x10000); writeTraps = new PackedBitArray(0x10000);
oldA = oldX = oldY = oldS = oldP = oldPC = -1;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -182,6 +184,18 @@ const string Debugger::valueToString(int value, BaseFormat outputBase)
return string(rendered); return string(rendered);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string Debugger::invIfChanged(int reg, int oldReg) {
string ret;
bool changed = !(reg == oldReg);
if(changed) ret += "\177";
ret += valueToString(reg);
if(changed) ret += "\177";
return ret;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string Debugger::state() const string Debugger::state()
{ {
@ -190,17 +204,17 @@ const string Debugger::state()
//cerr << "state(): pc is " << myDebugger->pc() << endl; //cerr << "state(): pc is " << myDebugger->pc() << endl;
result += "\nPC="; result += "\nPC=";
result += valueToString(myDebugger->pc()); result += invIfChanged(myDebugger->pc(), oldPC);
result += " A="; result += " A=";
result += valueToString(myDebugger->a()); result += invIfChanged(myDebugger->a(), oldA);
result += " X="; result += " X=";
result += valueToString(myDebugger->x()); result += invIfChanged(myDebugger->x(), oldX);
result += " Y="; result += " Y=";
result += valueToString(myDebugger->y()); result += invIfChanged(myDebugger->y(), oldY);
result += " S="; result += " S=";
result += valueToString(myDebugger->sp()); result += invIfChanged(myDebugger->sp(), oldS);
result += " P="; result += " P=";
result += valueToString(myDebugger->ps()); result += invIfChanged(myDebugger->ps(), oldP);
result += "/"; result += "/";
formatFlags(myDebugger->ps(), buf); formatFlags(myDebugger->ps(), buf);
result += buf; result += buf;
@ -752,3 +766,13 @@ bool Debugger::patchROM(int addr, int value) {
return myConsole->cartridge().patch(addr, value); return myConsole->cartridge().patch(addr, value);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::saveRegs() {
oldA = getA();
oldX = getX();
oldY = getY();
oldS = getSP();
oldP = getPS();
oldPC = getPC();
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Debugger.hxx,v 1.36 2005-06-29 00:31:48 urchlay Exp $ // $Id: Debugger.hxx,v 1.37 2005-07-02 15:31:30 urchlay Exp $
//============================================================================ //============================================================================
#ifndef DEBUGGER_HXX #ifndef DEBUGGER_HXX
@ -51,7 +51,7 @@ enum {
for all debugging operations in Stella (parser, 6502 debugger, etc). for all debugging operations in Stella (parser, 6502 debugger, etc).
@author Stephen Anthony @author Stephen Anthony
@version $Id: Debugger.hxx,v 1.36 2005-06-29 00:31:48 urchlay Exp $ @version $Id: Debugger.hxx,v 1.37 2005-07-02 15:31:30 urchlay Exp $
*/ */
class Debugger : public DialogContainer class Debugger : public DialogContainer
{ {
@ -84,6 +84,9 @@ class Debugger : public DialogContainer
*/ */
void setConsole(Console* console); void setConsole(Console* console);
/* save registers to oldA, oldX, etc. */
void saveRegs();
/** Convenience methods to convert to hexidecimal values */ /** Convenience methods to convert to hexidecimal values */
static char *to_hex_4(int i) static char *to_hex_4(int i)
{ {
@ -239,6 +242,8 @@ class Debugger : public DialogContainer
void loadState(int state); void loadState(int state);
protected: protected:
const string invIfChanged(int reg, int oldReg);
Console* myConsole; Console* myConsole;
System* mySystem; System* mySystem;
@ -250,6 +255,14 @@ class Debugger : public DialogContainer
PackedBitArray *writeTraps; PackedBitArray *writeTraps;
PromptWidget *myPrompt; PromptWidget *myPrompt;
TIADebug *myTIAdebug; TIADebug *myTIAdebug;
int oldA;
int oldX;
int oldY;
int oldS;
int oldP;
int oldPC;
}; };
#endif #endif

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DebuggerParser.cxx,v 1.44 2005-07-02 14:58:45 urchlay Exp $ // $Id: DebuggerParser.cxx,v 1.45 2005-07-02 15:31:30 urchlay Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -408,7 +408,6 @@ DebuggerParser::DebuggerParser(Debugger* d)
{ {
done = false; done = false;
defaultBase = kBASE_16; defaultBase = kBASE_16;
} }
DebuggerParser::~DebuggerParser() { DebuggerParser::~DebuggerParser() {
@ -1038,8 +1037,8 @@ void DebuggerParser::executeClearwatches() {
// "colortest" // "colortest"
void DebuggerParser::executeColortest() { void DebuggerParser::executeColortest() {
commandResult = "test color: "; commandResult = "test color: ";
//commandResult += char(args[0] | 0x80); commandResult += char((args[0]>>1) | 0x80);
commandResult += inverse("LA LA LA"); commandResult += inverse(" ");
} }
// "d" // "d"
@ -1183,6 +1182,7 @@ void DebuggerParser::executeRom() {
// "run" // "run"
void DebuggerParser::executeRun() { void DebuggerParser::executeRun() {
debugger->saveRegs();
debugger->quit(); debugger->quit();
commandResult = "exiting debugger"; commandResult = "exiting debugger";
} }
@ -1220,6 +1220,7 @@ void DebuggerParser::executeSavesym() {
// "step" // "step"
void DebuggerParser::executeStep() { void DebuggerParser::executeStep() {
debugger->saveRegs();
int cycles = debugger->step(); int cycles = debugger->step();
commandResult = "executed "; commandResult = "executed ";
commandResult += debugger->valueToString(cycles); commandResult += debugger->valueToString(cycles);
@ -1233,6 +1234,7 @@ void DebuggerParser::executeTia() {
// "trace" // "trace"
void DebuggerParser::executeTrace() { void DebuggerParser::executeTrace() {
debugger->saveRegs();
int cycles = debugger->trace(); int cycles = debugger->trace();
commandResult = "executed "; commandResult = "executed ";
commandResult += debugger->valueToString(cycles); commandResult += debugger->valueToString(cycles);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: DebuggerParser.hxx,v 1.24 2005-07-02 14:58:45 urchlay Exp $ // $Id: DebuggerParser.hxx,v 1.25 2005-07-02 15:31:30 urchlay Exp $
//============================================================================ //============================================================================
#ifndef DEBUGGER_PARSER_HXX #ifndef DEBUGGER_PARSER_HXX
@ -55,12 +55,12 @@ class DebuggerParser
const char *getCompletions(); const char *getCompletions();
const char *getCompletionPrefix(); const char *getCompletionPrefix();
static inline string red(string msg) { static inline string red(string msg ="") {
// This is TIA color 0x34. The octal value is 0x80+(0x34>>1). // This is TIA color 0x34. The octal value is 0x80+(0x34>>1).
return "\232" + msg; return "\232" + msg;
} }
static inline string inverse(string msg) { static inline string inverse(string msg ="") {
// ASCII DEL char, decimal 127 // ASCII DEL char, decimal 127
return "\177" + msg; return "\177" + msg;
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: PromptWidget.cxx,v 1.21 2005-07-02 14:58:45 urchlay Exp $ // $Id: PromptWidget.cxx,v 1.22 2005-07-02 15:31:30 urchlay Exp $
// //
// Based on code from ScummVM - Scumm Interpreter // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -833,9 +833,10 @@ bool PromptWidget::saveBuffer(string& filename)
while(_buffer[end] == ' ' && end >= start) while(_buffer[end] == ' ' && end >= start)
end--; end--;
// spit out the line minus its trailing spaces // spit out the line minus its trailing spaces.
// Strip off any color/inverse bits
for(int j=start; j<=end; j++) for(int j=start; j<=end; j++)
out << _buffer[j]; out << (_buffer[j] & 0xff);
// add a \n // add a \n
out << endl; out << endl;