mirror of https://github.com/stella-emu/stella.git
First pass at the debugger dialog box. Right now, it contains 6 tabs:
Prompt: will have a command prompt with history CPU: contents of CPU registers RAM: contents of RAM ROM: contents of ROM TIA: contents of TIA registers Code: code listing/disassembly (still have to figure this one out) Still TODO is work out the overall functionality of the debugger. Inspecting or changing registers is easy. The hard part is adding features that developers will actually use. Also TODO is figure out what will go in the upper-right corner; maybe buttons to pause, step, etc. Finally, do we really need separate tabs at all? I can add full functionality of a debugger through the prompt commandline with a parser ... ?? git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@463 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
39fe5c8c04
commit
0e0b225122
|
@ -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: makefile,v 1.85 2005-05-27 18:00:46 stephena Exp $
|
||||
## $Id: makefile,v 1.86 2005-06-03 17:52:04 stephena Exp $
|
||||
##============================================================================
|
||||
|
||||
##============================================================================
|
||||
|
@ -159,7 +159,7 @@ GUI_OBJS = StellaFont.o Menu.o Launcher.o Debugger.o \
|
|||
Dialog.o DialogContainer.o OptionsDialog.o VideoDialog.o AudioDialog.o \
|
||||
EventMappingDialog.o GameInfoDialog.o HelpDialog.o AboutDialog.o \
|
||||
LauncherDialog.o LauncherOptionsDialog.o BrowserDialog.o GameList.o \
|
||||
ProgressDialog.o
|
||||
ProgressDialog.o DebuggerDialog.o
|
||||
|
||||
CORE_OBJS = Booster.o Cart.o Cart2K.o Cart3F.o Cart4K.o CartAR.o CartDPC.o \
|
||||
CartE0.o CartE7.o CartF4.o CartF4SC.o CartF6.o CartF6SC.o \
|
||||
|
@ -447,3 +447,6 @@ GameList.o: $(GUI)/GameList.cxx $(GUI)/GameList.hxx
|
|||
|
||||
ProgressDialog.o: $(GUI)/ProgressDialog.cxx $(GUI)/ProgressDialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/ProgressDialog.cxx
|
||||
|
||||
DebuggerDialog.o: $(GUI)/DebuggerDialog.cxx $(GUI)/DebuggerDialog.hxx
|
||||
$(CXX) -c $(FLAGS) $(OPTIONS) $(LDFLAGS) $(GUI)/DebuggerDialog.cxx
|
||||
|
|
|
@ -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: FrameBufferGL.cxx,v 1.26 2005-05-30 16:25:46 stephena Exp $
|
||||
// $Id: FrameBufferGL.cxx,v 1.27 2005-06-03 17:52:04 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <SDL.h>
|
||||
|
@ -504,7 +504,6 @@ void FrameBufferGL::setDimensions(GLdouble* orthoWidth, GLdouble* orthoHeight)
|
|||
scaleX = float(myImageDim.w) / myScreenDim.w;
|
||||
scaleY = float(myImageDim.h) / myScreenDim.h;
|
||||
|
||||
cerr << "scaleX = " << scaleX << ", scaleY = " << scaleY << endl;
|
||||
if(scaleX > scaleY)
|
||||
myFSScaleFactor = float(myScreenDim.w) / myImageDim.w;
|
||||
else
|
||||
|
|
|
@ -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: Console.cxx,v 1.54 2005-05-27 18:00:47 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.55 2005-06-03 17:52:04 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <assert.h>
|
||||
|
@ -190,8 +190,8 @@ Console::Console(const uInt8* image, uInt32 size, OSystem* osystem)
|
|||
myOSystem->menu().setGameProfile(myProperties);
|
||||
|
||||
// Finally, initialize the debugging system, since it depends on the current ROM
|
||||
myOSystem->debugger().setConsole(this);
|
||||
myOSystem->debugger().initialize();
|
||||
// myOSystem->menu().setGameProfile(myProperties);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -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: EventHandler.cxx,v 1.68 2005-06-02 21:37:33 stephena Exp $
|
||||
// $Id: EventHandler.cxx,v 1.69 2005-06-03 17:52:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -1327,7 +1327,6 @@ void EventHandler::leaveMenuMode()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::enterDebugMode()
|
||||
{
|
||||
cerr << "S_DEBUGGER entered\n";
|
||||
myState = S_DEBUGGER;
|
||||
myOSystem->createFrameBuffer();
|
||||
myOSystem->debugger().reStack();
|
||||
|
@ -1337,13 +1336,11 @@ cerr << "S_DEBUGGER entered\n";
|
|||
|
||||
if(!myPauseFlag) // Pause when entering debugger mode
|
||||
handleEvent(Event::Pause, 1);
|
||||
cerr << "S_DEBUGGER entered done\n";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void EventHandler::leaveDebugMode()
|
||||
{
|
||||
cerr << "S_DEBUGGER left\n";
|
||||
myState = S_EMULATE;
|
||||
myOSystem->createFrameBuffer();
|
||||
myOSystem->frameBuffer().refresh();
|
||||
|
|
|
@ -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: M6502.cxx,v 1.2 2001-12-29 17:55:59 bwmott Exp $
|
||||
// $Id: M6502.cxx,v 1.3 2005-06-03 17:52:05 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "M6502.hxx"
|
||||
|
@ -332,4 +332,3 @@ const char* M6502::ourInstructionMnemonicTable[256] = {
|
|||
"BEQ", "SBC", "n/a", "isb", "nop", "SBC", "INC", "isb", // 0xF?
|
||||
"SED", "SBC", "nop", "isb", "nop", "SBC", "INC", "isb"
|
||||
};
|
||||
|
||||
|
|
|
@ -13,19 +13,20 @@
|
|||
// 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.1 2005-05-27 18:00:49 stephena Exp $
|
||||
// $Id: Debugger.cxx,v 1.2 2005-06-03 17:52:06 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Version.hxx"
|
||||
#include "OSystem.hxx"
|
||||
#include "FrameBuffer.hxx"
|
||||
#include "VideoDialog.hxx"
|
||||
#include "DebuggerDialog.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "Debugger.hxx"
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Debugger::Debugger(OSystem* osystem)
|
||||
: DialogContainer(osystem)
|
||||
: DialogContainer(osystem),
|
||||
myConsole(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -37,11 +38,13 @@ Debugger::~Debugger()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::initialize()
|
||||
{
|
||||
// We only create one instance of this dialog, since each time we do so,
|
||||
// the ROM listing is read from disk. This can be very expensive.
|
||||
if(myBaseDialog == NULL)
|
||||
myBaseDialog = new VideoDialog(myOSystem, this,
|
||||
0, 0, kDebuggerWidth, kDebuggerHeight);
|
||||
int x = 0,
|
||||
y = myConsole->mediaSource().height(),
|
||||
w = kDebuggerWidth,
|
||||
h = kDebuggerHeight - y;
|
||||
|
||||
delete myBaseDialog;
|
||||
myBaseDialog = new DebuggerDialog(myOSystem, this, x, y, w, h);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -13,26 +13,27 @@
|
|||
// 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.1 2005-05-27 18:00:49 stephena Exp $
|
||||
// $Id: Debugger.hxx,v 1.2 2005-06-03 17:52:06 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
#define DEBUGGER_HXX
|
||||
|
||||
class OSystem;
|
||||
class Console;
|
||||
|
||||
#include "DialogContainer.hxx"
|
||||
|
||||
enum {
|
||||
kDebuggerWidth = 510,
|
||||
kDebuggerHeight = 382
|
||||
kDebuggerWidth = 511,
|
||||
kDebuggerHeight = 383
|
||||
};
|
||||
|
||||
/**
|
||||
The base dialog for the ROM launcher in Stella.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.1 2005-05-27 18:00:49 stephena Exp $
|
||||
@version $Id: Debugger.hxx,v 1.2 2005-06-03 17:52:06 stephena Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -57,6 +58,11 @@ class Debugger : public DialogContainer
|
|||
Initialize the video subsystem wrt this class.
|
||||
*/
|
||||
void initializeVideo();
|
||||
|
||||
void setConsole(Console* console) { myConsole = console; }
|
||||
|
||||
private:
|
||||
Console* myConsole;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,191 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// 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.1 2005-06-03 17:52:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#include "DialogContainer.hxx"
|
||||
#include "BrowserDialog.hxx"
|
||||
#include "PopUpWidget.hxx"
|
||||
#include "TabWidget.hxx"
|
||||
#include "FSNode.hxx"
|
||||
#include "bspf.hxx"
|
||||
#include "DebuggerDialog.hxx"
|
||||
|
||||
enum {
|
||||
kChooseRomDirCmd = 'roms', // rom select
|
||||
kChooseSnapDirCmd = 'snps', // snap select
|
||||
kRomDirChosenCmd = 'romc', // rom chosen
|
||||
kSnapDirChosenCmd = 'snpc' // snap chosen
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DebuggerDialog::DebuggerDialog(
|
||||
OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h)
|
||||
: Dialog(osystem, parent, x, y, w, h)
|
||||
{
|
||||
const int vBorder = 4;
|
||||
int yoffset;
|
||||
|
||||
// The tab widget
|
||||
TabWidget* tab = new TabWidget(this, 0, vBorder, _w, _h);
|
||||
|
||||
// 1) The command prompt
|
||||
tab->addTab("Prompt");
|
||||
yoffset = vBorder;
|
||||
|
||||
// FIXME - add scrollable console/edittext window
|
||||
|
||||
// 2) The CPU contents
|
||||
tab->addTab(" CPU ");
|
||||
yoffset = vBorder;
|
||||
|
||||
// FIXME - add CPU registers
|
||||
|
||||
// 3) The RAM contents
|
||||
tab->addTab(" RAM ");
|
||||
yoffset = vBorder;
|
||||
|
||||
// FIXME - add 16x8 list of RAM contents
|
||||
/*
|
||||
// Snapshot path
|
||||
new ButtonWidget(tab, 15, yoffset, kButtonWidth + 14, 16, "Path", kChooseSnapDirCmd, 0);
|
||||
mySnapPath = new StaticTextWidget(tab, 5 + kButtonWidth + 30,
|
||||
yoffset + 3, _w - (5 + kButtonWidth + 20) - 10,
|
||||
kLineHeight, "", kTextAlignLeft);
|
||||
yoffset += 22;
|
||||
|
||||
// Snapshot save name
|
||||
mySnapTypePopup = new PopUpWidget(tab, 10, yoffset, 140, kLineHeight,
|
||||
"Save snapshot as: ", 87, 0);
|
||||
mySnapTypePopup->appendEntry("romname", 1);
|
||||
mySnapTypePopup->appendEntry("md5sum", 2);
|
||||
yoffset += 18;
|
||||
|
||||
// Snapshot single or multiple saves
|
||||
mySnapSingleCheckbox = new CheckboxWidget(tab, 30, yoffset, 80, kLineHeight,
|
||||
"Multiple snapshots");
|
||||
*/
|
||||
|
||||
// 4) The ROM contents
|
||||
tab->addTab(" ROM ");
|
||||
yoffset = vBorder;
|
||||
|
||||
// FIXME - add ROM contents, somehow taking into account which bank is being
|
||||
// viewed (maybe a button to switch banks??
|
||||
|
||||
// 5) The TIA contents
|
||||
tab->addTab(" TIA ");
|
||||
yoffset = vBorder;
|
||||
|
||||
// FIXME - TIA registers
|
||||
|
||||
// 6) The code listing
|
||||
tab->addTab(" Code");
|
||||
yoffset = vBorder;
|
||||
|
||||
// FIXME - Add code listing in assembly language
|
||||
|
||||
// Activate the first tab
|
||||
tab->setActiveTab(0);
|
||||
|
||||
/*
|
||||
// Create file browser dialog
|
||||
int baseW = instance()->frameBuffer().baseWidth();
|
||||
int baseH = instance()->frameBuffer().baseHeight();
|
||||
myBrowser = new BrowserDialog(this, 60, 20, baseW - 120, baseH - 40);
|
||||
*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
DebuggerDialog::~DebuggerDialog()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::loadConfig()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::saveConfig()
|
||||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::openRomBrowser()
|
||||
{
|
||||
/*
|
||||
myBrowser->setTitle("Select ROM directory:");
|
||||
myBrowser->setEmitSignal(kRomDirChosenCmd);
|
||||
myBrowser->setStartPath(myRomPath->getLabel());
|
||||
|
||||
parent()->addDialog(myBrowser);
|
||||
*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::openSnapBrowser()
|
||||
{
|
||||
/*
|
||||
myBrowser->setTitle("Select snapshot directory:");
|
||||
myBrowser->setEmitSignal(kSnapDirChosenCmd);
|
||||
myBrowser->setStartPath(mySnapPath->getLabel());
|
||||
|
||||
parent()->addDialog(myBrowser);
|
||||
*/
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
switch (cmd)
|
||||
{
|
||||
case kOKCmd:
|
||||
saveConfig();
|
||||
close();
|
||||
break;
|
||||
|
||||
case kChooseRomDirCmd:
|
||||
openRomBrowser();
|
||||
break;
|
||||
|
||||
case kChooseSnapDirCmd:
|
||||
openSnapBrowser();
|
||||
break;
|
||||
|
||||
case kRomDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
myRomPath->setLabel(dir.path());
|
||||
break;
|
||||
}
|
||||
|
||||
case kSnapDirChosenCmd:
|
||||
{
|
||||
FilesystemNode dir(myBrowser->getResult());
|
||||
mySnapPath->setLabel(dir.path());
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Dialog::handleCommand(sender, cmd, data);
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
//============================================================================
|
||||
//
|
||||
// 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
|
||||
//
|
||||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: DebuggerDialog.hxx,v 1.1 2005-06-03 17:52:06 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_DIALOG_HXX
|
||||
#define DEBUGGER_DIALOG_HXX
|
||||
|
||||
class OSystem;
|
||||
class DialogContainer;
|
||||
class BrowserDialog;
|
||||
class CheckboxWidget;
|
||||
class PopUpWidget;
|
||||
class StaticTextWidget;
|
||||
|
||||
#include "Dialog.hxx"
|
||||
|
||||
class DebuggerDialog : public Dialog
|
||||
{
|
||||
public:
|
||||
DebuggerDialog(OSystem* osystem, DialogContainer* parent,
|
||||
int x, int y, int w, int h);
|
||||
~DebuggerDialog();
|
||||
|
||||
virtual void loadConfig();
|
||||
virtual void saveConfig();
|
||||
|
||||
virtual void handleCommand(CommandSender* sender, int cmd, int data);
|
||||
|
||||
protected:
|
||||
BrowserDialog* myBrowser;
|
||||
|
||||
// Rom path controls
|
||||
StaticTextWidget* myRomPath;
|
||||
|
||||
// Snapshot controls
|
||||
StaticTextWidget* mySnapPath;
|
||||
PopUpWidget* mySnapTypePopup;
|
||||
CheckboxWidget* mySnapSingleCheckbox;
|
||||
|
||||
private:
|
||||
void openRomBrowser();
|
||||
void openSnapBrowser();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue