mirror of https://github.com/stella-emu/stella.git
Added timer registers to the debugger RIOT tab, and enabled the changes
to be sent to the debugger core. SWCHA and SWACNT can be changed, SWCHB cannot. The latter will be addressed by a series of labelled checkboxes that more clearly illustrate the function. Also, INTIM/TIMINT/TimClks cannot be changed, as it doesn't make sense to do so (their results depend on other registers; more specifically, they're calculated, not stored). You can however change the TIMxxT, which will consequently change the read-only timer registers. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1506 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
2b07fcab04
commit
865fc88e7c
|
@ -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.93 2008-04-19 21:11:52 stephena Exp $
|
// $Id: Debugger.hxx,v 1.94 2008-05-14 18:04:57 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#ifndef DEBUGGER_HXX
|
#ifndef DEBUGGER_HXX
|
||||||
|
@ -70,7 +70,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
|
||||||
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.93 2008-04-19 21:11:52 stephena Exp $
|
@version $Id: Debugger.hxx,v 1.94 2008-05-14 18:04:57 stephena Exp $
|
||||||
*/
|
*/
|
||||||
class Debugger : public DialogContainer
|
class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -267,12 +267,8 @@ class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
uInt8 result = 0x0;
|
uInt8 result = 0x0;
|
||||||
for(int i = 0; i < 8; ++i)
|
for(int i = 0; i < 8; ++i)
|
||||||
{
|
|
||||||
if(bits[i])
|
if(bits[i])
|
||||||
result |= (1<<(7-i));
|
result |= (1<<(7-i));
|
||||||
else
|
|
||||||
return result &= ~(1<<(7-i));
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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.2 2008-05-13 15:13:17 stephena Exp $
|
// $Id: RiotWidget.cxx,v 1.3 2008-05-14 18:04:57 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
|
||||||
|
@ -74,10 +74,41 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
// SWCHA bits in 'peek' mode
|
// SWCHA bits in 'peek' mode
|
||||||
xpos = 10; ypos += lineHeight + 5;
|
xpos = 10; ypos += lineHeight + 5;
|
||||||
CREATE_IO_REGS("SWCHA(R):", mySWCHAReadBits, 0);
|
CREATE_IO_REGS("SWCHA(R):", mySWCHAReadBits, 0);
|
||||||
|
mySWCHAReadBits->setEditable(false);
|
||||||
|
|
||||||
// SWCHB bits in 'peek' mode
|
// SWCHB bits in 'peek' mode
|
||||||
xpos = 10; ypos += 2 * lineHeight;
|
xpos = 10; ypos += 2 * lineHeight;
|
||||||
CREATE_IO_REGS("SWCHB:", mySWCHBBits, 0);
|
CREATE_IO_REGS("SWCHB:", mySWCHBBits, 0);
|
||||||
|
mySWCHBBits->setEditable(false);
|
||||||
|
|
||||||
|
// Timer registers (R/W)
|
||||||
|
const char* writeNames[] = { "TIM1T:", "TIM8T:", "TIM64T:", "TIM1024T:" };
|
||||||
|
xpos = 10; ypos += 2*lineHeight;
|
||||||
|
for(int row = 0; row < 4; ++row)
|
||||||
|
{
|
||||||
|
t = new StaticTextWidget(boss, font, xpos, ypos + row*lineHeight + 2,
|
||||||
|
9*fontWidth, fontHeight, writeNames[row], kTextAlignLeft);
|
||||||
|
}
|
||||||
|
xpos += 9*fontWidth + 5;
|
||||||
|
myTimWrite = new DataGridWidget(boss, font, xpos, ypos, 1, 4, 2, 8, kBASE_16);
|
||||||
|
myTimWrite->setTarget(this);
|
||||||
|
myTimWrite->setID(kTimWriteID);
|
||||||
|
addFocusWidget(myTimWrite);
|
||||||
|
|
||||||
|
// Timer registers (RO)
|
||||||
|
const char* readNames[] = { "INTIM:", "TIMINT:", "Tim Clks:" };
|
||||||
|
xpos = 10; ypos += myTimWrite->getHeight() + lineHeight;
|
||||||
|
for(int row = 0; row < 3; ++row)
|
||||||
|
{
|
||||||
|
t = new StaticTextWidget(boss, font, xpos, ypos + row*lineHeight + 2,
|
||||||
|
9*fontWidth, fontHeight, readNames[row], kTextAlignLeft);
|
||||||
|
}
|
||||||
|
xpos += 9*fontWidth + 5;
|
||||||
|
myTimRead = new DataGridWidget(boss, font, xpos, ypos, 1, 3, 8, 32, kBASE_16);
|
||||||
|
myTimRead->setTarget(this);
|
||||||
|
myTimRead->setEditable(false);
|
||||||
|
addFocusWidget(myTimRead);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,9 +149,77 @@ void RiotWidget::loadConfig()
|
||||||
// Update the SWCHB register booleans
|
// Update the SWCHB register booleans
|
||||||
IO_REGS_UPDATE(mySWCHBBits, swchbBits);
|
IO_REGS_UPDATE(mySWCHBBits, swchbBits);
|
||||||
|
|
||||||
|
// Update timer write registers
|
||||||
|
alist.clear(); vlist.clear(); changed.clear();
|
||||||
|
alist.push_back(kTim1TID); vlist.push_back(state.TIM1T);
|
||||||
|
changed.push_back(state.TIM1T != oldstate.TIM1T);
|
||||||
|
alist.push_back(kTim8TID); vlist.push_back(state.TIM8T);
|
||||||
|
changed.push_back(state.TIM8T != oldstate.TIM8T);
|
||||||
|
alist.push_back(kTim64TID); vlist.push_back(state.TIM64T);
|
||||||
|
changed.push_back(state.TIM64T != oldstate.TIM64T);
|
||||||
|
alist.push_back(kTim1024TID); vlist.push_back(state.TIM1024T);
|
||||||
|
changed.push_back(state.TIM1024T != oldstate.TIM1024T);
|
||||||
|
myTimWrite->setList(alist, vlist, changed);
|
||||||
|
|
||||||
|
// Update timer read registers
|
||||||
|
alist.clear(); vlist.clear(); changed.clear();
|
||||||
|
alist.push_back(0); vlist.push_back(state.INTIM);
|
||||||
|
changed.push_back(state.INTIM != oldstate.INTIM);
|
||||||
|
alist.push_back(0); vlist.push_back(state.TIMINT);
|
||||||
|
changed.push_back(state.TIMINT != oldstate.TIMINT);
|
||||||
|
alist.push_back(0); vlist.push_back(state.TIMCLKS);
|
||||||
|
changed.push_back(state.TIMCLKS != oldstate.TIMCLKS);
|
||||||
|
myTimRead->setList(alist, vlist, changed);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
{
|
{
|
||||||
|
int addr = -1, value = -1;
|
||||||
|
RiotDebug& riot = instance()->debugger().riotDebug();
|
||||||
|
|
||||||
|
switch(cmd)
|
||||||
|
{
|
||||||
|
case kDGItemDataChangedCmd:
|
||||||
|
switch(id)
|
||||||
|
{
|
||||||
|
case kTimWriteID:
|
||||||
|
{
|
||||||
|
addr = myTimWrite->getSelectedAddr();
|
||||||
|
value = myTimWrite->getSelectedValue();
|
||||||
|
switch(addr)
|
||||||
|
{
|
||||||
|
case kTim1TID:
|
||||||
|
riot.tim1T(value);
|
||||||
|
break;
|
||||||
|
case kTim8TID:
|
||||||
|
riot.tim8T(value);
|
||||||
|
break;
|
||||||
|
case kTim64TID:
|
||||||
|
riot.tim64T(value);
|
||||||
|
break;
|
||||||
|
case kTim1024TID:
|
||||||
|
riot.tim1024T(value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kTWItemDataChangedCmd:
|
||||||
|
switch(id)
|
||||||
|
{
|
||||||
|
case kSWCHABitsID:
|
||||||
|
value = Debugger::get_bits((BoolArray&)mySWCHAWriteBits->getState());
|
||||||
|
riot.swcha(value & 0xff);
|
||||||
|
break;
|
||||||
|
case kSWACNTBitsID:
|
||||||
|
value = Debugger::get_bits((BoolArray&)mySWACNTBits->getState());
|
||||||
|
riot.swacnt(value & 0xff);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.2 2008-05-13 15:13:17 stephena Exp $
|
// $Id: RiotWidget.hxx,v 1.3 2008-05-14 18:04:58 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
|
||||||
|
@ -49,8 +49,8 @@ class RiotWidget : public Widget, public CommandSender
|
||||||
ToggleBitWidget* mySWACNTBits;
|
ToggleBitWidget* mySWACNTBits;
|
||||||
ToggleBitWidget* mySWCHBBits;
|
ToggleBitWidget* mySWCHBBits;
|
||||||
|
|
||||||
DataGridWidget* myTim[4];
|
DataGridWidget* myTimWrite;
|
||||||
DataGridWidget* myTimResults[4];
|
DataGridWidget* myTimRead;
|
||||||
|
|
||||||
CheckboxWidget* myP0Dir, *myP1Dir;
|
CheckboxWidget* myP0Dir, *myP1Dir;
|
||||||
CheckboxWidget* myP0Diff, *myP1Diff;
|
CheckboxWidget* myP0Diff, *myP1Diff;
|
||||||
|
@ -65,9 +65,8 @@ class RiotWidget : public Widget, public CommandSender
|
||||||
// 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
|
||||||
enum {
|
enum {
|
||||||
kSWCHABitsID, kSWCHBBitsID, kSWACNTBitsID, kSWBCNTBitsID,
|
kTim1TID = 0, kTim8TID = 1, kTim64TID = 2, kTim1024TID = 3,
|
||||||
kTim1TID, kTim8TID, kTim64TID, kTim1024TID,
|
kSWCHABitsID, kSWACNTBitsID, kSWCHBBitsID, kTimWriteID
|
||||||
kIntimID, kTimintID, kTimclksID
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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: ToggleWidget.cxx,v 1.7 2008-02-06 13:45:20 stephena Exp $
|
// $Id: ToggleWidget.cxx,v 1.8 2008-05-14 18:04:58 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
|
||||||
|
@ -32,7 +32,8 @@ ToggleWidget::ToggleWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
_cols(cols),
|
_cols(cols),
|
||||||
_currentRow(0),
|
_currentRow(0),
|
||||||
_currentCol(0),
|
_currentCol(0),
|
||||||
_selectedItem(0)
|
_selectedItem(0),
|
||||||
|
_editable(true)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
|
||||||
WIDGET_WANTS_RAWDATA;
|
WIDGET_WANTS_RAWDATA;
|
||||||
|
@ -68,6 +69,9 @@ void ToggleWidget::handleMouseDown(int x, int y, int button, int clickCount)
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void ToggleWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
void ToggleWidget::handleMouseUp(int x, int y, int button, int clickCount)
|
||||||
{
|
{
|
||||||
|
if (!isEnabled() || !_editable)
|
||||||
|
return;
|
||||||
|
|
||||||
// If this was a double click and the mouse is still over the selected item,
|
// If this was a double click and the mouse is still over the selected item,
|
||||||
// send the double click command
|
// send the double click command
|
||||||
if (clickCount == 2 && (_selectedItem == findItem(x, y)))
|
if (clickCount == 2 && (_selectedItem == findItem(x, y)))
|
||||||
|
@ -185,7 +189,7 @@ bool ToggleWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
{
|
{
|
||||||
_selectedItem = _currentRow*_cols + _currentCol;
|
_selectedItem = _currentRow*_cols + _currentCol;
|
||||||
|
|
||||||
if(toggle)
|
if(toggle && _editable)
|
||||||
{
|
{
|
||||||
_stateList[_selectedItem] = !_stateList[_selectedItem];
|
_stateList[_selectedItem] = !_stateList[_selectedItem];
|
||||||
_changedList[_selectedItem] = !_changedList[_selectedItem];
|
_changedList[_selectedItem] = !_changedList[_selectedItem];
|
||||||
|
|
|
@ -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: ToggleWidget.hxx,v 1.5 2008-02-06 13:45:20 stephena Exp $
|
// $Id: ToggleWidget.hxx,v 1.6 2008-05-14 18:04:58 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
|
||||||
|
@ -51,7 +51,8 @@ class ToggleWidget : public Widget, public CommandSender
|
||||||
|
|
||||||
virtual bool wantsFocus() { return true; }
|
virtual bool wantsFocus() { return true; }
|
||||||
|
|
||||||
int colWidth() { return _colWidth; }
|
int colWidth() const { return _colWidth; }
|
||||||
|
void setEditable(bool editable) { _editable = editable; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void drawWidget(bool hilite) = 0;
|
void drawWidget(bool hilite) = 0;
|
||||||
|
@ -65,6 +66,7 @@ class ToggleWidget : public Widget, public CommandSender
|
||||||
int _rowHeight;
|
int _rowHeight;
|
||||||
int _colWidth;
|
int _colWidth;
|
||||||
int _selectedItem;
|
int _selectedItem;
|
||||||
|
bool _editable;
|
||||||
|
|
||||||
BoolArray _stateList;
|
BoolArray _stateList;
|
||||||
BoolArray _changedList;
|
BoolArray _changedList;
|
||||||
|
|
Loading…
Reference in New Issue