diff --git a/stella/src/debugger/Debugger.cxx b/stella/src/debugger/Debugger.cxx index 9bad4a49f..94efcf7c6 100644 --- a/stella/src/debugger/Debugger.cxx +++ b/stella/src/debugger/Debugger.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: Debugger.cxx,v 1.85 2005-08-22 18:17:10 stephena Exp $ +// $Id: Debugger.cxx,v 1.86 2005-08-24 13:18:02 stephena Exp $ //============================================================================ #include "bspf.hxx" @@ -778,6 +778,38 @@ const string& Debugger::disassemble(int start, int lines) { return result; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Debugger::disassemble(StringList& list, int start, int lines) +{ + char buf[255], bbuf[255]; + string result; + + do { + result = ""; + + const char *label = equateList->getFormatted(start, 4); + + result += label; + result += ": "; + + int count = myCpuDebug->disassemble(start, buf, equateList); + + for(int i=0; i 0); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Debugger::nextScanline(int lines) { saveOldState(); diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index a8c33c66d..12fb947fe 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.69 2005-08-22 18:17:10 stephena Exp $ +// $Id: Debugger.hxx,v 1.70 2005-08-24 13:18:02 stephena Exp $ //============================================================================ #ifndef DEBUGGER_HXX @@ -76,7 +76,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)(); for all debugging operations in Stella (parser, 6502 debugger, etc). @author Stephen Anthony - @version $Id: Debugger.hxx,v 1.69 2005-08-22 18:17:10 stephena Exp $ + @version $Id: Debugger.hxx,v 1.70 2005-08-24 13:18:02 stephena Exp $ */ class Debugger : public DialogContainer { @@ -183,6 +183,12 @@ class Debugger : public DialogContainer */ const string& disassemble(int start, int lines); + /** + Disassemble from the starting address the specified number of lines + and place result in given stringlist. + */ + void disassemble(StringList& list, int start, int lines); + int step(); int trace(); void nextScanline(int lines); diff --git a/stella/src/debugger/RomWidget.cxx b/stella/src/debugger/RomWidget.cxx index 22c1062a5..b2e855ad0 100644 --- a/stella/src/debugger/RomWidget.cxx +++ b/stella/src/debugger/RomWidget.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: RomWidget.cxx,v 1.3 2005-08-23 18:32:51 stephena Exp $ +// $Id: RomWidget.cxx,v 1.4 2005-08-24 13:18:02 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -21,6 +21,7 @@ #include +#include "Debugger.hxx" #include "GuiObject.hxx" #include "CheckListWidget.hxx" #include "RomWidget.hxx" @@ -28,7 +29,9 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RomWidget::RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y) : Widget(boss, x, y, 16, 16), - CommandSender(boss) + CommandSender(boss), + myFirstLoad(true), + mySourceAvailable(false) { int w = 58 * font.getMaxCharWidth(), h = 31 * font.getLineHeight(); @@ -54,7 +57,7 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) switch(cmd) { case kListScrolledCmd: - cerr << "data invalidated; refill list\n"; + incrementalUpdate(); break; case kListItemChecked: @@ -73,24 +76,39 @@ void RomWidget::loadConfig() should be filled with new data. */ cerr << "RomWidget::loadConfig()\n"; - fillGrid(); - myRomList->setDirty(); myRomList->draw(); + if(myFirstLoad) // load the whole bank + { + initialUpdate(); + myFirstLoad = false; + } + else // only reload what's in current view + { + incrementalUpdate(); + } } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void RomWidget::fillGrid() +void RomWidget::initialUpdate() { - StringList l; - BoolArray b; + Debugger& dbg = instance()->debugger(); - for(int i = 0; i < 50; ++i) + // Fill romlist with entire ROM (FIXME - only fill with current bank) + if(mySourceAvailable) + ; // FIXME + else { - ostringstream tmp; - tmp << "Test line " << i; - l.push_back(tmp.str()); + StringList l; + BoolArray b; - b.push_back(false); + dbg.disassemble(l, 0, 2048); // FIXME - use bank size + for(int i = 0; i < 2048; ++i) + b.push_back(false); + + myRomList->setList(l, b); } - - myRomList->setList(l, b); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void RomWidget::incrementalUpdate() +{ } diff --git a/stella/src/debugger/RomWidget.hxx b/stella/src/debugger/RomWidget.hxx index 646087ee5..4d73fd182 100644 --- a/stella/src/debugger/RomWidget.hxx +++ b/stella/src/debugger/RomWidget.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: RomWidget.hxx,v 1.1 2005-08-22 13:53:23 stephena Exp $ +// $Id: RomWidget.hxx,v 1.2 2005-08-24 13:18:02 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -41,10 +41,14 @@ class RomWidget : public Widget, public CommandSender void loadConfig(); private: - void fillGrid(); + void initialUpdate(); + void incrementalUpdate(); private: CheckListWidget* myRomList; + + bool myFirstLoad; + bool mySourceAvailable; }; #endif diff --git a/stella/src/gui/CheckListWidget.cxx b/stella/src/gui/CheckListWidget.cxx index a2eadeb74..184ddf607 100644 --- a/stella/src/gui/CheckListWidget.cxx +++ b/stella/src/gui/CheckListWidget.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: CheckListWidget.cxx,v 1.4 2005-08-23 18:32:51 stephena Exp $ +// $Id: CheckListWidget.cxx,v 1.5 2005-08-24 13:18:02 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -61,11 +61,13 @@ void CheckListWidget::setStyle(CheckStyle style) { _checkList[i]->drawBox(true); _checkList[i]->setFill(false); + _checkList[i]->setColor(kTextColor); } else if(style == kSolidFill) { _checkList[i]->drawBox(false); - _checkList[i]->setFill(true, kTextColorEm); + _checkList[i]->setFill(true); + _checkList[i]->setColor(kTextColorEm); } } } diff --git a/stella/src/gui/Widget.cxx b/stella/src/gui/Widget.cxx index e56c6ecb9..48c47a068 100644 --- a/stella/src/gui/Widget.cxx +++ b/stella/src/gui/Widget.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: Widget.cxx,v 1.32 2005-08-23 18:32:51 stephena Exp $ +// $Id: Widget.cxx,v 1.33 2005-08-24 13:18:02 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -445,13 +445,6 @@ void CheckboxWidget::setEditable(bool editable) _holdFocus = _editable = editable; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void CheckboxWidget::setFill(bool fill, OverlayColor color) -{ - _fillRect = fill; - _fillColor = color; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CheckboxWidget::setState(bool state) { @@ -484,7 +477,8 @@ void CheckboxWidget::drawWidget(bool hilite) if(_state) { if(_fillRect) - fb.fillRect(_x + 2, _y + box_yoff + 2, 10, 10, _fillColor); + fb.fillRect(_x + 2, _y + box_yoff + 2, 10, 10, + isEnabled() ? _color : kColor); else fb.drawBitmap(checked_img, _x + 3, _y + box_yoff + 3, isEnabled() ? _color : kColor); diff --git a/stella/src/gui/Widget.hxx b/stella/src/gui/Widget.hxx index 3d28251cc..e8a07baeb 100644 --- a/stella/src/gui/Widget.hxx +++ b/stella/src/gui/Widget.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: Widget.hxx,v 1.34 2005-08-23 18:32:51 stephena Exp $ +// $Id: Widget.hxx,v 1.35 2005-08-24 13:18:02 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -71,7 +71,7 @@ enum { This is the base class for all widgets. @author Stephen Anthony - @version $Id: Widget.hxx,v 1.34 2005-08-23 18:32:51 stephena Exp $ + @version $Id: Widget.hxx,v 1.35 2005-08-24 13:18:02 stephena Exp $ */ class Widget : public GuiObject { @@ -225,12 +225,12 @@ class CheckboxWidget : public ButtonWidget void holdFocus(bool status) { _holdFocus = status; } void setEditable(bool editable); - void setFill(bool fill, OverlayColor color = kColor); - void drawBox(bool draw) { _drawBox = draw; } + void setFill(bool fill) { _fillRect = fill; } + void drawBox(bool draw) { _drawBox = draw; } void setState(bool state); void toggleState() { setState(!_state); } - bool getState() const { return _state; } + bool getState() const { return _state; } static int boxSize() { return 14; } // box is square