diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index 010525b3f..4ba424cb0 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.cxx @@ -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.81 2005-08-10 12:23:42 stephena Exp $ +// $Id: Debugger.cxx,v 1.82 2005-08-15 18:52:15 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -307,7 +307,7 @@ void Debugger::autoExec() { } else { file += ".stella"; } - myPrompt->print("\nautoExec():\n" + myParser->exec(file)); + myPrompt->print("autoExec():\n" + myParser->exec(file) + "\n"); myPrompt->printPrompt(); } @@ -924,9 +924,7 @@ GUI::Rect Debugger::getDialogBounds() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GUI::Rect Debugger::getTiaBounds() const { - GUI::Rect r(0, 0, - myConsole->mediaSource().width() << 1, // width is doubled - myConsole->mediaSource().height()); + GUI::Rect r(0, 0, 320, myConsole->mediaSource().height()); return r; } diff --git a/stella/src/debugger/PromptWidget.cxx b/stella/src/debugger/PromptWidget.cxx index 4afc9d174..691b49ad3 100644 --- a/stella/src/debugger/PromptWidget.cxx +++ b/stella/src/debugger/PromptWidget.cxx @@ -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.2 2005-08-10 12:23:42 stephena Exp $ +// $Id: PromptWidget.cxx,v 1.3 2005-08-15 18:52:15 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -148,10 +148,16 @@ void PromptWidget::handleMouseWheel(int x, int y, int direction) _scrollBar->handleMouseWheel(x, y, direction); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PromptWidget::printPrompt() { +// FIXME - the following will probably be permanantly removed +// since it's always shown in the main dialog area +/* print( instance()->debugger().showWatches() ); print( instance()->debugger().cpuState() ); + print("\n"); +*/ print(PROMPT); _promptStartPos = _promptEndPos = _currentPos; } @@ -188,7 +194,7 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers) addToHistory(str); // Pass the command to the debugger, and print the result - print( instance()->debugger().run(str) ); + print( instance()->debugger().run(str) + "\n"); // Get rid of the string buffer delete [] str; @@ -434,7 +440,7 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers) // as dirty *after* they've been drawn above. One such occurrence is // when we issue a command that indirectly redraws the entire parent // dialog (such as 'scanline' or 'frame'). - // In those cases, the retunr code of the command must be shown, but the + // In those cases, the return code of the command must be shown, but the // entire dialog contents are redrawn at a later time. So the prompt and // scrollbar won't be redrawn unless they're dirty again. if(_makeDirty) diff --git a/stella/src/debugger/TIADebug.cxx b/stella/src/debugger/TIADebug.cxx index 7129d30a9..8ecda4920 100644 --- a/stella/src/debugger/TIADebug.cxx +++ b/stella/src/debugger/TIADebug.cxx @@ -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.16 2005-07-23 15:55:21 urchlay Exp $ +// $Id: TIADebug.cxx,v 1.17 2005-08-15 18:52:15 stephena Exp $ //============================================================================ #include "System.hxx" @@ -44,12 +44,43 @@ DebuggerState& TIADebug::getState() for(int i = 0; i < 0x010; ++i) myState.ram.push_back(myTIA->peek(i)); + // Color registers myState.coluRegs.clear(); myState.coluRegs.push_back(coluP0()); myState.coluRegs.push_back(coluP1()); myState.coluRegs.push_back(coluPF()); myState.coluRegs.push_back(coluBK()); + // Player 1 & 2 graphics registers + myState.gr.clear(); + myState.gr.push_back(grP0()); + myState.gr.push_back(grP1()); + + // Position registers + myState.pos.clear(); + myState.pos.push_back(posP0()); + myState.pos.push_back(posP1()); + myState.pos.push_back(posM0()); + myState.pos.push_back(posM1()); + myState.pos.push_back(posBL()); + + // Horizontal move registers + myState.hm.clear(); + myState.hm.push_back(hmP0()); + myState.hm.push_back(hmP1()); + myState.hm.push_back(hmM0()); + myState.hm.push_back(hmM1()); + myState.hm.push_back(hmBL()); + + // Playfield registers + myState.pf.clear(); + myState.pf.push_back(pf0()); + myState.pf.push_back(pf1()); + myState.pf.push_back(pf2()); + + myState.refP0 = refP0(); myState.delP0 = vdelP0(); + myState.refP1 = refP1(); myState.delP1 = vdelP1(); + return myState; } @@ -60,11 +91,39 @@ void TIADebug::saveOldState() for(int i = 0; i < 0x010; ++i) myOldState.ram.push_back(myTIA->peek(i)); + // Color registers myOldState.coluRegs.clear(); myOldState.coluRegs.push_back(coluP0()); myOldState.coluRegs.push_back(coluP1()); myOldState.coluRegs.push_back(coluPF()); myOldState.coluRegs.push_back(coluBK()); + + // Player 1 & 2 graphics registers + myOldState.gr.clear(); + myOldState.gr.push_back(grP0()); + myOldState.gr.push_back(grP1()); + + // Position registers + myOldState.pos.clear(); + myOldState.pos.push_back(posP0()); + myOldState.pos.push_back(posP1()); + myOldState.pos.push_back(posM0()); + myOldState.pos.push_back(posM1()); + myOldState.pos.push_back(posBL()); + + // Horizontal move registers + myOldState.hm.clear(); + myOldState.hm.push_back(hmP0()); + myOldState.hm.push_back(hmP1()); + myOldState.hm.push_back(hmM0()); + myOldState.hm.push_back(hmM1()); + myOldState.hm.push_back(hmBL()); + + // Playfield registers + myOldState.pf.clear(); + myOldState.pf.push_back(pf0()); + myOldState.pf.push_back(pf1()); + myOldState.pf.push_back(pf2()); } /* the set methods now use mySystem->poke(). This will save us the @@ -322,7 +381,7 @@ uInt8 TIADebug::nusiz1(int newVal) uInt8 TIADebug::grP0(int newVal) { if(newVal > -1) - mySystem->poke(GRP0, newVal); + mySystem->poke(GRP0, newVal); return myTIA->myGRP0; } @@ -331,11 +390,61 @@ uInt8 TIADebug::grP0(int newVal) uInt8 TIADebug::grP1(int newVal) { if(newVal > -1) - mySystem->poke(GRP1, newVal); + mySystem->poke(GRP1, newVal); return myTIA->myGRP1; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt8 TIADebug::posP0(int newVal) +{ +/* FIXME + if(newVal > -1) + mySystem->poke(???, newVal); +*/ + return myTIA->myPOSP0; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt8 TIADebug::posP1(int newVal) +{ +/* FIXME + if(newVal > -1) + mySystem->poke(???, newVal); +*/ + return myTIA->myPOSP1; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt8 TIADebug::posM0(int newVal) +{ +/* FIXME + if(newVal > -1) + mySystem->poke(???, newVal); +*/ + return myTIA->myPOSM0; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt8 TIADebug::posM1(int newVal) +{ +/* FIXME + if(newVal > -1) + mySystem->poke(???, newVal); +*/ + return myTIA->myPOSM1; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt8 TIADebug::posBL(int newVal) +{ +/* FIXME + if(newVal > -1) + mySystem->poke(???, newVal); +*/ + return myTIA->myPOSBL; +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 TIADebug::ctrlPF(int newVal) { @@ -475,28 +584,17 @@ string TIADebug::state() // TODO: inverse video for changed regs. Core needs to track this. // TODO: strobes? WSYNC RSYNC RESP0/1 RESM0/1 RESBL HMOVE HMCLR CXCLR - uInt8 COLUP0 = coluP0(); - uInt8 COLUP1 = coluP1(); - uInt8 COLUPF = coluPF(); - uInt8 COLUBK = coluBK(); - - // TIA::myPF holds all 3 PFx regs, we shall extract - int PF = myTIA->myPF; - uInt8 PF0 = PF & 0x0f; - uInt8 PF1 = (PF >> 4) & 0xff; - uInt8 PF2 = (PF >> 12) & 0xff; - - // Hope Brad never changes this: - uInt16 coll = myTIA->myCollision; + TiaState state = (TiaState&) getState(); +// FIXME - change tracking TiaState oldstate = (TiaState&) getOldState(); // calculate sizes uInt8 ballSize = 1 << (myTIA->myCTRLPF & 0x18); - uInt8 m0Size = 1 << (myTIA->myNUSIZ0 & 0x18); - uInt8 m1Size = 1 << (myTIA->myNUSIZ1 & 0x18); + uInt8 m0Size = 1 << (myTIA->myNUSIZ0 & 0x18); + uInt8 m1Size = 1 << (myTIA->myNUSIZ1 & 0x18); // easier to use a table for these: - string p0Size = nusizStrings[myTIA->myNUSIZ0 & 0x07]; - string p1Size = nusizStrings[myTIA->myNUSIZ1 & 0x07]; + const string& p0Size = nusiz0String(); + const string& p1Size = nusiz1String(); // build up output, then return it. ret += "scanline "; @@ -526,67 +624,65 @@ string TIADebug::state() ret += "\n"; ret += "COLUP0: "; - ret += myDebugger->valueToString(COLUP0); + ret += myDebugger->valueToString(state.coluRegs[0]); ret += "/"; - ret += colorSwatch(COLUP0); + ret += colorSwatch(state.coluRegs[0]); ret += "COLUP1: "; - ret += myDebugger->valueToString(COLUP1); + ret += myDebugger->valueToString(state.coluRegs[1]); ret += "/"; - ret += colorSwatch(COLUP1); + ret += colorSwatch(state.coluRegs[1]); ret += "COLUPF: "; - ret += myDebugger->valueToString(COLUPF); + ret += myDebugger->valueToString(state.coluRegs[2]); ret += "/"; - ret += colorSwatch(COLUPF); + ret += colorSwatch(state.coluRegs[2]); ret += "COLUBK: "; - ret += myDebugger->valueToString(COLUBK); + ret += myDebugger->valueToString(state.coluRegs[3]); ret += "/"; - ret += colorSwatch(COLUBK); + ret += colorSwatch(state.coluRegs[3]); ret += "\n"; ret += "P0: GR="; - // TODO: ret += myDebugger->invIfChanged(myTIA->myGRP0, oldGRP0); - ret += Debugger::to_bin_8(myTIA->myGRP0); + ret += Debugger::to_bin_8(state.gr[P0]); ret += "/"; - ret += myDebugger->valueToString(myTIA->myGRP0); + ret += myDebugger->valueToString(state.gr[P0]); ret += " pos="; - ret += myDebugger->valueToString(myTIA->myPOSP0); + ret += myDebugger->valueToString(state.pos[P0]); ret += " HM="; - ret += myDebugger->valueToString(myTIA->myHMP0); + ret += myDebugger->valueToString(state.hm[P0]); ret += " "; ret += p0Size; ret += " "; - ret += booleanWithLabel("reflect", (myTIA->myREFP0)); + ret += booleanWithLabel("reflect", state.refP0); ret += " "; - ret += booleanWithLabel("delay", (myTIA->myVDELP0)); + ret += booleanWithLabel("delay", state.delP0); ret += "\n"; ret += "P1: GR="; - // TODO: ret += myDebugger->invIfChanged(myTIA->myGRP1, oldGRP1); - ret += Debugger::to_bin_8(myTIA->myGRP1); + ret += Debugger::to_bin_8(state.gr[P1]); ret += "/"; - ret += myDebugger->valueToString(myTIA->myGRP1); + ret += myDebugger->valueToString(state.gr[P1]); ret += " pos="; - ret += myDebugger->valueToString(myTIA->myPOSP1); + ret += myDebugger->valueToString(state.pos[P1]); ret += " HM="; - ret += myDebugger->valueToString(myTIA->myHMP1); + ret += myDebugger->valueToString(state.hm[P1]); ret += " "; ret += p1Size; ret += " "; - ret += booleanWithLabel("reflect", (myTIA->myREFP1)); + ret += booleanWithLabel("reflect", state.refP1); ret += " "; - ret += booleanWithLabel("delay", (myTIA->myVDELP1)); + ret += booleanWithLabel("delay", state.delP1); ret += "\n"; ret += "M0: "; ret += (myTIA->myENAM0 ? " ENABLED" : "disabled"); ret += " pos="; - ret += myDebugger->valueToString(myTIA->myPOSM0); + ret += myDebugger->valueToString(state.pos[M0]); ret += " HM="; - ret += myDebugger->valueToString(myTIA->myHMM0); + ret += myDebugger->valueToString(state.hm[M0]); ret += " size="; ret += myDebugger->valueToString(m0Size); ret += " "; @@ -596,9 +692,9 @@ string TIADebug::state() ret += "M1: "; ret += (myTIA->myENAM1 ? " ENABLED" : "disabled"); ret += " pos="; - ret += myDebugger->valueToString(myTIA->myPOSM1); + ret += myDebugger->valueToString(state.pos[M1]); ret += " HM="; - ret += myDebugger->valueToString(myTIA->myHMM1); + ret += myDebugger->valueToString(state.hm[M1]); ret += " size="; ret += myDebugger->valueToString(m1Size); ret += " "; @@ -608,9 +704,9 @@ string TIADebug::state() ret += "BL: "; ret += (myTIA->myENABL ? " ENABLED" : "disabled"); ret += " pos="; - ret += myDebugger->valueToString(myTIA->myPOSBL); + ret += myDebugger->valueToString(state.pos[BL]); ret += " HM="; - ret += myDebugger->valueToString(myTIA->myHMBL); + ret += myDebugger->valueToString(state.hm[BL]); ret += " size="; ret += myDebugger->valueToString(ballSize); ret += " "; @@ -618,17 +714,17 @@ string TIADebug::state() ret += "\n"; ret += "PF0: "; - ret += Debugger::to_bin_8(PF0); + ret += Debugger::to_bin_8(state.pf[0]); ret += "/"; - ret += myDebugger->valueToString(PF0); + ret += myDebugger->valueToString(state.pf[0]); ret += " PF1: "; - ret += Debugger::to_bin_8(PF1); + ret += Debugger::to_bin_8(state.pf[1]); ret += "/"; - ret += myDebugger->valueToString(PF1); + ret += myDebugger->valueToString(state.pf[1]); ret += " PF2: "; - ret += Debugger::to_bin_8(PF2); + ret += Debugger::to_bin_8(state.pf[2]); ret += "/"; - ret += myDebugger->valueToString(PF2); + ret += myDebugger->valueToString(state.pf[2]); ret += "\n "; ret += booleanWithLabel("reflect", myTIA->myCTRLPF & 0x01); ret += " "; @@ -637,6 +733,9 @@ string TIADebug::state() ret += booleanWithLabel("priority", myTIA->myCTRLPF & 0x04); ret += "\n"; + // Hope Brad never changes this: + uInt16 coll = myTIA->myCollision; + ret += "Collisions: "; ret += booleanWithLabel("m0_p1 ", bool(coll & 0x0001)); ret += booleanWithLabel("m0_p0 ", bool(coll & 0x0002)); diff --git a/stella/src/debugger/TIADebug.hxx b/stella/src/debugger/TIADebug.hxx index 52844d098..6c13e95f1 100644 --- a/stella/src/debugger/TIADebug.hxx +++ b/stella/src/debugger/TIADebug.hxx @@ -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.hxx,v 1.14 2005-07-23 15:55:21 urchlay Exp $ +// $Id: TIADebug.hxx,v 1.15 2005-08-15 18:52:15 stephena Exp $ //============================================================================ #ifndef TIA_DEBUG_HXX @@ -81,11 +81,23 @@ enum TIALabel { CXCLR // $2C }; +// Indices for various IntArray in TiaState +enum { + P0, P1, M0, M1, BL +}; + class TiaState : public DebuggerState { public: IntArray ram; IntArray coluRegs; + IntArray gr; + IntArray pos; + IntArray hm; + IntArray pf; + + bool refP0, delP0; + bool refP1, delP1; }; class TIADebug : public DebuggerSystem @@ -101,6 +113,8 @@ class TIADebug : public DebuggerSystem /* TIA byte (or part of a byte) registers */ uInt8 nusiz0(int newVal = -1); uInt8 nusiz1(int newVal = -1); + const string& nusiz0String() { return nusizStrings[myTIA->myNUSIZ0 & 0x07]; } + const string& nusiz1String() { return nusizStrings[myTIA->myNUSIZ1 & 0x07]; } uInt8 coluP0(int newVal = -1); uInt8 coluP1(int newVal = -1); @@ -115,6 +129,11 @@ class TIADebug : public DebuggerSystem uInt8 grP0(int newVal = -1); uInt8 grP1(int newVal = -1); + uInt8 posP0(int newVal = -1); + uInt8 posP1(int newVal = -1); + uInt8 posM0(int newVal = -1); + uInt8 posM1(int newVal = -1); + uInt8 posBL(int newVal = -1); uInt8 hmP0(int newVal = -1); uInt8 hmP1(int newVal = -1); uInt8 hmM0(int newVal = -1); @@ -135,24 +154,24 @@ class TIADebug : public DebuggerSystem bool enaM1(int newVal = -1); bool enaBL(int newVal = -1); - bool vdelP0(int newVal = -1); - bool vdelP1(int newVal = -1); - bool vdelBL(int newVal = -1); + bool vdelP0(int newVal = -1); + bool vdelP1(int newVal = -1); + bool vdelBL(int newVal = -1); - bool resMP0(int newVal = -1); - bool resMP1(int newVal = -1); + bool resMP0(int newVal = -1); + bool resMP1(int newVal = -1); - /* TIA strobe registers */ - void strobeWsync() { mySystem->poke(WSYNC, 0); } - void strobeRsync() { mySystem->poke(RSYNC, 0); } // not emulated! - void strobeResP0() { mySystem->poke(RESP0, 0); } - void strobeResP1() { mySystem->poke(RESP1, 0); } - void strobeResM0() { mySystem->poke(RESM0, 0); } - void strobeResM1() { mySystem->poke(RESM1, 0); } - void strobeResBL() { mySystem->poke(RESBL, 0); } - void strobeHmove() { mySystem->poke(HMOVE, 0); } - void strobeHmclr() { mySystem->poke(HMCLR, 0); } - void strobeCxclr() { mySystem->poke(CXCLR, 0); } + /* TIA strobe registers */ + void strobeWsync() { mySystem->poke(WSYNC, 0); } + void strobeRsync() { mySystem->poke(RSYNC, 0); } // not emulated! + void strobeResP0() { mySystem->poke(RESP0, 0); } + void strobeResP1() { mySystem->poke(RESP1, 0); } + void strobeResM0() { mySystem->poke(RESM0, 0); } + void strobeResM1() { mySystem->poke(RESM1, 0); } + void strobeResBL() { mySystem->poke(RESBL, 0); } + void strobeHmove() { mySystem->poke(HMOVE, 0); } + void strobeHmclr() { mySystem->poke(HMCLR, 0); } + void strobeCxclr() { mySystem->poke(CXCLR, 0); } /* read-only internal TIA state */ int scanlines(); diff --git a/stella/src/debugger/TiaWidget.cxx b/stella/src/debugger/TiaWidget.cxx index e252d3c5e..f6aab1443 100644 --- a/stella/src/debugger/TiaWidget.cxx +++ b/stella/src/debugger/TiaWidget.cxx @@ -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: TiaWidget.cxx,v 1.4 2005-08-10 12:23:42 stephena Exp $ +// $Id: TiaWidget.cxx,v 1.5 2005-08-15 18:52:15 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -28,6 +28,7 @@ #include "EditTextWidget.hxx" #include "DataGridWidget.hxx" #include "ColorWidget.hxx" +#include "ToggleBitWidget.hxx" #include "TiaWidget.hxx" // ID's for the various widgets @@ -67,9 +68,8 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h) addFocusWidget(myRamGrid); t = new StaticTextWidget(boss, xpos, ypos + 2, - lwidth, fontHeight, - Debugger::to_hex_8(0) + string(":"), - kTextAlignLeft); + lwidth-2, fontHeight, + "00:", kTextAlignLeft); t->setFont(font); for(int col = 0; col < 16; ++col) { @@ -145,18 +145,29 @@ TiaWidget::TiaWidget(GuiObject* boss, int x, int y, int w, int h) myCOLUBKColor = new ColorWidget(boss, xpos, ypos+2, 20, lineHeight - 4); myCOLUBKColor->setTarget(this); -/* - // Add some buttons for common actions - ButtonWidget* b; - xpos = vWidth + 10; ypos = 20; - b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "0", kRZeroCmd, 0); - b->setTarget(this); + // P0 register info + xpos = 10; ypos += 2*lineHeight; + t = new StaticTextWidget(boss, xpos, ypos+2, + 7*fontWidth, fontHeight, + "P0/ GR:", kTextAlignLeft); + t->setFont(font); + xpos += 7*fontWidth + 5; + myGRP0 = new ToggleBitWidget(boss, font, xpos, ypos, 8, 1); + myGRP0->setTarget(this); + addFocusWidget(myGRP0); + // Set the strings to be used in the PSRegister + // We only do this once because it's the state that changes, not the strings + const char* offstr[] = { "0", "0", "0", "0", "0", "0", "0", "0" }; + const char* onstr[] = { "1", "1", "1", "1", "1", "1", "1", "1" }; + StringList off, on; + for(int i = 0; i < 8; ++i) + { + off.push_back(offstr[i]); + on.push_back(onstr[i]); + } + myGRP0->setList(off, on); - xpos = vWidth + 30 + 10; ypos = 20; -// b = new ButtonWidget(boss, xpos, ypos, buttonw, 16, "", kRCmd, 0); -// b->setTarget(this); -*/ } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -235,7 +246,7 @@ void TiaWidget::fillGrid() { IntArray alist; IntArray vlist; - BoolArray changed; + BoolArray orig, changed; Debugger& dbg = instance()->debugger(); TIADebug& tia = dbg.tiaDebug(); @@ -266,6 +277,29 @@ void TiaWidget::fillGrid() myCOLUP1Color->setColor(state.coluRegs[1]); myCOLUPFColor->setColor(state.coluRegs[2]); myCOLUBKColor->setColor(state.coluRegs[3]); + + // GRP0 register + BoolArray grNew, grOld; + convertCharToBool(grNew, state.gr[P0]); + convertCharToBool(grOld, oldstate.gr[P0]); + + changed.clear(); + for(unsigned int i = 0; i < 8; ++i) + changed.push_back(grNew[i] != grOld[i]); + + myGRP0->setState(grNew, changed); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TiaWidget::convertCharToBool(BoolArray& b, unsigned char value) +{ + for(unsigned int i = 0; i < 8; ++i) + { + if(value & (1<<(7-i))) + b.push_back(true); + else + b.push_back(false); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/debugger/TiaWidget.hxx b/stella/src/debugger/TiaWidget.hxx index 100079db0..b02441c18 100644 --- a/stella/src/debugger/TiaWidget.hxx +++ b/stella/src/debugger/TiaWidget.hxx @@ -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: TiaWidget.hxx,v 1.2 2005-08-10 12:23:42 stephena Exp $ +// $Id: TiaWidget.hxx,v 1.3 2005-08-15 18:52:15 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -26,6 +26,7 @@ class GuiObject; class ButtonWidget; class DataGridWidget; class StaticTextWidget; +class ToggleBitWidget; class EditTextWidget; class ColorWidget; @@ -45,6 +46,7 @@ class TiaWidget : public Widget, public CommandSender private: void fillGrid(); void changeColorRegs(); + void convertCharToBool(BoolArray& b, unsigned char value); private: DataGridWidget* myRamGrid; @@ -58,6 +60,9 @@ class TiaWidget : public Widget, public CommandSender ColorWidget* myCOLUP1Color; ColorWidget* myCOLUPFColor; ColorWidget* myCOLUBKColor; + + ToggleBitWidget* myGRP0; + ToggleBitWidget* myGRP1; }; #endif diff --git a/stella/src/gui/DataGridWidget.cxx b/stella/src/gui/DataGridWidget.cxx index d7768e063..ada7422c1 100644 --- a/stella/src/gui/DataGridWidget.cxx +++ b/stella/src/gui/DataGridWidget.cxx @@ -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: DataGridWidget.cxx,v 1.22 2005-08-12 17:12:43 stephena Exp $ +// $Id: DataGridWidget.cxx,v 1.23 2005-08-15 18:52:15 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -117,6 +117,20 @@ cerr << "_addrList.size() = " << _addrList.size() setDirty(); draw(); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void DataGridWidget::setList(const int a, const int v, const bool c) +{ + // Convenience method for when the datagrid contains only one value + IntArray alist, vlist; + BoolArray changed; + + alist.push_back(a); + vlist.push_back(v); + changed.push_back(changed); + + setList(alist, vlist, changed); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DataGridWidget::setHiliteList(const IntArray& hilitelist) { diff --git a/stella/src/gui/DataGridWidget.hxx b/stella/src/gui/DataGridWidget.hxx index 4921484e8..a5926972d 100644 --- a/stella/src/gui/DataGridWidget.hxx +++ b/stella/src/gui/DataGridWidget.hxx @@ -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: DataGridWidget.hxx,v 1.12 2005-08-11 19:12:39 stephena Exp $ +// $Id: DataGridWidget.hxx,v 1.13 2005-08-15 18:52:15 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -51,6 +51,7 @@ class DataGridWidget : public EditableWidget void setList(const IntArray& alist, const IntArray& vlist, const BoolArray& changed); + void setList(const int a, const int v, const bool changed); void setHiliteList(const IntArray& hilitelist); void setSelectedValue(int value); diff --git a/stella/src/gui/Dialog.cxx b/stella/src/gui/Dialog.cxx index ffeb71917..e82d288d8 100644 --- a/stella/src/gui/Dialog.cxx +++ b/stella/src/gui/Dialog.cxx @@ -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: Dialog.cxx,v 1.26 2005-08-11 19:12:39 stephena Exp $ +// $Id: Dialog.cxx,v 1.27 2005-08-15 18:52:15 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -69,7 +69,6 @@ void Dialog::open() // (Re)-build the focus list to use for the widgets which are currently // onscreen - _focusedWidget = 0; buildFocusWidgetList(_focusID); } @@ -134,7 +133,7 @@ void Dialog::buildFocusWidgetList(int id) // Remember which item previously had focus, but only if it belongs // to this focus list - if(_focusID < (int)_ourFocusList.size() && _focusID != id && + if(_focusID < (int)_ourFocusList.size() && Widget::isWidgetInChain(_ourFocusList[_focusID].focusList, _focusedWidget)) _ourFocusList[_focusID].focusedWidget = _focusedWidget; @@ -406,23 +405,3 @@ ButtonWidget* Dialog::addButton(int x, int y, const string& label, { return new ButtonWidget(this, x, y, kButtonWidth, 16, label, cmd, hotkey); } - -/* -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void GuiObject::removeFromFocusList(WidgetArray& list) -{ - for(int i = 0; i < (int)list.size(); ++i) - { - // Start searching from the end, since more than likely - // that's where the previously added widgets will be - for(int j = (int)_focusList.size() - 1; j >= 0; --j) - { - if(list[i] == _focusList[j]) - { - _focusList.remove_at(j); - break; - } - } - } -} -*/