From d8b59f70833e7610a805cccfb32b4d25ea23ee64 Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 31 Dec 2011 22:43:55 +0000 Subject: [PATCH] Added RIOT port B information to the I/O tab in the debugger. I'm still waiting on a test ROM to verify that its output is valid. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2319 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/debugger/RiotDebug.cxx | 33 +++++++++++++++++++++++++++------ src/debugger/RiotDebug.hxx | 7 +++++-- src/debugger/gui/RiotWidget.cxx | 24 +++++++++++++++++++----- src/debugger/gui/RiotWidget.hxx | 8 +++++--- 4 files changed, 56 insertions(+), 16 deletions(-) diff --git a/src/debugger/RiotDebug.cxx b/src/debugger/RiotDebug.cxx index a7d25a408..67df83930 100644 --- a/src/debugger/RiotDebug.cxx +++ b/src/debugger/RiotDebug.cxx @@ -39,11 +39,15 @@ const DebuggerState& RiotDebug::getState() myState.SWCHA_R = swcha(); myState.SWCHA_W = mySystem.m6532().myOutA; myState.SWACNT = swacnt(); - myState.SWCHB = swchb(); + myState.SWCHB_R = swchb(); + myState.SWCHB_W = mySystem.m6532().myOutB; + myState.SWBCNT = swbcnt(); 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.SWCHB, myState.swchbBits); + Debugger::set_bits(myState.SWCHB_R, myState.swchbReadBits); + Debugger::set_bits(myState.SWCHB_W, myState.swchbWriteBits); + Debugger::set_bits(myState.SWBCNT, myState.swbcntBits); // Timer registers myState.TIM1T = tim1T(); @@ -78,11 +82,15 @@ void RiotDebug::saveOldState() myOldState.SWCHA_R = swcha(); myOldState.SWCHA_W = mySystem.m6532().myOutA; myOldState.SWACNT = swacnt(); - myOldState.SWCHB = swchb(); + myOldState.SWCHB_R = swchb(); + myOldState.SWCHB_W = mySystem.m6532().myOutB; + myOldState.SWBCNT = swbcnt(); 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.SWCHB, myOldState.swchbBits); + Debugger::set_bits(myOldState.SWCHB_R, myOldState.swchbReadBits); + Debugger::set_bits(myOldState.SWCHB_W, myOldState.swchbWriteBits); + Debugger::set_bits(myOldState.SWBCNT, myOldState.swbcntBits); // Timer registers myOldState.TIM1T = tim1T(); @@ -132,6 +140,15 @@ uInt8 RiotDebug::swacnt(int newVal) return mySystem.peek(0x281); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt8 RiotDebug::swbcnt(int newVal) +{ + if(newVal > -1) + mySystem.poke(0x283, newVal); + + return mySystem.peek(0x283); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 RiotDebug::tim1T(int newVal) { @@ -326,8 +343,12 @@ string RiotDebug::toString() << myDebugger.invIfChanged(state.SWCHA_W, oldstate.SWCHA_W) << " " << myDebugger.valueToString(0x281) + "/SWACNT=" << myDebugger.invIfChanged(state.SWACNT, oldstate.SWACNT) << " " - << myDebugger.valueToString(0x282) + "/SWCHB=" - << myDebugger.invIfChanged(state.SWCHB, oldstate.SWCHB) << " " + << myDebugger.valueToString(0x282) + "/SWCHB(R)=" + << myDebugger.invIfChanged(state.SWCHB_R, oldstate.SWCHB_R) << " " + << myDebugger.valueToString(0x282) + "/SWCHB(W)=" + << myDebugger.invIfChanged(state.SWCHB_W, oldstate.SWCHB_W) << " " + << myDebugger.valueToString(0x283) + "/SWBCNT=" + << myDebugger.invIfChanged(state.SWBCNT, oldstate.SWBCNT) << " " << endl // These are squirrely: some symbol files will define these as diff --git a/src/debugger/RiotDebug.hxx b/src/debugger/RiotDebug.hxx index 9ac3e8b62..996a42ac9 100644 --- a/src/debugger/RiotDebug.hxx +++ b/src/debugger/RiotDebug.hxx @@ -29,11 +29,13 @@ class RiotDebug; class RiotState : public DebuggerState { public: - uInt8 SWCHA_R, SWCHA_W, SWACNT, SWCHB; + uInt8 SWCHA_R, SWCHA_W, SWACNT, SWCHB_R, SWCHB_W, SWBCNT; BoolArray swchaReadBits; BoolArray swchaWriteBits; BoolArray swacntBits; - BoolArray swchbBits; + BoolArray swchbReadBits; + BoolArray swchbWriteBits; + BoolArray swbcntBits; uInt8 TIM1T, TIM8T, TIM64T, TIM1024T, INTIM, TIMINT; Int32 TIMCLKS; @@ -57,6 +59,7 @@ class RiotDebug : public DebuggerSystem uInt8 swcha(int newVal = -1); uInt8 swacnt(int newVal = -1); uInt8 swchb(int newVal = -1); + uInt8 swbcnt(int newVal = -1); /* Timer registers & associated clock */ uInt8 tim1T(int newVal = -1); diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 55e44332e..3d5d285ad 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -116,10 +116,18 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font, CREATE_IO_REGS("SWCHA(R):", mySWCHAReadBits, 0); mySWCHAReadBits->setEditable(false); - // SWCHB bits in 'peek' mode + // SWCHB bits in 'poke' mode xpos = 10; ypos += 2 * lineHeight; - CREATE_IO_REGS("SWCHB:", mySWCHBBits, 0); - mySWCHBBits->setEditable(false); + CREATE_IO_REGS("SWCHB(W):", mySWCHBWriteBits, kSWCHBBitsID); + + // SWBCNT bits + xpos = 10; ypos += lineHeight + 5; + CREATE_IO_REGS("SWBCNT:", mySWBCNTBits, kSWBCNTBitsID); + + // SWCHB bits in 'peek' mode + xpos = 10; ypos += lineHeight + 5; + CREATE_IO_REGS("SWCHB(R):", mySWCHBReadBits, 0); + mySWCHBReadBits->setEditable(false); // Timer registers (R/W) const char* writeNames[] = { "TIM1T:", "TIM8T:", "TIM64T:", "TIM1024T:" }; @@ -231,8 +239,14 @@ void RiotWidget::loadConfig() // Update the SWCHA register booleans (peek mode) IO_REGS_UPDATE(mySWCHAReadBits, swchaReadBits); - // Update the SWCHB register booleans - IO_REGS_UPDATE(mySWCHBBits, swchbBits); + // Update the SWCHB register booleans (poke mode) + IO_REGS_UPDATE(mySWCHBWriteBits, swchbWriteBits); + + // Update the SWBCNT register booleans + IO_REGS_UPDATE(mySWBCNTBits, swbcntBits); + + // Update the SWCHB register booleans (peek mode) + IO_REGS_UPDATE(mySWCHBReadBits, swchbReadBits); // Update timer write registers alist.clear(); vlist.clear(); changed.clear(); diff --git a/src/debugger/gui/RiotWidget.hxx b/src/debugger/gui/RiotWidget.hxx index 8934032ba..52d67f9db 100644 --- a/src/debugger/gui/RiotWidget.hxx +++ b/src/debugger/gui/RiotWidget.hxx @@ -48,7 +48,9 @@ class RiotWidget : public Widget, public CommandSender ToggleBitWidget* mySWCHAReadBits; ToggleBitWidget* mySWCHAWriteBits; ToggleBitWidget* mySWACNTBits; - ToggleBitWidget* mySWCHBBits; + ToggleBitWidget* mySWCHBReadBits; + ToggleBitWidget* mySWCHBWriteBits; + ToggleBitWidget* mySWBCNTBits; DataGridWidget* myTimWrite; DataGridWidget* myTimRead; @@ -63,8 +65,8 @@ class RiotWidget : public Widget, public CommandSender // ID's for the various widgets // We need ID's, since there are more than one of several types of widgets enum { - kTim1TID, kTim8TID, kTim64TID, kTim1024TID, - kSWCHABitsID, kSWACNTBitsID, kSWCHBBitsID, kTimWriteID, + kTim1TID, kTim8TID, kTim64TID, kTim1024TID, kTimWriteID, + kSWCHABitsID, kSWACNTBitsID, kSWCHBBitsID, kSWBCNTBitsID, kP0PinsID, kP1PinsID, kP0DiffChanged, kP1DiffChanged, kTVTypeChanged, kSelectID, kResetID };