mirror of https://github.com/stella-emu/stella.git
Added DebuggerSystem and DebuggerState classes to clean up the unwieldy
Debugger class. There will be a subsystem for each GUI debugger tab, and it will have responsibility for all thing related to that tab, eliminating a lot of code from Debugger class. Added RamDebug class, and changed the GUI RAM tab to use the new RamDebug subsystem. The prompt still uses the old method, which will have to be fixed. At that point, Debugger::(readRAM, writeRAM, ramChanged) can be eliminated. If the Debugger ever wants to access RAM related things, it should refer to RamDebug. Still TODO is create a CpuDebug subsystem, and turn the current TIADebug into a real subsystem. Cleaned up some redundant typedefs (changed AddrList/ValueList to IntArray). As well, we're moving away from having bspf stuff seeded throughout the system. Integer values will be stored/passed around as 'int', and truncated where necessary as close to the given method as possible. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@615 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
ad5ab7be92
commit
c3fab46791
|
@ -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: Debugger.cxx,v 1.52 2005-07-07 02:30:48 urchlay Exp $
|
||||
// $Id: Debugger.cxx,v 1.53 2005-07-07 15:18:55 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include "Debugger.hxx"
|
||||
#include "EquateList.hxx"
|
||||
#include "RamDebug.hxx"
|
||||
#include "TIADebug.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -46,6 +47,7 @@ Debugger::Debugger(OSystem* osystem)
|
|||
breakPoints(NULL),
|
||||
readTraps(NULL),
|
||||
writeTraps(NULL),
|
||||
myRamDebug(NULL),
|
||||
myTIAdebug(NULL)
|
||||
{
|
||||
// Init parser
|
||||
|
@ -63,6 +65,7 @@ Debugger::~Debugger()
|
|||
{
|
||||
delete myParser;
|
||||
delete myDebugger;
|
||||
delete myRamDebug;
|
||||
delete myTIAdebug;
|
||||
delete equateList;
|
||||
delete breakPoints;
|
||||
|
@ -123,6 +126,10 @@ void Debugger::setConsole(Console* console)
|
|||
myConsole = console;
|
||||
mySystem = &(myConsole->system());
|
||||
|
||||
// Create debugger subsystems
|
||||
delete myRamDebug;
|
||||
myRamDebug = new RamDebug(this);
|
||||
|
||||
// Create a new TIA debugger for this console
|
||||
// This code is somewhat ugly, since we derive a TIA from the MediaSource
|
||||
// for no particular reason. Maybe it's better to make the TIA be the
|
||||
|
@ -137,6 +144,7 @@ void Debugger::setConsole(Console* console)
|
|||
|
||||
autoLoadSymbols(myOSystem->romFile());
|
||||
|
||||
// FIXME - use the new RamDebug state stuff, and this is eliminated entirely
|
||||
for(int i=0; i<0x80; i++)
|
||||
myOldRAM[i] = readRAM(i);
|
||||
}
|
||||
|
@ -549,7 +557,7 @@ void Debugger::loadState(int state)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int Debugger::step()
|
||||
{
|
||||
saveRegs();
|
||||
saveState();
|
||||
|
||||
int cyc = mySystem->cycles();
|
||||
mySystem->m6502().execute(1);
|
||||
|
@ -575,7 +583,7 @@ int Debugger::trace()
|
|||
{
|
||||
// 32 is the 6502 JSR instruction:
|
||||
if(mySystem->peek(myDebugger->pc()) == 32) {
|
||||
saveRegs();
|
||||
saveState();
|
||||
|
||||
int cyc = mySystem->cycles();
|
||||
int targetPC = myDebugger->pc() + 3; // return address
|
||||
|
@ -807,7 +815,7 @@ string Debugger::disassemble(int start, int lines) {
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::nextFrame(int frames) {
|
||||
saveRegs();
|
||||
saveState();
|
||||
myOSystem->frameBuffer().advance(frames);
|
||||
}
|
||||
|
||||
|
@ -901,10 +909,16 @@ bool Debugger::patchROM(int addr, int value) {
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::saveRegs() {
|
||||
void Debugger::saveState() {
|
||||
// FIXME - this will be removed when we get state saving working
|
||||
// At that point, saving state will be accomplished by calling
|
||||
// saveState() on each subsystem
|
||||
for(int i=0; i<0x80; i++) {
|
||||
myOldRAM[i] = readRAM(i);
|
||||
}
|
||||
///////////////////
|
||||
myRamDebug->saveOldState();
|
||||
|
||||
oldA = getA();
|
||||
oldX = getX();
|
||||
oldY = getY();
|
||||
|
|
|
@ -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: Debugger.hxx,v 1.42 2005-07-07 02:30:48 urchlay Exp $
|
||||
// $Id: Debugger.hxx,v 1.43 2005-07-07 15:18:56 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
|
@ -24,6 +24,8 @@ class OSystem;
|
|||
class Console;
|
||||
class System;
|
||||
class D6502;
|
||||
class RamDebug;
|
||||
class TIADebug;
|
||||
|
||||
#include "DialogContainer.hxx"
|
||||
#include "M6502.hxx"
|
||||
|
@ -31,7 +33,6 @@ class D6502;
|
|||
#include "EquateList.hxx"
|
||||
#include "PackedBitArray.hxx"
|
||||
#include "PromptWidget.hxx"
|
||||
#include "TIADebug.hxx"
|
||||
#include "bspf.hxx"
|
||||
|
||||
enum {
|
||||
|
@ -51,11 +52,13 @@ enum {
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.42 2005-07-07 02:30:48 urchlay Exp $
|
||||
@version $Id: Debugger.hxx,v 1.43 2005-07-07 15:18:56 stephena Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
friend class DebuggerParser;
|
||||
friend class RamDebug;
|
||||
friend class TIADebug;
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -84,10 +87,13 @@ class Debugger : public DialogContainer
|
|||
*/
|
||||
void setConsole(Console* console);
|
||||
|
||||
/* save registers to oldA, oldX, etc. */
|
||||
void saveRegs();
|
||||
/* Save state of each debugger subsystem */
|
||||
void saveState();
|
||||
|
||||
/* return the TIADebugger, since the GUI needs it */
|
||||
/* The debugger subsystem responsible for all RAM state */
|
||||
RamDebug& ramDebug() { return *myRamDebug; }
|
||||
|
||||
/* The debugger subsystem responsible for all TIA state */
|
||||
TIADebug& tiaDebug() { return *myTIAdebug; }
|
||||
|
||||
/** Convenience methods to convert to hexidecimal values */
|
||||
|
@ -264,6 +270,7 @@ class Debugger : public DialogContainer
|
|||
PackedBitArray *readTraps;
|
||||
PackedBitArray *writeTraps;
|
||||
PromptWidget *myPrompt;
|
||||
RamDebug *myRamDebug;
|
||||
TIADebug *myTIAdebug;
|
||||
|
||||
uInt8 myOldRAM[128];
|
||||
|
@ -273,7 +280,6 @@ class Debugger : public DialogContainer
|
|||
int oldS;
|
||||
int oldP;
|
||||
int oldPC;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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: DebuggerParser.cxx,v 1.47 2005-07-03 08:15:31 urchlay Exp $
|
||||
// $Id: DebuggerParser.cxx,v 1.48 2005-07-07 15:18:57 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -1195,7 +1195,7 @@ void DebuggerParser::executeRom() {
|
|||
|
||||
// "run"
|
||||
void DebuggerParser::executeRun() {
|
||||
debugger->saveRegs();
|
||||
debugger->saveState();
|
||||
debugger->quit();
|
||||
commandResult = "exiting debugger";
|
||||
}
|
||||
|
@ -1233,7 +1233,6 @@ void DebuggerParser::executeSavesym() {
|
|||
|
||||
// "step"
|
||||
void DebuggerParser::executeStep() {
|
||||
debugger->saveRegs();
|
||||
int cycles = debugger->step();
|
||||
commandResult = "executed ";
|
||||
commandResult += debugger->valueToString(cycles);
|
||||
|
@ -1247,7 +1246,6 @@ void DebuggerParser::executeTia() {
|
|||
|
||||
// "trace"
|
||||
void DebuggerParser::executeTrace() {
|
||||
debugger->saveRegs();
|
||||
int cycles = debugger->trace();
|
||||
commandResult = "executed ";
|
||||
commandResult += debugger->valueToString(cycles);
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: DebuggerSystem.hxx,v 1.1 2005-07-07 15:18:58 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_SYSTEM_HXX
|
||||
#define DEBUGGER_SYSTEM_HXX
|
||||
|
||||
#include "Debugger.hxx"
|
||||
|
||||
/**
|
||||
The DebuggerState class is used as a base class for state in all
|
||||
DebuggerSystem objects. We make it a class so we can take advantage
|
||||
of the copy constructor.
|
||||
*/
|
||||
class DebuggerState
|
||||
{
|
||||
public:
|
||||
DebuggerState() { }
|
||||
~DebuggerState() { }
|
||||
};
|
||||
|
||||
/**
|
||||
The base class for all debugger objects. Its real purpose is to
|
||||
clean up the Debugger API, partitioning it into separate
|
||||
subsystems.
|
||||
*/
|
||||
class DebuggerSystem
|
||||
{
|
||||
public:
|
||||
DebuggerSystem(Debugger* dbg) { myDebugger = dbg; }
|
||||
virtual ~DebuggerSystem() { };
|
||||
|
||||
virtual DebuggerState& getState() = 0;
|
||||
virtual DebuggerState& getOldState() = 0;
|
||||
|
||||
virtual void saveOldState() = 0;
|
||||
|
||||
protected:
|
||||
Debugger* myDebugger;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,59 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: RamDebug.cxx,v 1.1 2005-07-07 15:18:58 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Array.hxx"
|
||||
#include "RamDebug.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RamDebug::RamDebug(Debugger* dbg)
|
||||
: DebuggerSystem(dbg)
|
||||
{
|
||||
saveOldState();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DebuggerState& RamDebug::getState()
|
||||
{
|
||||
myState.ram.clear();
|
||||
for(int i=0; i<0x80; i++)
|
||||
myState.ram.push_back(myDebugger->readRAM(i));
|
||||
|
||||
return myState;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RamDebug::saveOldState()
|
||||
{
|
||||
myOldState.ram.clear();
|
||||
for(int i=0; i<0x80; i++)
|
||||
myOldState.ram.push_back(myDebugger->readRAM(i));
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int RamDebug::read(int offset)
|
||||
{
|
||||
offset &= 0x7f; // there are only 128 bytes
|
||||
return myDebugger->mySystem->peek(offset + 0x80);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RamDebug::write(int offset, int value)
|
||||
{
|
||||
offset &= 0x7f; // there are only 128 bytes
|
||||
myDebugger->mySystem->poke(offset + 0x80, value);
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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: RamDebug.hxx,v 1.1 2005-07-07 15:18:58 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef RAM_DEBUG_HXX
|
||||
#define RAM_DEBUG_HXX
|
||||
|
||||
#include "Array.hxx"
|
||||
#include "DebuggerSystem.hxx"
|
||||
|
||||
class RamState : public DebuggerState
|
||||
{
|
||||
public:
|
||||
IntArray ram;
|
||||
};
|
||||
|
||||
class RamDebug : public DebuggerSystem
|
||||
{
|
||||
public:
|
||||
RamDebug(Debugger* dbg);
|
||||
|
||||
DebuggerState& getState();
|
||||
DebuggerState& getOldState() { return myOldState; }
|
||||
|
||||
void saveOldState();
|
||||
|
||||
int read(int offset);
|
||||
void write(int offset, int value);
|
||||
|
||||
private:
|
||||
RamState myState;
|
||||
RamState myOldState;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -5,6 +5,7 @@ MODULE_OBJS := \
|
|||
src/debugger/DebuggerParser.o \
|
||||
src/debugger/EquateList.o \
|
||||
src/debugger/PackedBitArray.o \
|
||||
src/debugger/RamDebug.o \
|
||||
src/debugger/TIADebug.o
|
||||
|
||||
MODULE_DIRS += \
|
||||
|
|
|
@ -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: CpuWidget.cxx,v 1.12 2005-07-06 19:09:26 stephena Exp $
|
||||
// $Id: CpuWidget.cxx,v 1.13 2005-07-07 15:19:01 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -222,8 +222,8 @@ void CpuWidget::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void CpuWidget::fillGrid()
|
||||
{
|
||||
AddrList alist;
|
||||
ValueList vlist;
|
||||
IntArray alist;
|
||||
IntArray vlist;
|
||||
BoolArray changed;
|
||||
|
||||
// We push the enumerated items as addresses, and deal with the real
|
||||
|
|
|
@ -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.12 2005-07-05 18:00:05 stephena Exp $
|
||||
// $Id: DataGridWidget.cxx,v 1.13 2005-07-07 15:19:04 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -65,9 +65,15 @@ DataGridWidget::~DataGridWidget()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DataGridWidget::setList(const AddrList& alist, const ValueList& vlist,
|
||||
void DataGridWidget::setList(const IntArray& alist, const IntArray& vlist,
|
||||
const BoolArray& changed)
|
||||
{
|
||||
/*
|
||||
cerr << "alist.size() = " << alist.size()
|
||||
<< ", vlist.size() = " << vlist.size()
|
||||
<< ", changed.size() = " << changed.size()
|
||||
<< ", _rows*_cols = " << _rows * _cols << endl << endl;
|
||||
*/
|
||||
int size = vlist.size(); // assume the alist is the same size
|
||||
assert(size == _rows * _cols);
|
||||
|
||||
|
|
|
@ -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.8 2005-07-06 15:09:15 stephena Exp $
|
||||
// $Id: DataGridWidget.hxx,v 1.9 2005-07-07 15:19:04 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -31,9 +31,6 @@
|
|||
#include "Array.hxx"
|
||||
#include "Rect.hxx"
|
||||
|
||||
typedef GUI::Array<int> AddrList;
|
||||
typedef GUI::Array<int> ValueList;
|
||||
|
||||
// Some special commands
|
||||
enum {
|
||||
kDGItemDoubleClickedCmd = 'DGdb',
|
||||
|
@ -58,7 +55,7 @@ class DataGridWidget : public EditableWidget, public CommandSender
|
|||
int colchars, int bits, BaseFormat format = kBASE_DEFAULT);
|
||||
virtual ~DataGridWidget();
|
||||
|
||||
void setList(const AddrList& alist, const ValueList& vlist,
|
||||
void setList(const IntArray& alist, const IntArray& vlist,
|
||||
const BoolArray& changed);
|
||||
void setSelectedValue(int value);
|
||||
|
||||
|
@ -101,8 +98,8 @@ class DataGridWidget : public EditableWidget, public CommandSender
|
|||
|
||||
BaseFormat _base;
|
||||
|
||||
AddrList _addrList;
|
||||
ValueList _valueList;
|
||||
IntArray _addrList;
|
||||
IntArray _valueList;
|
||||
StringList _addrStringList;
|
||||
StringList _valueStringList;
|
||||
BoolArray _changedList;
|
||||
|
|
|
@ -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: RamWidget.cxx,v 1.16 2005-07-06 19:09:26 stephena Exp $
|
||||
// $Id: RamWidget.cxx,v 1.17 2005-07-07 15:19:04 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -25,10 +25,10 @@
|
|||
#include "FrameBuffer.hxx"
|
||||
#include "GuiUtils.hxx"
|
||||
#include "GuiObject.hxx"
|
||||
#include "Debugger.hxx"
|
||||
#include "Widget.hxx"
|
||||
#include "EditTextWidget.hxx"
|
||||
#include "DataGridWidget.hxx"
|
||||
#include "RamDebug.hxx"
|
||||
|
||||
#include "RamWidget.hxx"
|
||||
|
||||
|
@ -42,7 +42,6 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
int lwidth = 30;
|
||||
const int vWidth = _w - kButtonWidth - 20, space = 6, buttonw = 24;
|
||||
const GUI::Font& font = instance()->consoleFont();
|
||||
_oldValueList = new ValueList;
|
||||
|
||||
// Create a 16x8 grid holding byte values (16 x 8 = 128 RAM bytes) with labels
|
||||
myRamGrid = new DataGridWidget(boss, xpos+lwidth + 5, ypos, 16, 8, 2, 8, kBASE_16);
|
||||
|
@ -143,7 +142,6 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RamWidget::~RamWidget()
|
||||
{
|
||||
delete _oldValueList;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -155,8 +153,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
int addr, value;
|
||||
const char* buf;
|
||||
|
||||
Debugger& dbg = instance()->debugger();
|
||||
|
||||
RamDebug& dbg = instance()->debugger().ramDebug();
|
||||
switch(cmd)
|
||||
{
|
||||
case kDGItemDataChangedCmd:
|
||||
|
@ -164,13 +161,13 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
value = myRamGrid->getSelectedValue();
|
||||
|
||||
myUndoAddress = addr;
|
||||
myUndoValue = dbg.readRAM(addr - kRamStart);
|
||||
myUndoValue = dbg.read(addr);
|
||||
|
||||
instance()->debugger().writeRAM(addr - kRamStart, value);
|
||||
dbg.write(addr, value);
|
||||
myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10));
|
||||
myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2));
|
||||
myRevertButton->setFlags(WIDGET_ENABLED);
|
||||
myUndoButton->setFlags(WIDGET_ENABLED);
|
||||
myRevertButton->setEnabled(true);
|
||||
myUndoButton->setEnabled(true);
|
||||
break;
|
||||
|
||||
case kDGSelectionChangedCmd:
|
||||
|
@ -187,12 +184,12 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
|||
|
||||
case kRevertCmd:
|
||||
for(unsigned int i = 0; i < kRamSize; i++)
|
||||
dbg.writeRAM(i, (*_oldValueList)[i]);
|
||||
dbg.write(i, _oldValueList[i]);
|
||||
fillGrid(true);
|
||||
break;
|
||||
|
||||
case kUndoCmd:
|
||||
dbg.writeRAM(myUndoAddress - kRamStart, myUndoValue);
|
||||
dbg.write(myUndoAddress, myUndoValue);
|
||||
myUndoButton->setEnabled(false);
|
||||
fillGrid(false);
|
||||
break;
|
||||
|
@ -212,19 +209,24 @@ void RamWidget::loadConfig()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void RamWidget::fillGrid(bool updateOld)
|
||||
{
|
||||
AddrList alist;
|
||||
ValueList vlist;
|
||||
IntArray alist;
|
||||
IntArray vlist;
|
||||
BoolArray changed;
|
||||
|
||||
if(updateOld) _oldValueList->clear();
|
||||
if(updateOld) _oldValueList.clear();
|
||||
|
||||
Debugger& dbg = instance()->debugger();
|
||||
for(unsigned int i = 0; i < kRamSize; i++)
|
||||
RamDebug& dbg = instance()->debugger().ramDebug();
|
||||
|
||||
RamState state = (RamState&) dbg.getState();
|
||||
RamState oldstate = (RamState&) dbg.getOldState();
|
||||
|
||||
vlist = state.ram;
|
||||
if(updateOld) _oldValueList = state.ram;
|
||||
|
||||
for(unsigned int i = 0; i < 16*8; i++)
|
||||
{
|
||||
alist.push_back(kRamStart + i);
|
||||
vlist.push_back(dbg.readRAM(i));
|
||||
if(updateOld) _oldValueList->push_back(dbg.readRAM(i));
|
||||
changed.push_back(dbg.ramChanged(i));
|
||||
alist.push_back(i);
|
||||
changed.push_back(state.ram[i] != oldstate.ram[i]);
|
||||
}
|
||||
|
||||
myRamGrid->setList(alist, vlist, changed);
|
||||
|
|
|
@ -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: RamWidget.hxx,v 1.7 2005-07-05 18:00:05 stephena Exp $
|
||||
// $Id: RamWidget.hxx,v 1.8 2005-07-07 15:19:04 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -65,7 +65,7 @@ class RamWidget : public Widget, public CommandSender
|
|||
ButtonWidget *myRevertButton;
|
||||
ButtonWidget *myUndoButton;
|
||||
|
||||
ValueList *_oldValueList;
|
||||
IntArray _oldValueList;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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.cxx,v 1.4 2005-07-06 19:09:26 stephena Exp $
|
||||
// $Id: TiaWidget.cxx,v 1.5 2005-07-07 15:19:04 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -239,8 +239,8 @@ void TiaWidget::fillGrid()
|
|||
{
|
||||
// FIXME - have these widget get correct values from TIADebug
|
||||
Debugger& dbg = instance()->debugger();
|
||||
AddrList alist;
|
||||
ValueList vlist;
|
||||
IntArray alist;
|
||||
IntArray vlist;
|
||||
BoolArray changed;
|
||||
|
||||
// TIA RAM
|
||||
|
|
Loading…
Reference in New Issue