Converted TIADebug to be a DebuggerSystem object. There's some strange

stuff going on in the TIA class ...


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@625 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-07-08 17:22:41 +00:00
parent 6aa2830d71
commit 0bcf843c89
8 changed files with 358 additions and 298 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: CpuDebug.cxx,v 1.2 2005-07-08 14:36:17 stephena Exp $ // $Id: CpuDebug.cxx,v 1.3 2005-07-08 17:22:40 stephena Exp $
//============================================================================ //============================================================================
#include "Array.hxx" #include "Array.hxx"
@ -27,7 +27,6 @@ CpuDebug::CpuDebug(Debugger* dbg, Console* console)
: DebuggerSystem(dbg, console), : DebuggerSystem(dbg, console),
mySystem(&(console->system())) mySystem(&(console->system()))
{ {
saveOldState();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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.56 2005-07-08 14:36:17 stephena Exp $ // $Id: Debugger.cxx,v 1.57 2005-07-08 17:22:40 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -45,7 +45,7 @@ Debugger::Debugger(OSystem* osystem)
myParser(NULL), myParser(NULL),
myCpuDebug(NULL), myCpuDebug(NULL),
myRamDebug(NULL), myRamDebug(NULL),
myTIAdebug(NULL), myTiaDebug(NULL),
equateList(NULL), equateList(NULL),
breakPoints(NULL), breakPoints(NULL),
readTraps(NULL), readTraps(NULL),
@ -66,7 +66,7 @@ Debugger::~Debugger()
delete myCpuDebug; delete myCpuDebug;
delete myRamDebug; delete myRamDebug;
delete myTIAdebug; delete myTiaDebug;
delete equateList; delete equateList;
delete breakPoints; delete breakPoints;
@ -134,13 +134,8 @@ void Debugger::setConsole(Console* console)
delete myRamDebug; delete myRamDebug;
myRamDebug = new RamDebug(this, myConsole); myRamDebug = new RamDebug(this, myConsole);
// Create a new TIA debugger for this console delete myTiaDebug;
// This code is somewhat ugly, since we derive a TIA from the MediaSource myTiaDebug = new TIADebug(this, myConsole);
// for no particular reason. Maybe it's better to make the TIA be the
// base class and entirely eliminate MediaSource class??
delete myTIAdebug;
myTIAdebug = new TIADebug((TIA*)&myConsole->mediaSource());
myTIAdebug->setDebugger(this);
autoLoadSymbols(myOSystem->romFile()); autoLoadSymbols(myOSystem->romFile());
@ -243,10 +238,10 @@ const string Debugger::cpuState()
sprintf(buf, "%d", mySystem->cycles()); sprintf(buf, "%d", mySystem->cycles());
result += buf; result += buf;
result += " Scan:"; result += " Scan:";
sprintf(buf, "%d", myTIAdebug->scanlines()); sprintf(buf, "%d", myTiaDebug->scanlines());
result += buf; result += buf;
result += " Frame:"; result += " Frame:";
sprintf(buf, "%d", myTIAdebug->frameCount()); sprintf(buf, "%d", myTiaDebug->frameCount());
result += buf; result += buf;
result += " 6502Ins:"; result += " 6502Ins:";
sprintf(buf, "%d", mySystem->m6502().totalInstructionCount()); sprintf(buf, "%d", mySystem->m6502().totalInstructionCount());
@ -472,7 +467,7 @@ const string Debugger::dumpTIA()
} }
result += "\n"; result += "\n";
result += myTIAdebug->state(); result += myTiaDebug->state();
return result; return result;
} }
@ -523,8 +518,12 @@ int Debugger::step()
int cyc = mySystem->cycles(); int cyc = mySystem->cycles();
mySystem->m6502().execute(1); mySystem->m6502().execute(1);
myTIAdebug->updateTIA();
// FIXME - this doesn't work yet, pending a partial rewrite of TIA class
myTiaDebug->updateTIA();
myOSystem->frameBuffer().refreshTIA(true); myOSystem->frameBuffer().refreshTIA(true);
///////////////////////////////////////////////////////
return mySystem->cycles() - cyc; return mySystem->cycles() - cyc;
} }
@ -551,8 +550,12 @@ int Debugger::trace()
int targetPC = myCpuDebug->pc() + 3; // return address int targetPC = myCpuDebug->pc() + 3; // return address
while(myCpuDebug->pc() != targetPC) while(myCpuDebug->pc() != targetPC)
mySystem->m6502().execute(1); mySystem->m6502().execute(1);
myTIAdebug->updateTIA();
// FIXME - this doesn't work yet, pending a partial rewrite of TIA class
myTiaDebug->updateTIA();
myOSystem->frameBuffer().refreshTIA(true); myOSystem->frameBuffer().refreshTIA(true);
///////////////////////////////////////////////////////
return mySystem->cycles() - cyc; return mySystem->cycles() - cyc;
} else { } else {
return step(); return step();
@ -741,4 +744,5 @@ void Debugger::saveOldState()
{ {
myCpuDebug->saveOldState(); myCpuDebug->saveOldState();
myRamDebug->saveOldState(); myRamDebug->saveOldState();
myTiaDebug->saveOldState();
} }

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.45 2005-07-08 14:36:17 stephena Exp $ // $Id: Debugger.hxx,v 1.46 2005-07-08 17:22:40 stephena Exp $
//============================================================================ //============================================================================
#ifndef DEBUGGER_HXX #ifndef DEBUGGER_HXX
@ -53,7 +53,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.45 2005-07-08 14:36:17 stephena Exp $ @version $Id: Debugger.hxx,v 1.46 2005-07-08 17:22:40 stephena Exp $
*/ */
class Debugger : public DialogContainer class Debugger : public DialogContainer
{ {
@ -104,7 +104,7 @@ class Debugger : public DialogContainer
/** /**
The debugger subsystem responsible for all TIA state The debugger subsystem responsible for all TIA state
*/ */
TIADebug& tiaDebug() { return *myTIAdebug; } TIADebug& tiaDebug() { return *myTiaDebug; }
/** 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)
@ -236,7 +236,7 @@ class Debugger : public DialogContainer
DebuggerParser* myParser; DebuggerParser* myParser;
CpuDebug* myCpuDebug; CpuDebug* myCpuDebug;
RamDebug* myRamDebug; RamDebug* myRamDebug;
TIADebug* myTIAdebug; TIADebug* myTiaDebug;
EquateList *equateList; EquateList *equateList;
PackedBitArray *breakPoints; PackedBitArray *breakPoints;

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: RamDebug.cxx,v 1.3 2005-07-08 14:36:17 stephena Exp $ // $Id: RamDebug.cxx,v 1.4 2005-07-08 17:22:40 stephena Exp $
//============================================================================ //============================================================================
#include "Array.hxx" #include "Array.hxx"
@ -25,7 +25,6 @@ RamDebug::RamDebug(Debugger* dbg, Console* console)
: DebuggerSystem(dbg, console), : DebuggerSystem(dbg, console),
mySystem(&(console->system())) mySystem(&(console->system()))
{ {
saveOldState();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,312 +13,345 @@
// 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: TIADebug.cxx,v 1.8 2005-07-03 08:56:48 urchlay Exp $ // $Id: TIADebug.cxx,v 1.9 2005-07-08 17:22:40 stephena Exp $
//============================================================================ //============================================================================
#include "TIADebug.hxx"
#include "System.hxx" #include "System.hxx"
#include "Debugger.hxx" #include "Debugger.hxx"
TIADebug::TIADebug(TIA *tia) { #include "TIADebug.hxx"
myTIA = tia;
nusizStrings[0] = "size=8 copy=1"; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
nusizStrings[1] = "size=8 copy=2 spac=8"; TIADebug::TIADebug(Debugger* dbg, Console* console)
nusizStrings[2] = "size=8 copy=2 spac=$18"; : DebuggerSystem(dbg, console),
nusizStrings[3] = "size=8 copy=3 spac=8"; mySystem(&console->system()),
nusizStrings[4] = "size=8 copy=2 spac=$38"; myTIA((TIA*)&console->mediaSource())
nusizStrings[5] = "size=$10 copy=1"; {
nusizStrings[6] = "size=8 copy=3 spac=$18"; nusizStrings[0] = "size=8 copy=1";
nusizStrings[7] = "size=$20 copy=1"; nusizStrings[1] = "size=8 copy=2 spac=8";
nusizStrings[2] = "size=8 copy=2 spac=$18";
nusizStrings[3] = "size=8 copy=3 spac=8";
nusizStrings[4] = "size=8 copy=2 spac=$38";
nusizStrings[5] = "size=$10 copy=1";
nusizStrings[6] = "size=8 copy=3 spac=$18";
nusizStrings[7] = "size=$20 copy=1";
} }
TIADebug::~TIADebug() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DebuggerState& TIADebug::getState()
{
myState.ram.clear();
for(int i = 0; i < 0x010; ++i)
myState.ram.push_back(mySystem->peek(i));
return myState;
} }
void TIADebug::setDebugger(Debugger *d) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
myDebugger = d; void TIADebug::saveOldState()
{
myOldState.ram.clear();
for(int i = 0; i < 0x010; ++i)
myOldState.ram.push_back(mySystem->peek(i));
} }
int TIADebug::frameCount() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return myTIA->myFrameCounter; int TIADebug::frameCount()
{
return myTIA->myFrameCounter;
} }
int TIADebug::scanlines() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return myTIA->scanlines(); int TIADebug::scanlines()
{
return myTIA->scanlines();
} }
bool TIADebug::vsync() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return (myTIA->myVSYNC & 2) == 2; bool TIADebug::vsync()
{
return (myTIA->myVSYNC & 2) == 2;
} }
bool TIADebug::vblank() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
return (myTIA->myVBLANK & 2) == 2; bool TIADebug::vblank()
{
return (myTIA->myVBLANK & 2) == 2;
} }
void TIADebug::updateTIA() { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::updateTIA()
{
// not working the way I expected: // not working the way I expected:
// myTIA->updateFrame(myTIA->mySystem->cycles() * 3); // myTIA->updateFrame(myTIA->mySystem->cycles() * 3);
} }
string TIADebug::colorSwatch(uInt8 c) { // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string ret; string TIADebug::colorSwatch(uInt8 c)
{
string ret;
ret += char((c >> 1) | 0x80); ret += char((c >> 1) | 0x80);
ret += "\177 "; ret += "\177 ";
ret += "\177\003 "; ret += "\177\003 ";
return ret; return ret;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string audFreq(uInt8 div) { const string audFreq(uInt8 div)
string ret; {
char buf[20]; string ret;
char buf[20];
double hz = 30000.0; double hz = 30000.0;
if(div) hz /= div; if(div) hz /= div;
sprintf(buf, "%5.1f", hz); sprintf(buf, "%5.1f", hz);
ret += buf; ret += buf;
ret += "Hz"; ret += "Hz";
return ret;
return ret;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string booleanWithLabel(string label, bool value) { const string booleanWithLabel(string label, bool value)
char buf[64]; {
string ret; char buf[64];
string ret;
if(value) { if(value)
char *p = buf; {
const char *q = label.c_str(); char *p = buf;
while((*p++ = toupper(*q++))) const char *q = label.c_str();
; while((*p++ = toupper(*q++)))
ret += "+"; ;
ret += buf; ret += "+";
return ret; ret += buf;
} else { return ret;
return "-" + label; }
} else
return "-" + label;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string TIADebug::state() { string TIADebug::state()
string ret; {
string ret;
// TODO: inverse video for changed regs. Core needs to track this. // TODO: inverse video for changed regs. Core needs to track this.
// TODO: strobes? WSYNC RSYNC RESP0/1 RESM0/1 RESBL HMOVE HMCLR CXCLR // 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 // TIA::myCOLUxx are stored 4 copies to each int, we need only 1
uInt8 COLUP0 = myTIA->myCOLUP0 & 0xff; uInt8 COLUP0 = myTIA->myCOLUP0 & 0xff;
uInt8 COLUP1 = myTIA->myCOLUP1 & 0xff; uInt8 COLUP1 = myTIA->myCOLUP1 & 0xff;
uInt8 COLUPF = myTIA->myCOLUPF & 0xff; uInt8 COLUPF = myTIA->myCOLUPF & 0xff;
uInt8 COLUBK = myTIA->myCOLUBK & 0xff; uInt8 COLUBK = myTIA->myCOLUBK & 0xff;
// TIA::myPF holds all 3 PFx regs, we shall extract // TIA::myPF holds all 3 PFx regs, we shall extract
int PF = myTIA->myPF; int PF = myTIA->myPF;
uInt8 PF0 = PF & 0x0f; uInt8 PF0 = PF & 0x0f;
uInt8 PF1 = (PF >> 4) & 0xff; uInt8 PF1 = (PF >> 4) & 0xff;
uInt8 PF2 = (PF >> 12) & 0xff; uInt8 PF2 = (PF >> 12) & 0xff;
// Hope Brad never changes this: // Hope Brad never changes this:
uInt16 coll = myTIA->myCollision; uInt16 coll = myTIA->myCollision;
// calculate sizes // calculate sizes
uInt8 ballSize = 1 << (myTIA->myCTRLPF & 0x18); uInt8 ballSize = 1 << (myTIA->myCTRLPF & 0x18);
uInt8 m0Size = 1 << (myTIA->myNUSIZ0 & 0x18); uInt8 m0Size = 1 << (myTIA->myNUSIZ0 & 0x18);
uInt8 m1Size = 1 << (myTIA->myNUSIZ1 & 0x18); uInt8 m1Size = 1 << (myTIA->myNUSIZ1 & 0x18);
// easier to use a table for these: // easier to use a table for these:
string p0Size = nusizStrings[myTIA->myNUSIZ0 & 0x07]; string p0Size = nusizStrings[myTIA->myNUSIZ0 & 0x07];
string p1Size = nusizStrings[myTIA->myNUSIZ1 & 0x07]; string p1Size = nusizStrings[myTIA->myNUSIZ1 & 0x07];
// build up output, then return it. // build up output, then return it.
ret += "scanline "; ret += "scanline ";
ret += myDebugger->valueToString(myTIA->scanlines()); ret += myDebugger->valueToString(myTIA->scanlines());
ret += " "; ret += " ";
ret += booleanWithLabel("vsync", vsync()); ret += booleanWithLabel("vsync", vsync());
ret += " "; ret += " ";
ret += booleanWithLabel("vblank", vblank()); ret += booleanWithLabel("vblank", vblank());
ret += "\n"; ret += "\n";
ret += booleanWithLabel("inpt0", myTIA->peek(0x08) & 0x80); ret += booleanWithLabel("inpt0", myTIA->peek(0x08) & 0x80);
ret += " "; ret += " ";
ret += booleanWithLabel("inpt1", myTIA->peek(0x09) & 0x80); ret += booleanWithLabel("inpt1", myTIA->peek(0x09) & 0x80);
ret += " "; ret += " ";
ret += booleanWithLabel("inpt2", myTIA->peek(0x0a) & 0x80); ret += booleanWithLabel("inpt2", myTIA->peek(0x0a) & 0x80);
ret += " "; ret += " ";
ret += booleanWithLabel("inpt3", myTIA->peek(0x0b) & 0x80); ret += booleanWithLabel("inpt3", myTIA->peek(0x0b) & 0x80);
ret += " "; ret += " ";
ret += booleanWithLabel("inpt4", myTIA->peek(0x0c) & 0x80); ret += booleanWithLabel("inpt4", myTIA->peek(0x0c) & 0x80);
ret += " "; ret += " ";
ret += booleanWithLabel("inpt5", myTIA->peek(0x0d) & 0x80); ret += booleanWithLabel("inpt5", myTIA->peek(0x0d) & 0x80);
ret += " "; ret += " ";
ret += booleanWithLabel("dump_gnd_0123", myTIA->myDumpEnabled); ret += booleanWithLabel("dump_gnd_0123", myTIA->myDumpEnabled);
ret += "\n"; ret += "\n";
ret += "COLUP0: "; ret += "COLUP0: ";
ret += myDebugger->valueToString(COLUP0); ret += myDebugger->valueToString(COLUP0);
ret += "/"; ret += "/";
ret += colorSwatch(COLUP0); ret += colorSwatch(COLUP0);
ret += "COLUP1: "; ret += "COLUP1: ";
ret += myDebugger->valueToString(COLUP1); ret += myDebugger->valueToString(COLUP1);
ret += "/"; ret += "/";
ret += colorSwatch(COLUP1); ret += colorSwatch(COLUP1);
ret += "COLUPF: "; ret += "COLUPF: ";
ret += myDebugger->valueToString(COLUPF); ret += myDebugger->valueToString(COLUPF);
ret += "/"; ret += "/";
ret += colorSwatch(COLUPF); ret += colorSwatch(COLUPF);
ret += "COLUBK: "; ret += "COLUBK: ";
ret += myDebugger->valueToString(COLUBK); ret += myDebugger->valueToString(COLUBK);
ret += "/"; ret += "/";
ret += colorSwatch(COLUBK); ret += colorSwatch(COLUBK);
ret += "\n"; ret += "\n";
ret += "P0: GR="; ret += "P0: GR=";
// TODO: ret += myDebugger->invIfChanged(myTIA->myGRP0, oldGRP0); // TODO: ret += myDebugger->invIfChanged(myTIA->myGRP0, oldGRP0);
ret += Debugger::to_bin_8(myTIA->myGRP0); ret += Debugger::to_bin_8(myTIA->myGRP0);
ret += "/"; ret += "/";
ret += myDebugger->valueToString(myTIA->myGRP0); ret += myDebugger->valueToString(myTIA->myGRP0);
ret += " pos="; ret += " pos=";
ret += myDebugger->valueToString(myTIA->myPOSP0); ret += myDebugger->valueToString(myTIA->myPOSP0);
ret += " HM="; ret += " HM=";
ret += myDebugger->valueToString(myTIA->myHMP0); ret += myDebugger->valueToString(myTIA->myHMP0);
ret += " "; ret += " ";
ret += p0Size; ret += p0Size;
ret += " "; ret += " ";
ret += booleanWithLabel("reflect", (myTIA->myREFP0)); ret += booleanWithLabel("reflect", (myTIA->myREFP0));
ret += " "; ret += " ";
ret += booleanWithLabel("delay", (myTIA->myVDELP0)); ret += booleanWithLabel("delay", (myTIA->myVDELP0));
ret += "\n"; ret += "\n";
ret += "P1: GR="; ret += "P1: GR=";
// TODO: ret += myDebugger->invIfChanged(myTIA->myGRP1, oldGRP1); // TODO: ret += myDebugger->invIfChanged(myTIA->myGRP1, oldGRP1);
ret += Debugger::to_bin_8(myTIA->myGRP1); ret += Debugger::to_bin_8(myTIA->myGRP1);
ret += "/"; ret += "/";
ret += myDebugger->valueToString(myTIA->myGRP1); ret += myDebugger->valueToString(myTIA->myGRP1);
ret += " pos="; ret += " pos=";
ret += myDebugger->valueToString(myTIA->myPOSP1); ret += myDebugger->valueToString(myTIA->myPOSP1);
ret += " HM="; ret += " HM=";
ret += myDebugger->valueToString(myTIA->myHMP1); ret += myDebugger->valueToString(myTIA->myHMP1);
ret += " "; ret += " ";
ret += p1Size; ret += p1Size;
ret += " "; ret += " ";
ret += booleanWithLabel("reflect", (myTIA->myREFP1)); ret += booleanWithLabel("reflect", (myTIA->myREFP1));
ret += " "; ret += " ";
ret += booleanWithLabel("delay", (myTIA->myVDELP1)); ret += booleanWithLabel("delay", (myTIA->myVDELP1));
ret += "\n"; ret += "\n";
ret += "M0: "; ret += "M0: ";
ret += (myTIA->myENAM0 ? " ENABLED" : "disabled"); ret += (myTIA->myENAM0 ? " ENABLED" : "disabled");
ret += " pos="; ret += " pos=";
ret += myDebugger->valueToString(myTIA->myPOSM0); ret += myDebugger->valueToString(myTIA->myPOSM0);
ret += " HM="; ret += " HM=";
ret += myDebugger->valueToString(myTIA->myHMM0); ret += myDebugger->valueToString(myTIA->myHMM0);
ret += " size="; ret += " size=";
ret += myDebugger->valueToString(m0Size); ret += myDebugger->valueToString(m0Size);
ret += " "; ret += " ";
ret += booleanWithLabel("reset", (myTIA->myRESMP0)); ret += booleanWithLabel("reset", (myTIA->myRESMP0));
ret += "\n"; ret += "\n";
ret += "M1: "; ret += "M1: ";
ret += (myTIA->myENAM1 ? " ENABLED" : "disabled"); ret += (myTIA->myENAM1 ? " ENABLED" : "disabled");
ret += " pos="; ret += " pos=";
ret += myDebugger->valueToString(myTIA->myPOSM1); ret += myDebugger->valueToString(myTIA->myPOSM1);
ret += " HM="; ret += " HM=";
ret += myDebugger->valueToString(myTIA->myHMM1); ret += myDebugger->valueToString(myTIA->myHMM1);
ret += " size="; ret += " size=";
ret += myDebugger->valueToString(m1Size); ret += myDebugger->valueToString(m1Size);
ret += " "; ret += " ";
ret += booleanWithLabel("reset", (myTIA->myRESMP1)); ret += booleanWithLabel("reset", (myTIA->myRESMP1));
ret += "\n"; ret += "\n";
ret += "BL: "; ret += "BL: ";
ret += (myTIA->myENABL ? " ENABLED" : "disabled"); ret += (myTIA->myENABL ? " ENABLED" : "disabled");
ret += " pos="; ret += " pos=";
ret += myDebugger->valueToString(myTIA->myPOSBL); ret += myDebugger->valueToString(myTIA->myPOSBL);
ret += " HM="; ret += " HM=";
ret += myDebugger->valueToString(myTIA->myHMBL); ret += myDebugger->valueToString(myTIA->myHMBL);
ret += " size="; ret += " size=";
ret += myDebugger->valueToString(ballSize); ret += myDebugger->valueToString(ballSize);
ret += " "; ret += " ";
ret += booleanWithLabel("delay", (myTIA->myVDELBL)); ret += booleanWithLabel("delay", (myTIA->myVDELBL));
ret += "\n"; ret += "\n";
ret += "PF0: "; ret += "PF0: ";
ret += Debugger::to_bin_8(PF0); ret += Debugger::to_bin_8(PF0);
ret += "/"; ret += "/";
ret += myDebugger->valueToString(PF0); ret += myDebugger->valueToString(PF0);
ret += " PF1: "; ret += " PF1: ";
ret += Debugger::to_bin_8(PF1); ret += Debugger::to_bin_8(PF1);
ret += "/"; ret += "/";
ret += myDebugger->valueToString(PF1); ret += myDebugger->valueToString(PF1);
ret += " PF2: "; ret += " PF2: ";
ret += Debugger::to_bin_8(PF2); ret += Debugger::to_bin_8(PF2);
ret += "/"; ret += "/";
ret += myDebugger->valueToString(PF2); ret += myDebugger->valueToString(PF2);
ret += "\n "; ret += "\n ";
ret += booleanWithLabel("reflect", myTIA->myCTRLPF & 0x01); ret += booleanWithLabel("reflect", myTIA->myCTRLPF & 0x01);
ret += " "; ret += " ";
ret += booleanWithLabel("score", myTIA->myCTRLPF & 0x02); ret += booleanWithLabel("score", myTIA->myCTRLPF & 0x02);
ret += " "; ret += " ";
ret += booleanWithLabel("priority", myTIA->myCTRLPF & 0x04); ret += booleanWithLabel("priority", myTIA->myCTRLPF & 0x04);
ret += "\n"; ret += "\n";
ret += "Collisions: "; ret += "Collisions: ";
ret += booleanWithLabel("m0_p1 ", bool(coll & 0x0001)); ret += booleanWithLabel("m0_p1 ", bool(coll & 0x0001));
ret += booleanWithLabel("m0_p0 ", bool(coll & 0x0002)); ret += booleanWithLabel("m0_p0 ", bool(coll & 0x0002));
ret += booleanWithLabel("m1_p0 ", bool(coll & 0x0004)); ret += booleanWithLabel("m1_p0 ", bool(coll & 0x0004));
ret += booleanWithLabel("m1_p1 ", bool(coll & 0x0008)); ret += booleanWithLabel("m1_p1 ", bool(coll & 0x0008));
ret += booleanWithLabel("p0_pf ", bool(coll & 0x0010)); ret += booleanWithLabel("p0_pf ", bool(coll & 0x0010));
ret += booleanWithLabel("p0_bl ", bool(coll & 0x0020)); ret += booleanWithLabel("p0_bl ", bool(coll & 0x0020));
ret += booleanWithLabel("p1_pf ", bool(coll & 0x0040)); ret += booleanWithLabel("p1_pf ", bool(coll & 0x0040));
ret += "\n "; ret += "\n ";
ret += booleanWithLabel("p1_bl ", bool(coll & 0x0080)); ret += booleanWithLabel("p1_bl ", bool(coll & 0x0080));
ret += booleanWithLabel("m0_pf ", bool(coll & 0x0100)); ret += booleanWithLabel("m0_pf ", bool(coll & 0x0100));
ret += booleanWithLabel("m0_bl ", bool(coll & 0x0200)); ret += booleanWithLabel("m0_bl ", bool(coll & 0x0200));
ret += booleanWithLabel("m1_pf ", bool(coll & 0x0400)); ret += booleanWithLabel("m1_pf ", bool(coll & 0x0400));
ret += booleanWithLabel("m1_bl ", bool(coll & 0x0800)); ret += booleanWithLabel("m1_bl ", bool(coll & 0x0800));
ret += booleanWithLabel("bl_pf ", bool(coll & 0x1000)); ret += booleanWithLabel("bl_pf ", bool(coll & 0x1000));
ret += booleanWithLabel("p0_p1 ", bool(coll & 0x2000)); ret += booleanWithLabel("p0_p1 ", bool(coll & 0x2000));
ret += booleanWithLabel("m0_m1 ", bool(coll & 0x4000)); ret += booleanWithLabel("m0_m1 ", bool(coll & 0x4000));
ret += "\n"; ret += "\n";
ret += "AUDF0: "; ret += "AUDF0: ";
ret += myDebugger->valueToString(myTIA->myAUDF0); ret += myDebugger->valueToString(myTIA->myAUDF0);
ret += "/"; ret += "/";
ret += audFreq(myTIA->myAUDF0); ret += audFreq(myTIA->myAUDF0);
ret += " "; ret += " ";
ret += "AUDC0: "; ret += "AUDC0: ";
ret += myDebugger->valueToString(myTIA->myAUDC0); ret += myDebugger->valueToString(myTIA->myAUDC0);
ret += " "; ret += " ";
ret += "AUDV0: "; ret += "AUDV0: ";
ret += myDebugger->valueToString(myTIA->myAUDV0); ret += myDebugger->valueToString(myTIA->myAUDV0);
ret += "\n"; ret += "\n";
ret += "AUDF1: "; ret += "AUDF1: ";
ret += myDebugger->valueToString(myTIA->myAUDF1); ret += myDebugger->valueToString(myTIA->myAUDF1);
ret += "/"; ret += "/";
ret += audFreq(myTIA->myAUDF1); ret += audFreq(myTIA->myAUDF1);
ret += " "; ret += " ";
ret += "AUDC0: "; ret += "AUDC0: ";
ret += myDebugger->valueToString(myTIA->myAUDC1); ret += myDebugger->valueToString(myTIA->myAUDC1);
ret += " "; ret += " ";
ret += "AUDV0: "; ret += "AUDV0: ";
ret += myDebugger->valueToString(myTIA->myAUDV1); ret += myDebugger->valueToString(myTIA->myAUDV1);
//ret += "\n"; //ret += "\n";
// note: last "ret +=" line should not contain \n, caller will add. // note: last "ret +=" line should not contain \n, caller will add.
return ret;
return ret;
} }

View File

@ -13,37 +13,54 @@
// 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: TIADebug.hxx,v 1.5 2005-07-03 01:36:39 urchlay Exp $ // $Id: TIADebug.hxx,v 1.6 2005-07-08 17:22:40 stephena Exp $
//============================================================================ //============================================================================
#ifndef TIADEBUG_HXX #ifndef TIA_DEBUG_HXX
#define TIADEBUG_HXX #define TIA_DEBUG_HXX
#include "TIA.hxx" class TIA;
#include "Debugger.hxx" class Debugger;
class TIADebug { #include "Array.hxx"
public: #include "DebuggerSystem.hxx"
TIADebug(TIA *tia);
~TIADebug();
void setDebugger(Debugger *d); class TiaState : public DebuggerState
{
int scanlines(); public:
int frameCount(); IntArray ram;
bool vsync();
bool vblank();
void updateTIA();
string state();
private:
TIA *myTIA;
Debugger *myDebugger;
string colorSwatch(uInt8 c);
string nusizStrings[8];
}; };
class TIADebug : public DebuggerSystem
{
public:
TIADebug(Debugger* dbg, Console* console);
DebuggerState& getState();
DebuggerState& getOldState() { return myOldState; }
void saveOldState();
// FIXME - add whole slew of setXXX() methods
int scanlines();
int frameCount();
bool vsync();
bool vblank();
void updateTIA();
string state();
private:
string colorSwatch(uInt8 c);
private:
TiaState myState;
TiaState myOldState;
System* mySystem;
TIA* myTIA;
string nusizStrings[8];
};
#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: DebuggerDialog.cxx,v 1.22 2005-07-06 15:09:16 stephena Exp $ // $Id: DebuggerDialog.cxx,v 1.23 2005-07-08 17:22:41 stephena 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
@ -72,7 +72,7 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent,
// 5) The TIA tab // 5) The TIA tab
myTab->addTab("TIA"); myTab->addTab("TIA");
TiaWidget* tia = new TiaWidget(myTab, 2, 2, vWidth - vBorder, _h - 25); TiaWidget* tia = new TiaWidget(myTab, 2, 2, vWidth - vBorder, _h - 25);
myTab->setParentWidget(3, tia, tia->activeWidget()); myTab->setParentWidget(4, tia, tia->activeWidget());
// 6) The ROM tab // 6) The ROM tab

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: TiaWidget.cxx,v 1.5 2005-07-07 15:19:04 stephena Exp $ // $Id: TiaWidget.cxx,v 1.6 2005-07-08 17:22:41 stephena 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
@ -23,7 +23,7 @@
#include "FrameBuffer.hxx" #include "FrameBuffer.hxx"
#include "GuiUtils.hxx" #include "GuiUtils.hxx"
#include "GuiObject.hxx" #include "GuiObject.hxx"
#include "Debugger.hxx" #include "TIADebug.hxx"
#include "Widget.hxx" #include "Widget.hxx"
#include "EditTextWidget.hxx" #include "EditTextWidget.hxx"
#include "DataGridWidget.hxx" #include "DataGridWidget.hxx"
@ -191,6 +191,7 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
} }
// FIXME - maybe issue a full reload, since changing one item can affect // FIXME - maybe issue a full reload, since changing one item can affect
// others in this tab?? // others in this tab??
loadConfig();
break; break;
case kDGSelectionChangedCmd: case kDGSelectionChangedCmd:
@ -231,6 +232,7 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaWidget::loadConfig() void TiaWidget::loadConfig()
{ {
cerr << "TiaWidget::loadConfig()\n";
fillGrid(); fillGrid();
} }
@ -238,18 +240,21 @@ void TiaWidget::loadConfig()
void TiaWidget::fillGrid() void TiaWidget::fillGrid()
{ {
// FIXME - have these widget get correct values from TIADebug // FIXME - have these widget get correct values from TIADebug
Debugger& dbg = instance()->debugger();
IntArray alist; IntArray alist;
IntArray vlist; IntArray vlist;
BoolArray changed; BoolArray changed;
TIADebug& tia = instance()->debugger().tiaDebug();
TiaState state = (TiaState&) tia.getState();
TiaState oldstate = (TiaState&) tia.getOldState();
// TIA RAM // TIA RAM
alist.clear(); vlist.clear(); changed.clear(); alist.clear(); vlist.clear(); changed.clear();
for(unsigned int i = 0; i < 16; i++) for(unsigned int i = 0; i < 16; i++)
{ {
alist.push_back(i); alist.push_back(i);
vlist.push_back(i); vlist.push_back(state.ram[i]);
changed.push_back(false); changed.push_back(state.ram[i] != oldstate.ram[i]);
} }
myRamGrid->setList(alist, vlist, changed); myRamGrid->setList(alist, vlist, changed);
@ -270,11 +275,14 @@ void TiaWidget::fillGrid()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TiaWidget::changeRam() void TiaWidget::changeRam()
{ {
cerr << "TiaWidget::changeRam()\n";
int addr = myRamGrid->getSelectedAddr(); int addr = myRamGrid->getSelectedAddr();
int value = myRamGrid->getSelectedValue(); int value = myRamGrid->getSelectedValue();
//FIXME instance()->debugger().writeRAM(addr - kRamStart, value); IntArray ram;
ram.push_back(addr);
ram.push_back(value);
instance()->debugger().setRAM(ram);
myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10)); myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10));
myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2)); myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2));
} }