Added an oft-requested debugger feature: add buttons to the AtariVox/SaveKey

controller area to reset the EEPROM to default values.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2937 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-06-29 23:25:53 +00:00
parent 81d0dfdbdc
commit e3cc672368
10 changed files with 253 additions and 1 deletions

View File

@ -0,0 +1,72 @@
//============================================================================
//
// 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-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#include "AtariVox.hxx"
#include "MT24LC256.hxx"
#include "AtariVoxWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AtariVoxWidget::AtariVoxWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, Controller& controller)
: ControllerWidget(boss, font, x, y, controller)
{
bool leftport = myController.jack() == Controller::Left;
const string& label = leftport ? "Left (AtariVox):" : "Right (AtariVox):";
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(),
bwidth = font.getStringWidth("Erase EEPROM") + 20,
bheight = lineHeight + 4;
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (AtariVox):");
StaticTextWidget* t;
t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
fontHeight, label, kTextAlignLeft);
ypos += t->getHeight() + 20;
myEEPROMErase =
new ButtonWidget(boss, font, xpos+10, ypos, bwidth, bheight,
"Erase EEPROM", kEEPROMErase);
myEEPROMErase->setTarget(this);
ypos += lineHeight + 20;
new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22,
fontHeight, "(*) This will erase", kTextAlignLeft);
ypos += lineHeight + 2;
new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22,
fontHeight, "all EEPROM data, not", kTextAlignLeft);
ypos += lineHeight + 2;
new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22,
fontHeight, "just the range used", kTextAlignLeft);
ypos += lineHeight + 2;
new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22,
fontHeight, "for this ROM", kTextAlignLeft);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AtariVoxWidget::handleCommand(CommandSender*, int cmd, int, int)
{
if(cmd == kEEPROMErase)
{
AtariVox& avox = (AtariVox&)myController;
avox.myEEPROM->erase();
}
}

View File

@ -0,0 +1,43 @@
//============================================================================
//
// 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-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#ifndef ATARIVOX_WIDGET_HXX
#define ATARIVOX_WIDGET_HXX
class ButtonWidget;
#include "Control.hxx"
#include "ControllerWidget.hxx"
class AtariVoxWidget : public ControllerWidget
{
public:
AtariVoxWidget(GuiObject* boss, const GUI::Font& font, int x, int y,
Controller& controller);
virtual ~AtariVoxWidget() { }
void loadConfig() { }
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
ButtonWidget* myEEPROMErase;
enum { kEEPROMErase = 'eeER' };
};
#endif

View File

@ -35,6 +35,8 @@
#include "DrivingWidget.hxx" #include "DrivingWidget.hxx"
#include "GenesisWidget.hxx" #include "GenesisWidget.hxx"
#include "KeyboardWidget.hxx" #include "KeyboardWidget.hxx"
#include "AtariVoxWidget.hxx"
#include "SaveKeyWidget.hxx"
#include "RiotWidget.hxx" #include "RiotWidget.hxx"
@ -440,6 +442,10 @@ ControllerWidget* RiotWidget::addControlWidget(GuiObject* boss, const GUI::Font&
return new GenesisWidget(boss, font, x, y, controller); return new GenesisWidget(boss, font, x, y, controller);
case Controller::Keyboard: case Controller::Keyboard:
return new KeyboardWidget(boss, font, x, y, controller); return new KeyboardWidget(boss, font, x, y, controller);
case Controller::AtariVox:
return new AtariVoxWidget(boss, font, x, y, controller);
case Controller::SaveKey:
return new SaveKeyWidget(boss, font, x, y, controller);
default: default:
return new NullControlWidget(boss, font, x, y, controller); return new NullControlWidget(boss, font, x, y, controller);
} }

View File

@ -0,0 +1,72 @@
//============================================================================
//
// 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-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#include "SaveKey.hxx"
#include "MT24LC256.hxx"
#include "SaveKeyWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SaveKeyWidget::SaveKeyWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, Controller& controller)
: ControllerWidget(boss, font, x, y, controller)
{
bool leftport = myController.jack() == Controller::Left;
const string& label = leftport ? "Left (SaveKey):" : "Right (SaveKey):";
const int fontWidth = font.getMaxCharWidth(),
fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(),
bwidth = font.getStringWidth("Erase EEPROM") + 20,
bheight = lineHeight + 4;
int xpos = x, ypos = y, lwidth = font.getStringWidth("Right (SaveKey):");
StaticTextWidget* t;
t = new StaticTextWidget(boss, font, xpos, ypos+2, lwidth,
fontHeight, label, kTextAlignLeft);
ypos += t->getHeight() + 20;
myEEPROMErase =
new ButtonWidget(boss, font, xpos+10, ypos, bwidth, bheight,
"Erase EEPROM", kEEPROMErase);
myEEPROMErase->setTarget(this);
ypos += lineHeight + 20;
new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22,
fontHeight, "(*) This will erase", kTextAlignLeft);
ypos += lineHeight + 2;
new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22,
fontHeight, "all EEPROM data, not", kTextAlignLeft);
ypos += lineHeight + 2;
new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22,
fontHeight, "just the range used", kTextAlignLeft);
ypos += lineHeight + 2;
new StaticTextWidget(boss, font, xpos, ypos, fontWidth*22,
fontHeight, "for this ROM", kTextAlignLeft);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void SaveKeyWidget::handleCommand(CommandSender*, int cmd, int, int)
{
if(cmd == kEEPROMErase)
{
SaveKey& skey = (SaveKey&)myController;
skey.myEEPROM->erase();
}
}

View File

@ -0,0 +1,43 @@
//============================================================================
//
// 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-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id$
//============================================================================
#ifndef SAVEKEY_WIDGET_HXX
#define SAVEKEY_WIDGET_HXX
class ButtonWidget;
#include "Control.hxx"
#include "ControllerWidget.hxx"
class SaveKeyWidget : public ControllerWidget
{
public:
SaveKeyWidget(GuiObject* boss, const GUI::Font& font, int x, int y,
Controller& controller);
virtual ~SaveKeyWidget() { }
void loadConfig() { }
void handleCommand(CommandSender* sender, int cmd, int data, int id);
private:
ButtonWidget* myEEPROMErase;
enum { kEEPROMErase = 'eeER' };
};
#endif

View File

@ -61,7 +61,9 @@ MODULE_OBJS := \
src/debugger/gui/BoosterWidget.o \ src/debugger/gui/BoosterWidget.o \
src/debugger/gui/DrivingWidget.o \ src/debugger/gui/DrivingWidget.o \
src/debugger/gui/KeyboardWidget.o \ src/debugger/gui/KeyboardWidget.o \
src/debugger/gui/GenesisWidget.o src/debugger/gui/GenesisWidget.o \
src/debugger/gui/AtariVoxWidget.o \
src/debugger/gui/SaveKeyWidget.o
MODULE_DIRS += \ MODULE_DIRS += \
src/debugger/gui src/debugger/gui

View File

@ -37,6 +37,8 @@ class MT24LC256;
*/ */
class AtariVox : public Controller class AtariVox : public Controller
{ {
friend class AtariVoxWidget;
public: public:
/** /**
Create a new AtariVox controller plugged into the specified jack Create a new AtariVox controller plugged into the specified jack

View File

@ -148,6 +148,13 @@ void MT24LC256::update()
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MT24LC256::erase()
{
memset(myData, 0xff, 32768);
myDataChanged = true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MT24LC256::systemCyclesReset() void MT24LC256::systemCyclesReset()
{ {

View File

@ -57,6 +57,9 @@ class MT24LC256
void writeSDA(bool state); void writeSDA(bool state);
void writeSCL(bool state); void writeSCL(bool state);
/** Erase entire EEPROM to known state ($FF) */
void erase();
/** /**
Notification method invoked by the system right before the Notification method invoked by the system right before the
system resets its cycle counter to zero. It may be necessary system resets its cycle counter to zero. It may be necessary

View File

@ -36,6 +36,8 @@ class MT24LC256;
*/ */
class SaveKey : public Controller class SaveKey : public Controller
{ {
friend class SaveKeyWidget;
public: public:
/** /**
Create a new SaveKey controller plugged into the specified jack Create a new SaveKey controller plugged into the specified jack