diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index 669c73bf8..f331dbbbf 100644 --- a/stella/src/debugger/Debugger.hxx +++ b/stella/src/debugger/Debugger.hxx @@ -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]; diff --git a/stella/src/emucore/FrameBuffer.cxx b/stella/src/emucore/FrameBuffer.cxx index bf7f1f8c4..db401cf12 100644 --- a/stella/src/emucore/FrameBuffer.cxx +++ b/stella/src/emucore/FrameBuffer.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: 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 @@ -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) diff --git a/stella/src/emucore/FrameBuffer.hxx b/stella/src/emucore/FrameBuffer.hxx index dc23dedee..dd00f5c86 100644 --- a/stella/src/emucore/FrameBuffer.hxx +++ b/stella/src/emucore/FrameBuffer.hxx @@ -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; diff --git a/stella/src/gui/ByteGridWidget.cxx b/stella/src/gui/ByteGridWidget.cxx index 7d6a419b5..af022c1c2 100644 --- a/stella/src/gui/ByteGridWidget.cxx +++ b/stella/src/gui/ByteGridWidget.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: 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), diff --git a/stella/src/gui/ByteGridWidget.hxx b/stella/src/gui/ByteGridWidget.hxx index a33d2720e..b38406c3c 100644 --- a/stella/src/gui/ByteGridWidget.hxx +++ b/stella/src/gui/ByteGridWidget.hxx @@ -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 ByteAddrList; typedef GUI::Array ByteValueList; +enum { + kColWidth = 2 * 6 + 8 +}; + // Some special commands enum { kBGItemDoubleClickedCmd = 'BGdb', diff --git a/stella/src/gui/CheatWidget.cxx b/stella/src/gui/CheatWidget.cxx index de9b36a68..a7e0ee885 100644 --- a/stella/src/gui/CheatWidget.cxx +++ b/stella/src/gui/CheatWidget.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: 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,8 +84,8 @@ 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, - "Address Value", kTextAlignLeft); + new StaticTextWidget(boss, xpos + 5, ypos, 75, kLineHeight, + "Address Value", kTextAlignLeft); ypos += kLineHeight; myResultsList = new AddrValueWidget(boss, xpos, ypos, 100, 75); diff --git a/stella/src/gui/DebuggerDialog.cxx b/stella/src/gui/DebuggerDialog.cxx index 0b769a18a..6afff68c8 100644 --- a/stella/src/gui/DebuggerDialog.cxx +++ b/stella/src/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: 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: diff --git a/stella/src/gui/EditNumWidget.cxx b/stella/src/gui/EditNumWidget.cxx index 76fd17342..2797e17e2 100644 --- a/stella/src/gui/EditNumWidget.cxx +++ b/stella/src/gui/EditNumWidget.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: 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; } diff --git a/stella/src/gui/RamWidget.cxx b/stella/src/gui/RamWidget.cxx index 1704c52f5..eb090bc66 100644 --- a/stella/src/gui/RamWidget.cxx +++ b/stella/src/gui/RamWidget.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: 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 } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -