mirror of https://github.com/stella-emu/stella.git
Added 'Frame Advance' and 'Exit' buttons to the DebuggerDialog. Advancing
the frame by 1 can be very useful, in that you can change a memory location, do a frame advance, and then see any results graphically. Eventually the trace and step will work the same way, and show changes to the scanline as it's being drawn. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@518 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
07ea0bbae1
commit
f58a258b94
|
@ -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.10 2005-06-17 14:42:49 stephena Exp $
|
||||
// $Id: Debugger.hxx,v 1.11 2005-06-17 17:34:01 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
|
@ -49,7 +49,7 @@ enum {
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.10 2005-06-17 14:42:49 stephena Exp $
|
||||
@version $Id: Debugger.hxx,v 1.11 2005-06-17 17:34:01 stephena Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -83,6 +83,12 @@ class Debugger : public DialogContainer
|
|||
void setConsole(Console* console);
|
||||
|
||||
/** Convenience methods to convert to hexidecimal values */
|
||||
static char *to_hex_4(int i)
|
||||
{
|
||||
static char out[2];
|
||||
sprintf(out, "%1x", i);
|
||||
return out;
|
||||
}
|
||||
static char *to_hex_8(int i)
|
||||
{
|
||||
static char out[3];
|
||||
|
|
|
@ -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: FrameBuffer.cxx,v 1.45 2005-06-16 01:11:27 stephena Exp $
|
||||
// $Id: FrameBuffer.cxx,v 1.46 2005-06-17 17:34:01 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -38,6 +38,7 @@
|
|||
FrameBuffer::FrameBuffer(OSystem* osystem)
|
||||
: myOSystem(osystem),
|
||||
theRedrawEntireFrameIndicator(true),
|
||||
theFrameAdvanceIndicator(false),
|
||||
theZoomLevel(2),
|
||||
theMaxZoomLevel(2),
|
||||
theAspectRatio(1.0),
|
||||
|
@ -242,9 +243,14 @@ void FrameBuffer::update()
|
|||
}
|
||||
|
||||
case EventHandler::S_DEBUGGER:
|
||||
// Draw changes to the mediasource
|
||||
if(!myPauseStatus)
|
||||
// Get one frames' worth of data
|
||||
if(theFrameAdvanceIndicator)
|
||||
{
|
||||
myOSystem->console().mediaSource().update();
|
||||
theRedrawEntireFrameIndicator = true; // do the next section of code
|
||||
theOverlayChangedIndicator = true; // do this just to be sure
|
||||
theFrameAdvanceIndicator = false;
|
||||
}
|
||||
|
||||
// Only update the screen if it's been invalidated
|
||||
if(theRedrawEntireFrameIndicator)
|
||||
|
|
|
@ -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: FrameBuffer.hxx,v 1.40 2005-06-16 01:11:27 stephena Exp $
|
||||
// $Id: FrameBuffer.hxx,v 1.41 2005-06-17 17:34:01 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef FRAMEBUFFER_HXX
|
||||
|
@ -46,7 +46,7 @@ enum TextAlignment {
|
|||
All GUI elements (ala ScummVM) are drawn here as well.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: FrameBuffer.hxx,v 1.40 2005-06-16 01:11:27 stephena Exp $
|
||||
@version $Id: FrameBuffer.hxx,v 1.41 2005-06-17 17:34:01 stephena Exp $
|
||||
*/
|
||||
class FrameBuffer
|
||||
{
|
||||
|
@ -140,6 +140,11 @@ class FrameBuffer
|
|||
if(now) { myMessageTime = 0; update(); }
|
||||
}
|
||||
|
||||
/**
|
||||
Indicates that the emulation should advance one frame.
|
||||
*/
|
||||
void advance() { theFrameAdvanceIndicator = true; }
|
||||
|
||||
/**
|
||||
Toggles between fullscreen and window mode.
|
||||
Grabmouse activated when in fullscreen mode.
|
||||
|
@ -409,6 +414,9 @@ class FrameBuffer
|
|||
// Indicates if the entire frame should be redrawn
|
||||
bool theRedrawEntireFrameIndicator;
|
||||
|
||||
// Indicates if the emulation should advance by one frame
|
||||
bool theFrameAdvanceIndicator;
|
||||
|
||||
// The SDL video buffer
|
||||
SDL_Surface* myScreen;
|
||||
|
||||
|
|
|
@ -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: ByteGridWidget.cxx,v 1.3 2005-06-17 14:42:49 stephena Exp $
|
||||
// $Id: ByteGridWidget.cxx,v 1.4 2005-06-17 17:34:01 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -29,10 +29,6 @@
|
|||
#include "FrameBuffer.hxx"
|
||||
#include "ByteGridWidget.hxx"
|
||||
|
||||
enum {
|
||||
kColWidth = 2 * 6 + 8
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
ByteGridWidget::ByteGridWidget(GuiObject* boss, int x, int y, int cols, int rows)
|
||||
: EditableWidget(boss, x, y, kColWidth*cols + 1, kLineHeight*rows + 1),
|
||||
|
|
|
@ -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: ByteGridWidget.hxx,v 1.3 2005-06-17 14:42:49 stephena Exp $
|
||||
// $Id: ByteGridWidget.hxx,v 1.4 2005-06-17 17:34:01 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -33,6 +33,10 @@
|
|||
typedef GUI::Array<int> ByteAddrList;
|
||||
typedef GUI::Array<int> ByteValueList;
|
||||
|
||||
enum {
|
||||
kColWidth = 2 * 6 + 8
|
||||
};
|
||||
|
||||
// Some special commands
|
||||
enum {
|
||||
kBGItemDoubleClickedCmd = 'BGdb',
|
||||
|
|
|
@ -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: CheatWidget.cxx,v 1.8 2005-06-16 18:40:17 stephena Exp $
|
||||
// $Id: CheatWidget.cxx,v 1.9 2005-06-17 17:34:01 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -84,7 +84,7 @@ CheatWidget::CheatWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
|
||||
// Add the list showing the results of a search/compare
|
||||
xpos = 200; ypos = border/2;
|
||||
new StaticTextWidget(boss, xpos + 10, ypos, 70, kLineHeight,
|
||||
new StaticTextWidget(boss, xpos + 5, ypos, 75, kLineHeight,
|
||||
"Address Value", kTextAlignLeft);
|
||||
ypos += kLineHeight;
|
||||
|
||||
|
|
|
@ -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.13 2005-06-17 14:42:49 stephena Exp $
|
||||
// $Id: DebuggerDialog.cxx,v 1.14 2005-06-17 17:34:01 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -32,7 +32,9 @@
|
|||
|
||||
enum {
|
||||
kDDStepCmd = 'DDst',
|
||||
kDDTraceCmd = 'DDtr'
|
||||
kDDTraceCmd = 'DDtr',
|
||||
kDDAdvCmd = 'DDav',
|
||||
kDDExitCmd = 'DDex'
|
||||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -83,6 +85,10 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent,
|
|||
addButton(vWidth + 10, yoff, "Step", kDDStepCmd, 0);
|
||||
yoff += 22;
|
||||
addButton(vWidth + 10, yoff, "Trace", kDDTraceCmd, 0);
|
||||
yoff += 22;
|
||||
addButton(vWidth + 10, yoff, "Frame +1", kDDAdvCmd, 0);
|
||||
|
||||
addButton(vWidth + 10, _h - 22 - 10, "Exit", kDDExitCmd, 0);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -105,16 +111,27 @@ void DebuggerDialog::handleKeyDown(int ascii, int keycode, int modifiers)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::handleCommand(CommandSender* sender, int cmd, int data)
|
||||
{
|
||||
// We reload the tabs in the cases where the actions could possibly
|
||||
// change their contents
|
||||
switch(cmd)
|
||||
{
|
||||
case kDDStepCmd:
|
||||
instance()->debugger().step();
|
||||
myTab->loadConfig(); // make sure all the tabs are updated
|
||||
myTab->loadConfig();
|
||||
break;
|
||||
|
||||
case kDDTraceCmd:
|
||||
instance()->debugger().trace();
|
||||
myTab->loadConfig(); // make sure all the tabs are updated
|
||||
myTab->loadConfig();
|
||||
break;
|
||||
|
||||
case kDDAdvCmd:
|
||||
instance()->frameBuffer().advance();
|
||||
myTab->loadConfig();
|
||||
break;
|
||||
|
||||
case kDDExitCmd:
|
||||
instance()->debugger().quit();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -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: EditNumWidget.cxx,v 1.2 2005-06-16 00:55:59 stephena Exp $
|
||||
// $Id: EditNumWidget.cxx,v 1.3 2005-06-17 17:34:01 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -99,7 +99,7 @@ void EditNumWidget::drawWidget(bool hilite)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
GUI::Rect EditNumWidget::getEditRect() const
|
||||
{
|
||||
GUI::Rect r(2, 1, _w - 2, _h);
|
||||
GUI::Rect r(2, 0, _w - 2, _h - 1);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.3 2005-06-17 14:42:49 stephena Exp $
|
||||
// $Id: RamWidget.cxx,v 1.4 2005-06-17 17:34:01 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -31,14 +31,6 @@
|
|||
|
||||
#include "RamWidget.hxx"
|
||||
|
||||
/*
|
||||
enum {
|
||||
kSearchCmd = 'CSEA',
|
||||
kCmpCmd = 'CCMP',
|
||||
kRestartCmd = 'CRST'
|
||||
};
|
||||
*/
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
|
||||
: Widget(boss, x, y, w, h),
|
||||
|
@ -49,11 +41,20 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
int lwidth = 30;
|
||||
|
||||
// Create a 16x8 grid (16 x 8 = 128 RAM bytes) with labels
|
||||
for(int col = 0; col < 8; ++col)
|
||||
for(int row = 0; row < 8; ++row)
|
||||
{
|
||||
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos + col*kLineHeight + 2,
|
||||
StaticTextWidget* t = new StaticTextWidget(boss, xpos, ypos + row*kLineHeight + 2,
|
||||
lwidth, kLineHeight,
|
||||
Debugger::to_hex_16(col*16 + kRamStart) + string(":"),
|
||||
Debugger::to_hex_16(row*16 + kRamStart) + string(":"),
|
||||
kTextAlignLeft);
|
||||
t->setFont(instance()->consoleFont());
|
||||
}
|
||||
for(int col = 0; col < 16; ++col)
|
||||
{
|
||||
StaticTextWidget* t = new StaticTextWidget(boss, xpos + col*kColWidth + lwidth + 12,
|
||||
ypos - kLineHeight,
|
||||
lwidth, kLineHeight,
|
||||
Debugger::to_hex_4(col),
|
||||
kTextAlignLeft);
|
||||
t->setFont(instance()->consoleFont());
|
||||
}
|
||||
|
@ -61,61 +62,6 @@ RamWidget::RamWidget(GuiObject* boss, int x, int y, int w, int h)
|
|||
myRamGrid = new ByteGridWidget(boss, xpos+lwidth + 5, ypos, 16, 8);
|
||||
myRamGrid->setTarget(this);
|
||||
myActiveWidget = myRamGrid;
|
||||
|
||||
#if 0
|
||||
const int border = 20;
|
||||
const int bwidth = 50;
|
||||
const int charWidth = instance()->consoleFont().getMaxCharWidth();
|
||||
const int charHeight = instance()->consoleFont().getFontHeight() + 2;
|
||||
int xpos = x + border;
|
||||
int ypos = y + border;
|
||||
|
||||
// Add the numedit label and box
|
||||
new StaticTextWidget(boss, xpos, ypos, 70, kLineHeight,
|
||||
"Enter a value:", kTextAlignLeft);
|
||||
|
||||
myEditBox = new EditNumWidget(boss, 90, ypos - 2, charWidth*10, charHeight, "");
|
||||
myEditBox->setFont(instance()->consoleFont());
|
||||
// myEditBox->setTarget(this);
|
||||
myActiveWidget = myEditBox;
|
||||
ypos += border;
|
||||
|
||||
// Add the result text string area
|
||||
myResult = new StaticTextWidget(boss, border + 5, ypos, 175, kLineHeight,
|
||||
"", kTextAlignLeft);
|
||||
myResult->setColor(kTextColorEm);
|
||||
|
||||
// Add the three search-related buttons
|
||||
xpos = x + border;
|
||||
ypos += border * 2;
|
||||
mySearchButton = new ButtonWidget(boss, xpos, ypos, bwidth, 16,
|
||||
"Search", kSearchCmd, 0);
|
||||
mySearchButton->setTarget(this);
|
||||
xpos += 8 + bwidth;
|
||||
|
||||
myCompareButton = new ButtonWidget(boss, xpos, ypos, bwidth, 16,
|
||||
"Compare", kCmpCmd, 0);
|
||||
myCompareButton->setTarget(this);
|
||||
xpos += 8 + bwidth;
|
||||
|
||||
myRestartButton = new ButtonWidget(boss, xpos, ypos, bwidth, 16,
|
||||
"Restart", kRestartCmd, 0);
|
||||
myRestartButton->setTarget(this);
|
||||
|
||||
// Add the list showing the results of a search/compare
|
||||
xpos = 200; ypos = border/2;
|
||||
new StaticTextWidget(boss, xpos + 10, ypos, 70, kLineHeight,
|
||||
"Address Value", kTextAlignLeft);
|
||||
ypos += kLineHeight;
|
||||
|
||||
myResultsList = new AddrValueWidget(boss, xpos, ypos, 100, 75);
|
||||
myResultsList->setNumberingMode(kHexNumbering);
|
||||
myResultsList->setFont(instance()->consoleFont());
|
||||
myResultsList->setTarget(this);
|
||||
|
||||
// Start in a known state
|
||||
doRestart();
|
||||
#endif
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue