From 2b07fcab047f91fc187c9742539c9cfc47de44bc Mon Sep 17 00:00:00 2001 From: stephena Date: Tue, 13 May 2008 15:13:17 +0000 Subject: [PATCH] Updated RIOT tab in debugger to show values of SWCHA in both write *and* read mode. Write mode will allow one to change the value (ie, poke to SWCHA). Read mode will not allow change of value, and will show the contents of the previous write to SWCHA (which isn't always the same as the peek value, as it's influenced by SWACNT). This makes it much easier to see how the AVox/SaveKey code works with these registers. Removed SWBCNT from the RIOT tab, since it's read-only and always the same thing anyway (hard-wired to input). git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1505 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/debugger/RiotDebug.cxx | 49 +++++++++++-------------- stella/src/debugger/RiotDebug.hxx | 15 ++++---- stella/src/debugger/gui/RiotWidget.cxx | 50 ++++++++++++-------------- stella/src/debugger/gui/RiotWidget.hxx | 27 +++++++------- 4 files changed, 63 insertions(+), 78 deletions(-) diff --git a/stella/src/debugger/RiotDebug.cxx b/stella/src/debugger/RiotDebug.cxx index 14ff58c92..52b86d75a 100644 --- a/stella/src/debugger/RiotDebug.cxx +++ b/stella/src/debugger/RiotDebug.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: RiotDebug.cxx,v 1.3 2008-05-04 17:16:39 stephena Exp $ +// $Id: RiotDebug.cxx,v 1.4 2008-05-13 15:13:17 stephena Exp $ //============================================================================ #include @@ -33,14 +33,14 @@ RiotDebug::RiotDebug(Debugger& dbg, Console& console) const DebuggerState& RiotDebug::getState() { // Port A & B registers - myState.SWCHA = swcha(); - myState.SWCHB = swchb(); - myState.SWACNT = swacnt(); - myState.SWBCNT = swbcnt(); - Debugger::set_bits(myState.SWCHA, myState.swchaBits); - Debugger::set_bits(myState.SWCHB, myState.swchbBits); + myState.SWCHA_R = swcha(); + myState.SWCHA_W = mySystem.m6532().myOutA; + myState.SWACNT = swacnt(); + myState.SWCHB = swchb(); + Debugger::set_bits(myState.SWCHA_R, myState.swchaReadBits); + Debugger::set_bits(myState.SWCHA_W, myState.swchaWriteBits); Debugger::set_bits(myState.SWACNT, myState.swacntBits); - Debugger::set_bits(myState.SWBCNT, myState.swbcntBits); + Debugger::set_bits(myState.SWCHB, myState.swchbBits); // Timer registers myState.TIM1T = tim1T(); @@ -58,14 +58,14 @@ const DebuggerState& RiotDebug::getState() void RiotDebug::saveOldState() { // Port A & B registers - myOldState.SWCHA = swcha(); - myOldState.SWCHB = swchb(); - myOldState.SWACNT = swacnt(); - myOldState.SWBCNT = swbcnt(); - Debugger::set_bits(myOldState.SWCHA, myOldState.swchaBits); - Debugger::set_bits(myOldState.SWCHB, myOldState.swchbBits); + myOldState.SWCHA_R = swcha(); + myOldState.SWCHA_W = mySystem.m6532().myOutA; + myOldState.SWACNT = swacnt(); + myOldState.SWCHB = swchb(); + Debugger::set_bits(myOldState.SWCHA_R, myOldState.swchaReadBits); + Debugger::set_bits(myOldState.SWCHA_W, myOldState.swchaWriteBits); Debugger::set_bits(myOldState.SWACNT, myOldState.swacntBits); - Debugger::set_bits(myOldState.SWBCNT, myOldState.swbcntBits); + Debugger::set_bits(myOldState.SWCHB, myOldState.swchbBits); // Timer registers myOldState.TIM1T = tim1T(); @@ -105,13 +105,6 @@ uInt8 RiotDebug::swacnt(int newVal) return mySystem.peek(0x281); } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt8 RiotDebug::swbcnt(int newVal) -{ - // This is read-only on a real system; it makes no sense to change it - return mySystem.peek(0x283); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 RiotDebug::tim1T(int newVal) { @@ -228,14 +221,14 @@ string RiotDebug::toString() const RiotState& oldstate = (RiotState&) getOldState(); string ret; - ret += myDebugger.valueToString(0x280) + "/SWCHA" + - myDebugger.invIfChanged(state.SWCHA, oldstate.SWCHA) + " "; - ret += myDebugger.valueToString(0x281) + "/SWACNT" + + ret += myDebugger.valueToString(0x280) + "/SWCHA(R)=" + + myDebugger.invIfChanged(state.SWCHA_R, oldstate.SWCHA_R) + " "; + ret += myDebugger.valueToString(0x280) + "/SWCHA(W)=" + + myDebugger.invIfChanged(state.SWCHA_W, oldstate.SWCHA_W) + " "; + ret += myDebugger.valueToString(0x281) + "/SWACNT=" + myDebugger.invIfChanged(state.SWACNT, oldstate.SWACNT) + " "; - ret += myDebugger.valueToString(0x282) + "/SWCHB" + + ret += myDebugger.valueToString(0x282) + "/SWCHB=" + myDebugger.invIfChanged(state.SWCHB, oldstate.SWCHB) + " "; - ret += myDebugger.valueToString(0x283) + "/SWBCNT" + - myDebugger.invIfChanged(state.SWBCNT, oldstate.SWBCNT) + " "; ret += "\n"; // These are squirrely: some symbol files will define these as diff --git a/stella/src/debugger/RiotDebug.hxx b/stella/src/debugger/RiotDebug.hxx index 042c0e6ab..6334b3cdf 100644 --- a/stella/src/debugger/RiotDebug.hxx +++ b/stella/src/debugger/RiotDebug.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: RiotDebug.hxx,v 1.1 2008-04-19 21:11:52 stephena Exp $ +// $Id: RiotDebug.hxx,v 1.2 2008-05-13 15:13:17 stephena Exp $ //============================================================================ #ifndef RIOT_DEBUG_HXX @@ -28,11 +28,11 @@ class RiotDebug; class RiotState : public DebuggerState { public: - uInt8 SWCHA, SWCHB, SWACNT, SWBCNT; - BoolArray swchaBits; - BoolArray swchbBits; + uInt8 SWCHA_R, SWCHA_W, SWACNT, SWCHB; + BoolArray swchaReadBits; + BoolArray swchaWriteBits; BoolArray swacntBits; - BoolArray swbcntBits; + BoolArray swchbBits; uInt8 TIM1T, TIM8T, TIM64T, TIM1024T, INTIM, TIMINT; Int32 TIMCLKS; @@ -51,9 +51,8 @@ class RiotDebug : public DebuggerSystem /* Port A and B registers */ uInt8 swcha(int newVal = -1); - uInt8 swchb(int newVal = -1); uInt8 swacnt(int newVal = -1); - uInt8 swbcnt(int newVal = -1); + uInt8 swchb(int newVal = -1); /* Timer registers & associated clock */ uInt8 tim1T(int newVal = -1); @@ -73,7 +72,7 @@ class RiotDebug : public DebuggerSystem string diffP1String(); string tvTypeString(); string switchesString(); - + private: RiotState myState; RiotState myOldState; diff --git a/stella/src/debugger/gui/RiotWidget.cxx b/stella/src/debugger/gui/RiotWidget.cxx index 8a23d3311..f5f6af909 100644 --- a/stella/src/debugger/gui/RiotWidget.cxx +++ b/stella/src/debugger/gui/RiotWidget.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: RiotWidget.cxx,v 1.1 2008-04-29 19:11:42 stephena Exp $ +// $Id: RiotWidget.cxx,v 1.2 2008-05-13 15:13:17 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -30,7 +30,7 @@ #include "RiotWidget.hxx" -#define CREATE_IO_REGS(desc, bits, bitsID, reg) \ +#define CREATE_IO_REGS(desc, bits, bitsID) \ t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight, \ desc, kTextAlignLeft); \ xpos += t->getWidth() + 5; \ @@ -39,10 +39,6 @@ bits->setID(bitsID); \ addFocusWidget(bits); \ xpos += bits->getWidth() + 5; \ - reg = new DataGridWidget(boss, font, xpos, ypos, 1, 1, 2, 8, kBASE_16);\ - reg->setTarget(this); \ - reg->setEditable(false); \ - addFocusWidget(reg); \ bits->setList(off, on); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -56,7 +52,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font, const int fontWidth = font.getMaxCharWidth(), fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(); - int xpos = 10, ypos = 25, lwidth = 7 * fontWidth; + int xpos = 10, ypos = 25, lwidth = 9 * fontWidth; StaticTextWidget* t; // Set the strings to be used in the various bit registers @@ -68,21 +64,20 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font, on.push_back("1"); } - // SWCHA bits and actual value - CREATE_IO_REGS("SWCHA:", mySWCHABits, kSWCHABitsID, mySWCHA); + // SWCHA bits in 'poke' mode + CREATE_IO_REGS("SWCHA(W):", mySWCHAWriteBits, kSWCHABitsID); - // SWACNT bits and actual value + // SWACNT bits xpos = 10; ypos += lineHeight + 5; - CREATE_IO_REGS("SWACNT:", mySWACNTBits, kSWACNTBitsID, mySWACNT); + CREATE_IO_REGS("SWACNT:", mySWACNTBits, kSWACNTBitsID); - // SWCHB bits and actual value + // SWCHA bits in 'peek' mode + xpos = 10; ypos += lineHeight + 5; + CREATE_IO_REGS("SWCHA(R):", mySWCHAReadBits, 0); + + // SWCHB bits in 'peek' mode xpos = 10; ypos += 2 * lineHeight; - CREATE_IO_REGS("SWCHB:", mySWCHBBits, kSWCHBBitsID, mySWCHB); - - // SWBCNT bits and actual value - xpos = 10; ypos += lineHeight + 5; - CREATE_IO_REGS("SWBCNT:", mySWBCNTBits, kSWBCNTBitsID, mySWBCNT); -// mySWBCNTBits->setEnabled(false); + CREATE_IO_REGS("SWCHB:", mySWCHBBits, 0); } @@ -94,12 +89,11 @@ RiotWidget::~RiotWidget() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RiotWidget::loadConfig() { -#define IO_REGS_UPDATE(bits, reg, s_bits, s_reg) \ +#define IO_REGS_UPDATE(bits, s_bits) \ changed.clear(); \ for(unsigned int i = 0; i < state.s_bits.size(); ++i) \ changed.push_back(state.s_bits[i] != oldstate.s_bits[i]); \ - bits->setState(state.s_bits, changed); \ - reg->setList(state.s_reg, oldstate.s_reg, state.s_reg != oldstate.s_reg); + bits->setState(state.s_bits, changed); IntArray alist; IntArray vlist; @@ -112,17 +106,17 @@ void RiotWidget::loadConfig() const RiotState& state = (RiotState&) riot.getState(); const RiotState& oldstate = (RiotState&) riot.getOldState(); - // Update the SWCHA register booleans - IO_REGS_UPDATE(mySWCHABits, mySWCHA, swchaBits, SWCHA); + // Update the SWCHA register booleans (poke mode) + IO_REGS_UPDATE(mySWCHAWriteBits, swchaWriteBits); // Update the SWACNT register booleans - IO_REGS_UPDATE(mySWACNTBits, mySWACNT, swacntBits, SWACNT); + IO_REGS_UPDATE(mySWACNTBits, swacntBits); + + // Update the SWCHA register booleans (peek mode) + IO_REGS_UPDATE(mySWCHAReadBits, swchaReadBits); // Update the SWCHB register booleans - IO_REGS_UPDATE(mySWCHBBits, mySWCHB, swchbBits, SWCHB); - - // Update the SWBCNT register booleans - IO_REGS_UPDATE(mySWBCNTBits, mySWBCNT, swbcntBits, SWBCNT); + IO_REGS_UPDATE(mySWCHBBits, swchbBits); } diff --git a/stella/src/debugger/gui/RiotWidget.hxx b/stella/src/debugger/gui/RiotWidget.hxx index 300d2b149..c22faedb5 100644 --- a/stella/src/debugger/gui/RiotWidget.hxx +++ b/stella/src/debugger/gui/RiotWidget.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: RiotWidget.hxx,v 1.1 2008-04-29 19:11:42 stephena Exp $ +// $Id: RiotWidget.hxx,v 1.2 2008-05-13 15:13:17 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -25,7 +25,6 @@ class GuiObject; class ButtonWidget; class DataGridWidget; -class EditTextWidget; class ToggleBitWidget; #include "Array.hxx" @@ -45,23 +44,23 @@ class RiotWidget : public Widget, public CommandSender private: private: - ToggleBitWidget* mySWCHABits; - ToggleBitWidget* mySWCHBBits; + ToggleBitWidget* mySWCHAReadBits; + ToggleBitWidget* mySWCHAWriteBits; ToggleBitWidget* mySWACNTBits; - ToggleBitWidget* mySWBCNTBits; - - DataGridWidget* mySWCHA; - DataGridWidget* mySWCHB; - DataGridWidget* mySWACNT; - DataGridWidget* mySWBCNT; + ToggleBitWidget* mySWCHBBits; DataGridWidget* myTim[4]; DataGridWidget* myTimResults[4]; - EditTextWidget* myP0Dir, *myP1Dir; - EditTextWidget* myP0Diff, *myP1Diff; - EditTextWidget* myTVType; - EditTextWidget* mySwitches; + CheckboxWidget* myP0Dir, *myP1Dir; + CheckboxWidget* myP0Diff, *myP1Diff; + CheckboxWidget* myTVType; + CheckboxWidget* mySwitches; + + StaticTextWidget* myP0DirText, *myP1DirText; + StaticTextWidget* myP0DiffText, *myP1DiffText; + StaticTextWidget* myTVTypeText; + StaticTextWidget* mySwitchesText; // ID's for the various widgets // We need ID's, since there are more than one of several types of widgets