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
This commit is contained in:
stephena 2008-05-13 15:13:17 +00:00
parent 9fe48afffd
commit 2b07fcab04
4 changed files with 63 additions and 78 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: 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 <sstream> #include <sstream>
@ -33,14 +33,14 @@ RiotDebug::RiotDebug(Debugger& dbg, Console& console)
const DebuggerState& RiotDebug::getState() const DebuggerState& RiotDebug::getState()
{ {
// Port A & B registers // Port A & B registers
myState.SWCHA = swcha(); myState.SWCHA_R = swcha();
myState.SWCHB = swchb(); myState.SWCHA_W = mySystem.m6532().myOutA;
myState.SWACNT = swacnt(); myState.SWACNT = swacnt();
myState.SWBCNT = swbcnt(); myState.SWCHB = swchb();
Debugger::set_bits(myState.SWCHA, myState.swchaBits); Debugger::set_bits(myState.SWCHA_R, myState.swchaReadBits);
Debugger::set_bits(myState.SWCHB, myState.swchbBits); Debugger::set_bits(myState.SWCHA_W, myState.swchaWriteBits);
Debugger::set_bits(myState.SWACNT, myState.swacntBits); Debugger::set_bits(myState.SWACNT, myState.swacntBits);
Debugger::set_bits(myState.SWBCNT, myState.swbcntBits); Debugger::set_bits(myState.SWCHB, myState.swchbBits);
// Timer registers // Timer registers
myState.TIM1T = tim1T(); myState.TIM1T = tim1T();
@ -58,14 +58,14 @@ const DebuggerState& RiotDebug::getState()
void RiotDebug::saveOldState() void RiotDebug::saveOldState()
{ {
// Port A & B registers // Port A & B registers
myOldState.SWCHA = swcha(); myOldState.SWCHA_R = swcha();
myOldState.SWCHB = swchb(); myOldState.SWCHA_W = mySystem.m6532().myOutA;
myOldState.SWACNT = swacnt(); myOldState.SWACNT = swacnt();
myOldState.SWBCNT = swbcnt(); myOldState.SWCHB = swchb();
Debugger::set_bits(myOldState.SWCHA, myOldState.swchaBits); Debugger::set_bits(myOldState.SWCHA_R, myOldState.swchaReadBits);
Debugger::set_bits(myOldState.SWCHB, myOldState.swchbBits); Debugger::set_bits(myOldState.SWCHA_W, myOldState.swchaWriteBits);
Debugger::set_bits(myOldState.SWACNT, myOldState.swacntBits); Debugger::set_bits(myOldState.SWACNT, myOldState.swacntBits);
Debugger::set_bits(myOldState.SWBCNT, myOldState.swbcntBits); Debugger::set_bits(myOldState.SWCHB, myOldState.swchbBits);
// Timer registers // Timer registers
myOldState.TIM1T = tim1T(); myOldState.TIM1T = tim1T();
@ -105,13 +105,6 @@ uInt8 RiotDebug::swacnt(int newVal)
return mySystem.peek(0x281); 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) uInt8 RiotDebug::tim1T(int newVal)
{ {
@ -228,14 +221,14 @@ string RiotDebug::toString()
const RiotState& oldstate = (RiotState&) getOldState(); const RiotState& oldstate = (RiotState&) getOldState();
string ret; string ret;
ret += myDebugger.valueToString(0x280) + "/SWCHA" + ret += myDebugger.valueToString(0x280) + "/SWCHA(R)=" +
myDebugger.invIfChanged(state.SWCHA, oldstate.SWCHA) + " "; myDebugger.invIfChanged(state.SWCHA_R, oldstate.SWCHA_R) + " ";
ret += myDebugger.valueToString(0x281) + "/SWACNT" + 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) + " "; myDebugger.invIfChanged(state.SWACNT, oldstate.SWACNT) + " ";
ret += myDebugger.valueToString(0x282) + "/SWCHB" + ret += myDebugger.valueToString(0x282) + "/SWCHB=" +
myDebugger.invIfChanged(state.SWCHB, oldstate.SWCHB) + " "; myDebugger.invIfChanged(state.SWCHB, oldstate.SWCHB) + " ";
ret += myDebugger.valueToString(0x283) + "/SWBCNT" +
myDebugger.invIfChanged(state.SWBCNT, oldstate.SWBCNT) + " ";
ret += "\n"; ret += "\n";
// These are squirrely: some symbol files will define these as // These are squirrely: some symbol files will define these as

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: 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 #ifndef RIOT_DEBUG_HXX
@ -28,11 +28,11 @@ class RiotDebug;
class RiotState : public DebuggerState class RiotState : public DebuggerState
{ {
public: public:
uInt8 SWCHA, SWCHB, SWACNT, SWBCNT; uInt8 SWCHA_R, SWCHA_W, SWACNT, SWCHB;
BoolArray swchaBits; BoolArray swchaReadBits;
BoolArray swchbBits; BoolArray swchaWriteBits;
BoolArray swacntBits; BoolArray swacntBits;
BoolArray swbcntBits; BoolArray swchbBits;
uInt8 TIM1T, TIM8T, TIM64T, TIM1024T, INTIM, TIMINT; uInt8 TIM1T, TIM8T, TIM64T, TIM1024T, INTIM, TIMINT;
Int32 TIMCLKS; Int32 TIMCLKS;
@ -51,9 +51,8 @@ class RiotDebug : public DebuggerSystem
/* Port A and B registers */ /* Port A and B registers */
uInt8 swcha(int newVal = -1); uInt8 swcha(int newVal = -1);
uInt8 swchb(int newVal = -1);
uInt8 swacnt(int newVal = -1); uInt8 swacnt(int newVal = -1);
uInt8 swbcnt(int newVal = -1); uInt8 swchb(int newVal = -1);
/* Timer registers & associated clock */ /* Timer registers & associated clock */
uInt8 tim1T(int newVal = -1); uInt8 tim1T(int newVal = -1);
@ -73,7 +72,7 @@ class RiotDebug : public DebuggerSystem
string diffP1String(); string diffP1String();
string tvTypeString(); string tvTypeString();
string switchesString(); string switchesString();
private: private:
RiotState myState; RiotState myState;
RiotState myOldState; RiotState myOldState;

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: 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -30,7 +30,7 @@
#include "RiotWidget.hxx" #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, \ t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth, fontHeight, \
desc, kTextAlignLeft); \ desc, kTextAlignLeft); \
xpos += t->getWidth() + 5; \ xpos += t->getWidth() + 5; \
@ -39,10 +39,6 @@
bits->setID(bitsID); \ bits->setID(bitsID); \
addFocusWidget(bits); \ addFocusWidget(bits); \
xpos += bits->getWidth() + 5; \ 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); bits->setList(off, on);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -56,7 +52,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
const int fontWidth = font.getMaxCharWidth(), const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(), fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(); lineHeight = font.getLineHeight();
int xpos = 10, ypos = 25, lwidth = 7 * fontWidth; int xpos = 10, ypos = 25, lwidth = 9 * fontWidth;
StaticTextWidget* t; StaticTextWidget* t;
// Set the strings to be used in the various bit registers // 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"); on.push_back("1");
} }
// SWCHA bits and actual value // SWCHA bits in 'poke' mode
CREATE_IO_REGS("SWCHA:", mySWCHABits, kSWCHABitsID, mySWCHA); CREATE_IO_REGS("SWCHA(W):", mySWCHAWriteBits, kSWCHABitsID);
// SWACNT bits and actual value // SWACNT bits
xpos = 10; ypos += lineHeight + 5; 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; xpos = 10; ypos += 2 * lineHeight;
CREATE_IO_REGS("SWCHB:", mySWCHBBits, kSWCHBBitsID, mySWCHB); CREATE_IO_REGS("SWCHB:", mySWCHBBits, 0);
// SWBCNT bits and actual value
xpos = 10; ypos += lineHeight + 5;
CREATE_IO_REGS("SWBCNT:", mySWBCNTBits, kSWBCNTBitsID, mySWBCNT);
// mySWBCNTBits->setEnabled(false);
} }
@ -94,12 +89,11 @@ RiotWidget::~RiotWidget()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void RiotWidget::loadConfig() void RiotWidget::loadConfig()
{ {
#define IO_REGS_UPDATE(bits, reg, s_bits, s_reg) \ #define IO_REGS_UPDATE(bits, s_bits) \
changed.clear(); \ changed.clear(); \
for(unsigned int i = 0; i < state.s_bits.size(); ++i) \ for(unsigned int i = 0; i < state.s_bits.size(); ++i) \
changed.push_back(state.s_bits[i] != oldstate.s_bits[i]); \ changed.push_back(state.s_bits[i] != oldstate.s_bits[i]); \
bits->setState(state.s_bits, changed); \ bits->setState(state.s_bits, changed);
reg->setList(state.s_reg, oldstate.s_reg, state.s_reg != oldstate.s_reg);
IntArray alist; IntArray alist;
IntArray vlist; IntArray vlist;
@ -112,17 +106,17 @@ void RiotWidget::loadConfig()
const RiotState& state = (RiotState&) riot.getState(); const RiotState& state = (RiotState&) riot.getState();
const RiotState& oldstate = (RiotState&) riot.getOldState(); const RiotState& oldstate = (RiotState&) riot.getOldState();
// Update the SWCHA register booleans // Update the SWCHA register booleans (poke mode)
IO_REGS_UPDATE(mySWCHABits, mySWCHA, swchaBits, SWCHA); IO_REGS_UPDATE(mySWCHAWriteBits, swchaWriteBits);
// Update the SWACNT register booleans // 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 // Update the SWCHB register booleans
IO_REGS_UPDATE(mySWCHBBits, mySWCHB, swchbBits, SWCHB); IO_REGS_UPDATE(mySWCHBBits, swchbBits);
// Update the SWBCNT register booleans
IO_REGS_UPDATE(mySWBCNTBits, mySWBCNT, swbcntBits, SWBCNT);
} }

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: 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
@ -25,7 +25,6 @@
class GuiObject; class GuiObject;
class ButtonWidget; class ButtonWidget;
class DataGridWidget; class DataGridWidget;
class EditTextWidget;
class ToggleBitWidget; class ToggleBitWidget;
#include "Array.hxx" #include "Array.hxx"
@ -45,23 +44,23 @@ class RiotWidget : public Widget, public CommandSender
private: private:
private: private:
ToggleBitWidget* mySWCHABits; ToggleBitWidget* mySWCHAReadBits;
ToggleBitWidget* mySWCHBBits; ToggleBitWidget* mySWCHAWriteBits;
ToggleBitWidget* mySWACNTBits; ToggleBitWidget* mySWACNTBits;
ToggleBitWidget* mySWBCNTBits; ToggleBitWidget* mySWCHBBits;
DataGridWidget* mySWCHA;
DataGridWidget* mySWCHB;
DataGridWidget* mySWACNT;
DataGridWidget* mySWBCNT;
DataGridWidget* myTim[4]; DataGridWidget* myTim[4];
DataGridWidget* myTimResults[4]; DataGridWidget* myTimResults[4];
EditTextWidget* myP0Dir, *myP1Dir; CheckboxWidget* myP0Dir, *myP1Dir;
EditTextWidget* myP0Diff, *myP1Diff; CheckboxWidget* myP0Diff, *myP1Diff;
EditTextWidget* myTVType; CheckboxWidget* myTVType;
EditTextWidget* mySwitches; CheckboxWidget* mySwitches;
StaticTextWidget* myP0DirText, *myP1DirText;
StaticTextWidget* myP0DiffText, *myP1DiffText;
StaticTextWidget* myTVTypeText;
StaticTextWidget* mySwitchesText;
// ID's for the various widgets // ID's for the various widgets
// We need ID's, since there are more than one of several types of widgets // We need ID's, since there are more than one of several types of widgets