mirror of https://github.com/stella-emu/stella.git
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:
parent
31708d4a7f
commit
584baab7d1
|
@ -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.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"
|
||||
|
@ -54,6 +54,8 @@ Debugger::Debugger(OSystem* osystem)
|
|||
breakPoints = new PackedBitArray(0x10000);
|
||||
readTraps = 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);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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()
|
||||
{
|
||||
|
@ -190,17 +204,17 @@ const string Debugger::state()
|
|||
|
||||
//cerr << "state(): pc is " << myDebugger->pc() << endl;
|
||||
result += "\nPC=";
|
||||
result += valueToString(myDebugger->pc());
|
||||
result += invIfChanged(myDebugger->pc(), oldPC);
|
||||
result += " A=";
|
||||
result += valueToString(myDebugger->a());
|
||||
result += invIfChanged(myDebugger->a(), oldA);
|
||||
result += " X=";
|
||||
result += valueToString(myDebugger->x());
|
||||
result += invIfChanged(myDebugger->x(), oldX);
|
||||
result += " Y=";
|
||||
result += valueToString(myDebugger->y());
|
||||
result += invIfChanged(myDebugger->y(), oldY);
|
||||
result += " S=";
|
||||
result += valueToString(myDebugger->sp());
|
||||
result += invIfChanged(myDebugger->sp(), oldS);
|
||||
result += " P=";
|
||||
result += valueToString(myDebugger->ps());
|
||||
result += invIfChanged(myDebugger->ps(), oldP);
|
||||
result += "/";
|
||||
formatFlags(myDebugger->ps(), buf);
|
||||
result += buf;
|
||||
|
@ -752,3 +766,13 @@ bool Debugger::patchROM(int addr, int value) {
|
|||
return myConsole->cartridge().patch(addr, value);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::saveRegs() {
|
||||
oldA = getA();
|
||||
oldX = getX();
|
||||
oldY = getY();
|
||||
oldS = getSP();
|
||||
oldP = getPS();
|
||||
oldPC = getPC();
|
||||
}
|
||||
|
||||
|
|
|
@ -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.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
|
||||
|
@ -51,7 +51,7 @@ enum {
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@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
|
||||
{
|
||||
|
@ -84,6 +84,9 @@ class Debugger : public DialogContainer
|
|||
*/
|
||||
void setConsole(Console* console);
|
||||
|
||||
/* save registers to oldA, oldX, etc. */
|
||||
void saveRegs();
|
||||
|
||||
/** Convenience methods to convert to hexidecimal values */
|
||||
static char *to_hex_4(int i)
|
||||
{
|
||||
|
@ -239,6 +242,8 @@ class Debugger : public DialogContainer
|
|||
void loadState(int state);
|
||||
|
||||
protected:
|
||||
const string invIfChanged(int reg, int oldReg);
|
||||
|
||||
Console* myConsole;
|
||||
System* mySystem;
|
||||
|
||||
|
@ -250,6 +255,14 @@ class Debugger : public DialogContainer
|
|||
PackedBitArray *writeTraps;
|
||||
PromptWidget *myPrompt;
|
||||
TIADebug *myTIAdebug;
|
||||
|
||||
int oldA;
|
||||
int oldX;
|
||||
int oldY;
|
||||
int oldS;
|
||||
int oldP;
|
||||
int oldPC;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.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"
|
||||
|
@ -408,7 +408,6 @@ DebuggerParser::DebuggerParser(Debugger* d)
|
|||
{
|
||||
done = false;
|
||||
defaultBase = kBASE_16;
|
||||
|
||||
}
|
||||
|
||||
DebuggerParser::~DebuggerParser() {
|
||||
|
@ -1038,8 +1037,8 @@ void DebuggerParser::executeClearwatches() {
|
|||
// "colortest"
|
||||
void DebuggerParser::executeColortest() {
|
||||
commandResult = "test color: ";
|
||||
//commandResult += char(args[0] | 0x80);
|
||||
commandResult += inverse("LA LA LA");
|
||||
commandResult += char((args[0]>>1) | 0x80);
|
||||
commandResult += inverse(" ");
|
||||
}
|
||||
|
||||
// "d"
|
||||
|
@ -1183,6 +1182,7 @@ void DebuggerParser::executeRom() {
|
|||
|
||||
// "run"
|
||||
void DebuggerParser::executeRun() {
|
||||
debugger->saveRegs();
|
||||
debugger->quit();
|
||||
commandResult = "exiting debugger";
|
||||
}
|
||||
|
@ -1220,6 +1220,7 @@ void DebuggerParser::executeSavesym() {
|
|||
|
||||
// "step"
|
||||
void DebuggerParser::executeStep() {
|
||||
debugger->saveRegs();
|
||||
int cycles = debugger->step();
|
||||
commandResult = "executed ";
|
||||
commandResult += debugger->valueToString(cycles);
|
||||
|
@ -1233,6 +1234,7 @@ void DebuggerParser::executeTia() {
|
|||
|
||||
// "trace"
|
||||
void DebuggerParser::executeTrace() {
|
||||
debugger->saveRegs();
|
||||
int cycles = debugger->trace();
|
||||
commandResult = "executed ";
|
||||
commandResult += debugger->valueToString(cycles);
|
||||
|
|
|
@ -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.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
|
||||
|
@ -55,12 +55,12 @@ class DebuggerParser
|
|||
const char *getCompletions();
|
||||
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).
|
||||
return "\232" + msg;
|
||||
}
|
||||
|
||||
static inline string inverse(string msg) {
|
||||
static inline string inverse(string msg ="") {
|
||||
// ASCII DEL char, decimal 127
|
||||
return "\177" + msg;
|
||||
}
|
||||
|
|
|
@ -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: 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
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -833,9 +833,10 @@ bool PromptWidget::saveBuffer(string& filename)
|
|||
while(_buffer[end] == ' ' && end >= start)
|
||||
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++)
|
||||
out << _buffer[j];
|
||||
out << (_buffer[j] & 0xff);
|
||||
|
||||
// add a \n
|
||||
out << endl;
|
||||
|
|
Loading…
Reference in New Issue