Added 'Audio' tab to debugger. Currently, it only consists of the AUD

registers, and they're read-only.  This tab will be greatly expanded in
a future release.

Added a 'change bank' DataGridWidget to the ROM listing, and a
non-editable textwidget showing how many banks this cartridge supports
(just one for non-bankswitched ROMs).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@830 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2005-10-13 18:53:07 +00:00
parent 54050ead3d
commit e3d8eef7ac
11 changed files with 357 additions and 15 deletions

View File

@ -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.22 2005-08-18 16:21:11 stephena Exp $
// $Id: TIADebug.cxx,v 1.23 2005-10-13 18:53:07 stephena Exp $
//============================================================================
#include "System.hxx"
@ -86,6 +86,15 @@ DebuggerState& TIADebug::getState()
myState.size.push_back(nusizM1());
myState.size.push_back(sizeBL());
// Audio registers
myState.aud.clear();
myState.aud.push_back(audF0());
myState.aud.push_back(audF1());
myState.aud.push_back(audC0());
myState.aud.push_back(audC1());
myState.aud.push_back(audV0());
myState.aud.push_back(audV1());
return myState;
}
@ -138,6 +147,14 @@ void TIADebug::saveOldState()
myOldState.size.push_back(nusizM1());
myOldState.size.push_back(sizeBL());
// Audio registers
myOldState.aud.clear();
myOldState.aud.push_back(audF0());
myOldState.aud.push_back(audF1());
myOldState.aud.push_back(audC0());
myOldState.aud.push_back(audC1());
myOldState.aud.push_back(audV0());
myOldState.aud.push_back(audV1());
}
/* the set methods now use mySystem->poke(). This will save us the

View File

@ -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.18 2005-08-18 16:19:07 stephena Exp $
// $Id: TIADebug.hxx,v 1.19 2005-10-13 18:53:07 stephena Exp $
//============================================================================
#ifndef TIA_DEBUG_HXX
@ -96,6 +96,7 @@ class TiaState : public DebuggerState
IntArray hm;
IntArray pf;
IntArray size;
IntArray aud;
};
class TIADebug : public DebuggerSystem

View File

@ -0,0 +1,184 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AudioWidget.cxx,v 1.1 2005-10-13 18:53:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#include "OSystem.hxx"
#include "FrameBuffer.hxx"
#include "GuiUtils.hxx"
#include "GuiObject.hxx"
#include "TIADebug.hxx"
#include "Widget.hxx"
#include "DataGridWidget.hxx"
#include "AudioWidget.hxx"
// ID's for the various widgets
// We need ID's, since there are more than one of several types of widgets
enum {
kAUDFID,
kAUDCID,
kAUDVID
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioWidget::AudioWidget(GuiObject* boss, int x, int y, int w, int h)
: Widget(boss, x, y, w, h),
CommandSender(boss)
{
const GUI::Font& font = instance()->consoleFont();
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight();
int xpos = 10, ypos = 25, lwidth = font.getStringWidth("AUDW: ");
StaticTextWidget* t;
// AudF registers
t = new StaticTextWidget(boss, xpos, ypos+2,
lwidth, fontHeight,
"AUDF:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth;
myAudF = new DataGridWidget(boss, font, xpos, ypos,
2, 1, 2, 5, kBASE_16);
myAudF->setTarget(this);
myAudF->setID(kAUDFID);
myAudF->setEditable(false);
addFocusWidget(myAudF);
for(int col = 0; col < 2; ++col)
{
t = new StaticTextWidget(boss, xpos + col*myAudF->colWidth() + 7,
ypos - lineHeight,
fontWidth, fontHeight,
Debugger::to_hex_4(col),
kTextAlignLeft);
t->setFont(font);
}
// AudC registers
xpos = 10; ypos += lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos+2,
lwidth, fontHeight,
"AUDC:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth;
myAudC = new DataGridWidget(boss, font, xpos, ypos,
2, 1, 2, 4, kBASE_16);
myAudC->setTarget(this);
myAudC->setID(kAUDCID);
myAudC->setEditable(false);
addFocusWidget(myAudC);
// AudV registers
xpos = 10; ypos += lineHeight + 5;
t = new StaticTextWidget(boss, xpos, ypos+2,
lwidth, fontHeight,
"AUDV:", kTextAlignLeft);
t->setFont(font);
xpos += lwidth;
myAudV = new DataGridWidget(boss, font, xpos, ypos,
2, 1, 2, 4, kBASE_16);
myAudV->setTarget(this);
myAudV->setID(kAUDVID);
myAudV->setEditable(false);
addFocusWidget(myAudV);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioWidget::~AudioWidget()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AudioWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
{
/* FIXME - implement this
// We simply change the values in the DataGridWidget
// It will then send the 'kDGItemDataChangedCmd' signal to change the actual
// memory location
int addr, value;
string buf;
Debugger& dbg = instance()->debugger();
TIADebug& tia = dbg.tiaDebug();
switch(cmd)
{
case kDGItemDataChangedCmd:
switch(id)
{
case kNusizP0ID:
tia.nusizP0(myNusizP0->getSelectedValue());
myNusizP0Text->setEditString(tia.nusizP0String());
break;
}
break;
}
*/
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AudioWidget::loadConfig()
{
//cerr << "AudioWidget::loadConfig()\n";
fillGrid();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AudioWidget::fillGrid()
{
IntArray alist;
IntArray vlist;
BoolArray blist, changed, grNew, grOld;
Debugger& dbg = instance()->debugger();
TIADebug& tia = dbg.tiaDebug();
TiaState state = (TiaState&) tia.getState();
TiaState oldstate = (TiaState&) tia.getOldState();
// AUDF0/1
alist.clear(); vlist.clear(); changed.clear();
for(unsigned int i = 0; i < 2; i++)
{
alist.push_back(i);
vlist.push_back(state.aud[i]);
changed.push_back(state.aud[i] != oldstate.aud[i]);
}
myAudF->setList(alist, vlist, changed);
// AUDC0/1
alist.clear(); vlist.clear(); changed.clear();
for(unsigned int i = 2; i < 4; i++)
{
alist.push_back(i-2);
vlist.push_back(state.aud[i]);
changed.push_back(state.aud[i] != oldstate.aud[i]);
}
myAudC->setList(alist, vlist, changed);
// AUDV0/1
alist.clear(); vlist.clear(); changed.clear();
for(unsigned int i = 4; i < 6; i++)
{
alist.push_back(i-4);
vlist.push_back(state.aud[i]);
changed.push_back(state.aud[i] != oldstate.aud[i]);
}
myAudV->setList(alist, vlist, changed);
}

View File

@ -0,0 +1,50 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2005 by Bradford W. Mott and the Stella team
//
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: AudioWidget.hxx,v 1.1 2005-10-13 18:53:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
//============================================================================
#ifndef AUDIO_WIDGET_HXX
#define AUDIO_WIDGET_HXX
class GuiObject;
class DataGridWidget;
#include "Widget.hxx"
#include "Command.hxx"
class AudioWidget : public Widget, public CommandSender
{
public:
AudioWidget(GuiObject* boss, int x, int y, int w, int h);
virtual ~AudioWidget();
void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();
private:
void fillGrid();
private:
DataGridWidget* myAudF;
DataGridWidget* myAudC;
DataGridWidget* myAudV;
};
#endif

View File

@ -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.2 2005-09-23 23:35:02 stephena Exp $
// $Id: DataGridWidget.cxx,v 1.3 2005-10-13 18:53:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -64,6 +64,9 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
int size = _rows * _cols;
while((int)_hiliteList.size() < size)
_hiliteList.push_back(false);
// Set lower and upper bounds to sane values
setRange(0, 1 << bits);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -167,6 +170,13 @@ void DataGridWidget::setSelectedValue(int value)
setDirty(); draw();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setRange(int lower, int upper)
{
_lowerBound = MAX(0, lower);
_upperBound = MIN(1 << _bits, upper);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::handleMouseDown(int x, int y, int button, int clickCount)
{
@ -572,7 +582,7 @@ void DataGridWidget::endEditMode()
// Update the both the string representation and the real data
int value = instance()->debugger().stringToValue(_editString);
if(value < 0 || value > (1 << _bits))
if(value < _lowerBound || value >= _upperBound)
{
abortEditMode();
return;
@ -609,6 +619,8 @@ void DataGridWidget::negateCell()
{
int mask = (1 << _bits) - 1;
int value = getSelectedValue();
if(mask != _upperBound - 1) // ignore when values aren't byte-aligned
return;
value = ((~value) + 1) & mask;
setSelectedValue(value);
@ -619,6 +631,8 @@ void DataGridWidget::invertCell()
{
int mask = (1 << _bits) - 1;
int value = getSelectedValue();
if(mask != _upperBound - 1) // ignore when values aren't byte-aligned
return;
value = ~value & mask;
setSelectedValue(value);
@ -629,6 +643,8 @@ void DataGridWidget::decrementCell()
{
int mask = (1 << _bits) - 1;
int value = getSelectedValue();
if(value <= _lowerBound) // take care of wrap-around
value = _upperBound;
value = (value - 1) & mask;
setSelectedValue(value);
@ -639,6 +655,8 @@ void DataGridWidget::incrementCell()
{
int mask = (1 << _bits) - 1;
int value = getSelectedValue();
if(value >= _upperBound - 1) // take care of wrap-around
value = _lowerBound - 1;
value = (value + 1) & mask;
setSelectedValue(value);
@ -649,6 +667,8 @@ void DataGridWidget::lshiftCell()
{
int mask = (1 << _bits) - 1;
int value = getSelectedValue();
if(mask != _upperBound - 1) // ignore when values aren't byte-aligned
return;
value = (value << 1) & mask;
setSelectedValue(value);
@ -659,6 +679,8 @@ void DataGridWidget::rshiftCell()
{
int mask = (1 << _bits) - 1;
int value = getSelectedValue();
if(mask != _upperBound - 1) // ignore when values aren't byte-aligned
return;
value = (value >> 1) & mask;
setSelectedValue(value);

View File

@ -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.1 2005-08-30 17:51:26 stephena Exp $
// $Id: DataGridWidget.hxx,v 1.2 2005-10-13 18:53:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -59,6 +59,8 @@ class DataGridWidget : public EditableWidget
int getSelectedAddr() const { return _addrList[_selectedItem]; }
int getSelectedValue() const { return _valueList[_selectedItem]; }
void setRange(int lower, int upper);
virtual void handleMouseDown(int x, int y, int button, int clickCount);
virtual void handleMouseUp(int x, int y, int button, int clickCount);
virtual bool handleKeyDown(int ascii, int keycode, int modifiers);
@ -96,6 +98,8 @@ class DataGridWidget : public EditableWidget
int _rowHeight;
int _colWidth;
int _bits;
int _lowerBound;
int _upperBound;
BaseFormat _base;

View File

@ -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: DebuggerDialog.cxx,v 1.7 2005-09-30 00:40:33 stephena Exp $
// $Id: DebuggerDialog.cxx,v 1.8 2005-10-13 18:53:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -25,6 +25,7 @@
#include "TiaInfoWidget.hxx"
#include "TiaOutputWidget.hxx"
#include "TiaZoomWidget.hxx"
#include "AudioWidget.hxx"
#include "PromptWidget.hxx"
#include "CpuWidget.hxx"
#include "RamWidget.hxx"
@ -167,6 +168,12 @@ void DebuggerDialog::addTabArea()
myTab->setParentWidget(tabID, tia);
addToFocusList(tia->getFocusList(), tabID);
// The Audio tab
tabID = myTab->addTab("Audio");
AudioWidget* aud = new AudioWidget(myTab, 2, 2, widWidth, widHeight);
myTab->setParentWidget(tabID, aud);
addToFocusList(aud->getFocusList(), tabID);
// The input/output tab (part of RIOT)
// tabID = myTab->addTab("I/O");

View File

@ -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: RomWidget.cxx,v 1.11 2005-10-13 01:13:20 urchlay Exp $
// $Id: RomWidget.cxx,v 1.12 2005-10-13 18:53:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -24,6 +24,7 @@
#include "Debugger.hxx"
#include "DebuggerParser.hxx"
#include "CpuDebug.hxx"
#include "DataGridWidget.hxx"
#include "PackedBitArray.hxx"
#include "GuiObject.hxx"
#include "InputTextDialog.hxx"
@ -44,9 +45,42 @@ RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
myCurrentBank(-1)
{
int w = 58 * font.getMaxCharWidth(),
h = 31 * font.getLineHeight();
h = 30 * font.getLineHeight(),
xpos, ypos;
StaticTextWidget* t;
myRomList = new RomListWidget(boss, font, x, y, w, h);
// Create bank editable area
xpos = x + 40; ypos = y;
t = new StaticTextWidget(boss, xpos, ypos,
font.getStringWidth("Current bank: "),
font.getFontHeight(),
"Current bank:", kTextAlignLeft);
t->setFont(font);
xpos += t->getWidth() + 10;
myBank = new DataGridWidget(boss, font, xpos, ypos-2,
1, 1, 1, 2, kBASE_16_4);
myBank->setTarget(this);
myBank->setRange(0, instance()->debugger().bankCount());
addFocusWidget(myBank);
// Show number of banks
xpos += myBank->getWidth() + 45;
t = new StaticTextWidget(boss, xpos, ypos,
font.getStringWidth("Total banks: "),
font.getFontHeight(),
"Total banks:", kTextAlignLeft);
t->setFont(font);
xpos += t->getWidth() + 10;
myBankCount = new EditTextWidget(boss, xpos, ypos-2,
20, font.getLineHeight(), "");
myBankCount->setFont(font);
myBankCount->setEditable(false);
// Create rom listing
xpos = x; ypos += myBank->getHeight() + 2;
myRomList = new RomListWidget(boss, font, xpos, ypos, w, h);
myRomList->setTarget(this);
myRomList->myMenu->setTarget(this);
myRomList->setStyle(kSolidFill);
@ -113,6 +147,12 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
}
break;
}
case kDGItemDataChangedCmd:
{
int bank = myBank->getSelectedValue();
instance()->debugger().setBank(bank);
}
}
}
@ -120,9 +160,10 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
void RomWidget::loadConfig()
{
Debugger& dbg = instance()->debugger();
bool bankChanged = myCurrentBank != dbg.getBank();
// Only reload full bank when necessary
if(myListIsDirty || myCurrentBank != dbg.getBank())
if(myListIsDirty || bankChanged)
{
initialUpdate();
myListIsDirty = false;
@ -131,7 +172,6 @@ void RomWidget::loadConfig()
{
incrementalUpdate(myRomList->currentPos(), myRomList->rows());
}
myCurrentBank = dbg.getBank();
// Update romlist to point to current PC
@ -152,6 +192,20 @@ void RomWidget::loadConfig()
if(iter != myLineList.end())
myRomList->setHighlighted(iter->second);
// Set current bank
IntArray alist;
IntArray vlist;
BoolArray changed;
alist.push_back(-1);
vlist.push_back(dbg.getBank());
changed.push_back(bankChanged);
myBank->setList(alist, vlist, changed);
// Indicate total number of banks
int bankCount = dbg.bankCount();
myBankCount->setEditString(dbg.valueToString(bankCount));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: RomWidget.hxx,v 1.6 2005-10-06 17:28:55 stephena Exp $
// $Id: RomWidget.hxx,v 1.7 2005-10-13 18:53:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -23,6 +23,8 @@
#define ROM_WIDGET_HXX
class GuiObject;
class DataGridWidget;
class EditTextWidget;
class InputTextDialog;
class RomListWidget;
class StringList;
@ -65,6 +67,8 @@ class RomWidget : public Widget, public CommandSender
/** List of line numbers indexed by address */
AddrToLine myLineList;
DataGridWidget* myBank;
EditTextWidget* myBankCount;
InputTextDialog* mySaveRom;
bool myListIsDirty;

View File

@ -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.1 2005-08-30 17:51:26 stephena Exp $
// $Id: TiaWidget.hxx,v 1.2 2005-10-13 18:53:07 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -47,8 +47,6 @@ class TiaWidget : public Widget, public CommandSender
private:
void fillGrid();
void changeColorRegs();
void convertCharToBool(BoolArray& b, unsigned char value);
int convertBoolToInt(const BoolArray& b);
private:
DataGridWidget* myRamGrid;

View File

@ -1,6 +1,7 @@
MODULE := src/debugger/gui
MODULE_OBJS := \
src/debugger/gui/AudioWidget.o \
src/debugger/gui/CpuWidget.o \
src/debugger/gui/PromptWidget.o \
src/debugger/gui/RamWidget.o \