diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index b1111c057..1a01fbc43 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -30,11 +30,13 @@ #include "Settings.hxx" #include "Version.hxx" #include "CartDebug.hxx" +#include "CartDebugWidget.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem) : DebuggerSystem(dbg, console), myOSystem(osystem), + myDebugWidget(0), myRWPortAddress(0), myLabelLength(8) // longest pre-defined label { @@ -147,6 +149,9 @@ void CartDebug::saveOldState() myOldState.ram.clear(); for(uInt32 i = 0; i < myOldState.rport.size(); ++i) myOldState.ram.push_back(peek(myOldState.rport[i])); + + if(myDebugWidget) + myDebugWidget->saveOldState(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index 7bb0a9a2e..c6c71b92d 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -21,6 +21,7 @@ #define CART_DEBUG_HXX class Settings; +class CartDebugWidget; #include #include @@ -97,6 +98,11 @@ class CartDebug : public DebuggerSystem void saveOldState(); string toString(); + // Used to get/set the debug widget, which contains cart-specific + // functionality + CartDebugWidget* getDebugWidget() const { return myDebugWidget; } + void setDebugWidget(CartDebugWidget* w) { myDebugWidget = w; } + // The following assume that the given addresses are using the // correct read/write port ranges; no checking will be done to // confirm this. @@ -321,6 +327,8 @@ class CartDebug : public DebuggerSystem CartState myState; CartState myOldState; + CartDebugWidget* myDebugWidget; + // A complete record of relevant diassembly information for each bank Common::Array myBankInfo; diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 4ecbb4537..e5a18e865 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -40,6 +40,7 @@ #include "TIA.hxx" #include "CartDebug.hxx" +#include "CartDebugWidget.hxx" #include "CpuDebug.hxx" #include "RiotDebug.hxx" #include "TIADebug.hxx" @@ -181,6 +182,7 @@ void Debugger::initialize() myBaseDialog = myDialog; myRewindManager = new RewindManager(*myOSystem, myDialog->rewindButton()); + myCartDebug->setDebugWidget(&(myDialog->cartDebug())); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/Debugger.hxx b/src/debugger/Debugger.hxx index 4ad16e8af..54b1dcb5e 100644 --- a/src/debugger/Debugger.hxx +++ b/src/debugger/Debugger.hxx @@ -75,7 +75,6 @@ class Debugger : public DialogContainer // Make these friend classes, to ease communications with the debugger // Although it isn't enforced, these classes should use accessor methods // directly, and not touch the instance variables - friend class CartDebugWidget; friend class DebuggerDialog; friend class DebuggerParser; friend class EventHandler; diff --git a/src/debugger/gui/CartDPCWidget.cxx b/src/debugger/gui/CartDPCWidget.cxx index cf22e252d..159c42667 100644 --- a/src/debugger/gui/CartDPCWidget.cxx +++ b/src/debugger/gui/CartDPCWidget.cxx @@ -18,6 +18,7 @@ //============================================================================ #include "CartDPC.hxx" +#include "DataGridWidget.hxx" #include "PopUpWidget.hxx" #include "CartDPCWidget.hxx" @@ -59,6 +60,98 @@ CartridgeDPCWidget::CartridgeDPCWidget( font.getStringWidth("Set bank: "), kBankChanged); myBank->setTarget(this); addFocusWidget(myBank); + ypos += myLineHeight + 12; + + // Data fetchers + int lwidth = font.getStringWidth("Data Fetchers: "); + new StaticTextWidget(boss, font, xpos, ypos, lwidth, + myFontHeight, "Data Fetchers: ", kTextAlignLeft); + + // Top registers + lwidth = font.getStringWidth("Counter Registers: "); + xpos = 18; ypos += myLineHeight + 8; + new StaticTextWidget(boss, font, xpos, ypos, lwidth, + myFontHeight, "Top Registers: ", kTextAlignLeft); + xpos += lwidth; + + myTops = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16); + myTops->setTarget(this); + myTops->setEditable(false); + + // Bottom registers + xpos = 18; ypos += myLineHeight + 8; + new StaticTextWidget(boss, font, xpos, ypos, lwidth, + myFontHeight, "Bottom Registers: ", kTextAlignLeft); + xpos += lwidth; + + myBottoms = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16); + myBottoms->setTarget(this); + myBottoms->setEditable(false); + + // Counter registers + xpos = 18; ypos += myLineHeight + 8; + new StaticTextWidget(boss, font, xpos, ypos, lwidth, + myFontHeight, "Counter Registers: ", kTextAlignLeft); + xpos += lwidth; + + myCounters = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 4, 16, kBASE_16_4); + myCounters->setTarget(this); + myCounters->setEditable(false); + + // Flag registers + xpos = 18; ypos += myLineHeight + 8; + new StaticTextWidget(boss, font, xpos, ypos, lwidth, + myFontHeight, "Bottom Registers: ", kTextAlignLeft); + xpos += lwidth; + + myFlags = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16); + myFlags->setTarget(this); + myFlags->setEditable(false); + + // Music mode + xpos = 10; ypos += myLineHeight + 12; + lwidth = font.getStringWidth("Music mode (DF5/DF6/DF7): "); + new StaticTextWidget(boss, font, xpos, ypos, lwidth, + myFontHeight, "Music mode (DF5/DF6/DF7): ", kTextAlignLeft); + xpos += lwidth; + + myMusicMode = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 2, 8, kBASE_16); + myMusicMode->setTarget(this); + myMusicMode->setEditable(false); + + // Current random number + xpos = 10; ypos += myLineHeight + 8; + new StaticTextWidget(boss, font, xpos, ypos, lwidth, + myFontHeight, "Current random number: ", kTextAlignLeft); + xpos += lwidth; + + myRandom = new DataGridWidget(boss, font, xpos, ypos-2, 1, 1, 2, 8, kBASE_16); + myRandom->setTarget(this); + myRandom->setEditable(false); +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void CartridgeDPCWidget::saveOldState() +{ + myOldState.tops.clear(); + myOldState.bottoms.clear(); + myOldState.counters.clear(); + myOldState.flags.clear(); + myOldState.music.clear(); + + for(int i = 0; i < 8; ++i) + { + myOldState.tops.push_back(myCart.myTops[i]); + myOldState.bottoms.push_back(myCart.myBottoms[i]); + myOldState.counters.push_back(myCart.myCounters[i]); + myOldState.flags.push_back(myCart.myFlags[i]); + } + for(int i = 0; i < 3; ++i) + { + myOldState.music.push_back(myCart.myMusicMode[i]); + } + + myOldState.random = myCart.myRandomNumber; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -66,6 +159,54 @@ void CartridgeDPCWidget::loadConfig() { myBank->setSelected(myCart.myCurrentBank); + // Get registers, using change tracking + IntArray alist; + IntArray vlist; + BoolArray changed; + + alist.clear(); vlist.clear(); changed.clear(); + for(int i = 0; i < 8; ++i) + { + alist.push_back(0); vlist.push_back(myCart.myTops[i]); + changed.push_back(myCart.myTops[i] != myOldState.tops[i]); + } + myTops->setList(alist, vlist, changed); + + alist.clear(); vlist.clear(); changed.clear(); + for(int i = 0; i < 8; ++i) + { + alist.push_back(0); vlist.push_back(myCart.myBottoms[i]); + changed.push_back(myCart.myBottoms[i] != myOldState.bottoms[i]); + } + myBottoms->setList(alist, vlist, changed); + + alist.clear(); vlist.clear(); changed.clear(); + for(int i = 0; i < 8; ++i) + { + alist.push_back(0); vlist.push_back(myCart.myCounters[i]); + changed.push_back(myCart.myCounters[i] != myOldState.counters[i]); + } + myCounters->setList(alist, vlist, changed); + + alist.clear(); vlist.clear(); changed.clear(); + for(int i = 0; i < 8; ++i) + { + alist.push_back(0); vlist.push_back(myCart.myFlags[i]); + changed.push_back(myCart.myFlags[i] != myOldState.flags[i]); + } + myFlags->setList(alist, vlist, changed); + + alist.clear(); vlist.clear(); changed.clear(); + for(int i = 0; i < 3; ++i) + { + alist.push_back(0); vlist.push_back(myCart.myMusicMode[i]); + changed.push_back(myCart.myMusicMode[i] != myOldState.music[i]); + } + myMusicMode->setList(alist, vlist, changed); + + myRandom->setList(0, myCart.myRandomNumber, + myCart.myRandomNumber != myOldState.random); + CartDebugWidget::loadConfig(); } diff --git a/src/debugger/gui/CartDPCWidget.hxx b/src/debugger/gui/CartDPCWidget.hxx index 6958ceba5..9a43c4116 100644 --- a/src/debugger/gui/CartDPCWidget.hxx +++ b/src/debugger/gui/CartDPCWidget.hxx @@ -22,6 +22,7 @@ class CartridgeDPC; class PopUpWidget; +class DataGridWidget; #include "CartDebugWidget.hxx" @@ -33,13 +34,34 @@ class CartridgeDPCWidget : public CartDebugWidget CartridgeDPC& cart); virtual ~CartridgeDPCWidget() { } + void saveOldState(); + void loadConfig(); void handleCommand(CommandSender* sender, int cmd, int data, int id); + private: + struct CartState { + ByteArray tops; + ByteArray bottoms; + IntArray counters; + ByteArray flags; + BoolArray music; + uInt8 random; + }; + private: CartridgeDPC& myCart; PopUpWidget* myBank; + DataGridWidget* myTops; + DataGridWidget* myBottoms; + DataGridWidget* myCounters; + DataGridWidget* myFlags; + DataGridWidget* myMusicMode; + DataGridWidget* myRandom; + + CartState myState, myOldState; + enum { kBankChanged = 'bkCH' }; }; diff --git a/src/debugger/gui/CartDebugWidget.hxx b/src/debugger/gui/CartDebugWidget.hxx index 732d6b338..60288de67 100644 --- a/src/debugger/gui/CartDebugWidget.hxx +++ b/src/debugger/gui/CartDebugWidget.hxx @@ -100,9 +100,13 @@ class CartDebugWidget : public Widget, public CommandSender // Inform the ROM Widget that the underlying cart has somehow changed void invalidate() { - Debugger::debugger().rom().invalidate(); + sendCommand(RomWidget::kInvalidateListing, -1, -1); } + // Some carts need to save old state in the debugger, so that we can + // implement change tracking; most carts probably won't do anything here + virtual void saveOldState() { } + virtual void loadConfig() { myDesc->setSelected(0); } virtual void handleCommand(CommandSender* sender, int cmd, int data, int id) { }; diff --git a/src/debugger/gui/CpuWidget.cxx b/src/debugger/gui/CpuWidget.cxx index 2f7cc80c6..b00b257e5 100644 --- a/src/debugger/gui/CpuWidget.cxx +++ b/src/debugger/gui/CpuWidget.cxx @@ -138,7 +138,7 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) switch(cmd) { - case kDGItemDataChangedCmd: + case DataGridWidget::kItemDataChangedCmd: switch(id) { case kPCRegID: @@ -190,7 +190,7 @@ void CpuWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) } break; - case kTWItemDataChangedCmd: + case ToggleWidget::kItemDataChangedCmd: { bool state = myPSRegister->getSelectedState(); diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index ff22ab4c6..c30e49728 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -60,11 +60,17 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font, // _textcolorhi to erase it _caretInverse = true; - // Make sure hilite list contains all false values + // Make sure all lists contain some default values _hiliteList.clear(); int size = _rows * _cols; while(size--) + { + _addrList.push_back(0); + _valueList.push_back(0); + _valueStringList.push_back(""); + _changedList.push_back(0); _hiliteList.push_back(false); + } // Set lower and upper bounds to sane values setRange(0, 1 << bits); @@ -100,7 +106,6 @@ cerr << "alist.size() = " << alist.size() assert(size == _rows * _cols); _addrList.clear(); - _addrStringList.clear(); _valueList.clear(); _valueStringList.clear(); _changedList.clear(); @@ -127,7 +132,7 @@ cerr << "_addrList.size() = " << _addrList.size() _editMode = false; // Send item selected signal for starting with cell 0 - sendCommand(kDGSelectionChangedCmd, _selectedItem, _id); + sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id); setDirty(); draw(); } @@ -200,7 +205,7 @@ void DataGridWidget::setValue(int position, int value, bool changed) _changedList[position] = changed; _valueList[position] = value; - sendCommand(kDGItemDataChangedCmd, position, _id); + sendCommand(DataGridWidget::kItemDataChangedCmd, position, _id); setDirty(); draw(); } @@ -234,7 +239,7 @@ void DataGridWidget::handleMouseDown(int x, int y, int button, int clickCount) _currentRow = _selectedItem / _cols; _currentCol = _selectedItem - (_currentRow * _cols); - sendCommand(kDGSelectionChangedCmd, _selectedItem, _id); + sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id); setDirty(); draw(); } } @@ -246,7 +251,7 @@ void DataGridWidget::handleMouseUp(int x, int y, int button, int clickCount) // send the double click command if (clickCount == 2 && (_selectedItem == findItem(x, y))) { - sendCommand(kDGItemDoubleClickedCmd, _selectedItem, _id); + sendCommand(DataGridWidget::kItemDoubleClickedCmd, _selectedItem, _id); // Start edit mode if(_editable && !_editMode) @@ -464,7 +469,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii) _selectedItem = _currentRow*_cols + _currentCol; if(_selectedItem != oldItem) - sendCommand(kDGSelectionChangedCmd, _selectedItem, _id); + sendCommand(DataGridWidget::kSelectionChangedCmd, _selectedItem, _id); setDirty(); draw(); } diff --git a/src/debugger/gui/DataGridWidget.hxx b/src/debugger/gui/DataGridWidget.hxx index d64297132..a8ed9334d 100644 --- a/src/debugger/gui/DataGridWidget.hxx +++ b/src/debugger/gui/DataGridWidget.hxx @@ -33,17 +33,18 @@ class ScrollBarWidget; #include "Array.hxx" #include "Rect.hxx" -// Some special commands -enum { - kDGItemDoubleClickedCmd = 'DGdb', - kDGItemActivatedCmd = 'DGac', - kDGItemDataChangedCmd = 'DGch', - kDGSelectionChangedCmd = 'DGsc' -}; - /* DataGridWidget */ class DataGridWidget : public EditableWidget { + public: + // Commands emitted by this commandsender + enum { + kItemDoubleClickedCmd = 'DGdb', + kItemActivatedCmd = 'DGac', + kItemDataChangedCmd = 'DGch', + kSelectionChangedCmd = 'DGsc' + }; + public: DataGridWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int cols, int rows, @@ -120,7 +121,6 @@ class DataGridWidget : public EditableWidget IntArray _addrList; IntArray _valueList; - StringList _addrStringList; StringList _valueStringList; BoolArray _changedList; BoolArray _hiliteList; diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index f6338b171..03975bf7d 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -147,6 +147,10 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd, doExitRom(); break; + case RomWidget::kInvalidateListing: + myRom->invalidate(); + break; + default: Dialog::handleCommand(sender, cmd, data, id); } diff --git a/src/debugger/gui/DebuggerDialog.hxx b/src/debugger/gui/DebuggerDialog.hxx index 3f63a5b39..ada9eff7f 100644 --- a/src/debugger/gui/DebuggerDialog.hxx +++ b/src/debugger/gui/DebuggerDialog.hxx @@ -53,6 +53,7 @@ class DebuggerDialog : public Dialog TiaOutputWidget& tiaOutput() { return *myTiaOutput; } TiaZoomWidget& tiaZoom() { return *myTiaZoom; } RomWidget& rom() { return *myRom; } + CartDebugWidget& cartDebug() { return *myCartDebug; } EditTextWidget& message() { return *myMessageBox; } ButtonWidget& rewindButton() { return *myRewindButton; } diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index 25845016c..d4b9f7d50 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -164,7 +164,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) const CartState& state = (CartState&) dbg.getState(); switch(cmd) { - case kDGItemDataChangedCmd: + case DataGridWidget::kItemDataChangedCmd: { addr = myRamGrid->getSelectedAddr(); value = myRamGrid->getSelectedValue(); @@ -189,7 +189,7 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) break; } - case kDGSelectionChangedCmd: + case DataGridWidget::kSelectionChangedCmd: { addr = myRamGrid->getSelectedAddr(); value = myRamGrid->getSelectedValue(); diff --git a/src/debugger/gui/RiotWidget.cxx b/src/debugger/gui/RiotWidget.cxx index 42f0a4c68..8cf967fb7 100644 --- a/src/debugger/gui/RiotWidget.cxx +++ b/src/debugger/gui/RiotWidget.cxx @@ -320,7 +320,7 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) switch(cmd) { - case kDGItemDataChangedCmd: + case DataGridWidget::kItemDataChangedCmd: switch(id) { case kTimWriteID: @@ -343,7 +343,7 @@ void RiotWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) } break; - case kTWItemDataChangedCmd: + case ToggleWidget::kItemDataChangedCmd: switch(id) { case kSWCHABitsID: diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index f1a537025..1d7118ea1 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -202,7 +202,7 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) break; // kCMenuItemSelectedCmd } - case kDGItemDataChangedCmd: + case DataGridWidget::kItemDataChangedCmd: setBank(myBank->getSelectedValue()); break; diff --git a/src/debugger/gui/RomWidget.hxx b/src/debugger/gui/RomWidget.hxx index 4de51a043..ff32b9e53 100644 --- a/src/debugger/gui/RomWidget.hxx +++ b/src/debugger/gui/RomWidget.hxx @@ -38,6 +38,13 @@ class StringList; class RomWidget : public Widget, public CommandSender { + public: + enum { + kResolveDataChanged = 'ACrd', + kRomNameEntered = 'RWrn', + kInvalidateListing = 'INli' + }; + public: RomWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int w, int h); virtual ~RomWidget(); @@ -58,11 +65,6 @@ class RomWidget : public Widget, public CommandSender void saveROM(const string& rom); private: - enum { - kResolveDataChanged = 'ACrd', - kRomNameEntered = 'RWrn' - }; - RomListWidget* myRomList; DataGridWidget* myBank; PopUpWidget* myResolveData; diff --git a/src/debugger/gui/TiaWidget.cxx b/src/debugger/gui/TiaWidget.cxx index e6d2e6de6..96b8019a7 100644 --- a/src/debugger/gui/TiaWidget.cxx +++ b/src/debugger/gui/TiaWidget.cxx @@ -585,7 +585,7 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) tia.strobeCxclr(); break; - case kDGItemDataChangedCmd: + case DataGridWidget::kItemDataChangedCmd: switch(id) { case kColorRegsID: @@ -660,7 +660,7 @@ void TiaWidget::handleCommand(CommandSender* sender, int cmd, int data, int id) } break; - case kTWItemDataChangedCmd: + case ToggleWidget::kItemDataChangedCmd: switch(id) { case kGRP0ID: diff --git a/src/debugger/gui/ToggleWidget.cxx b/src/debugger/gui/ToggleWidget.cxx index 2c1535de1..cb07e136c 100644 --- a/src/debugger/gui/ToggleWidget.cxx +++ b/src/debugger/gui/ToggleWidget.cxx @@ -79,7 +79,7 @@ void ToggleWidget::handleMouseUp(int x, int y, int button, int clickCount) { _stateList[_selectedItem] = !_stateList[_selectedItem]; _changedList[_selectedItem] = !_changedList[_selectedItem]; - sendCommand(kTWItemDataChangedCmd, _selectedItem, _id); + sendCommand(ToggleWidget::kItemDataChangedCmd, _selectedItem, _id); setDirty(); draw(); } } @@ -193,7 +193,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod, char ascii) { _stateList[_selectedItem] = !_stateList[_selectedItem]; _changedList[_selectedItem] = !_changedList[_selectedItem]; - sendCommand(kTWItemDataChangedCmd, _selectedItem, _id); + sendCommand(ToggleWidget::kItemDataChangedCmd, _selectedItem, _id); } setDirty(); draw(); diff --git a/src/debugger/gui/ToggleWidget.hxx b/src/debugger/gui/ToggleWidget.hxx index 081ba82bd..1f78b2e66 100644 --- a/src/debugger/gui/ToggleWidget.hxx +++ b/src/debugger/gui/ToggleWidget.hxx @@ -27,15 +27,16 @@ #include "Command.hxx" #include "Array.hxx" -// Some special commands -enum { - kTWItemDataChangedCmd = 'TWch', - kTWSelectionChangedCmd = 'TWsc' -}; - /* ToggleWidget */ class ToggleWidget : public Widget, public CommandSender { + public: + // Commands emitted by this commandsender + enum { + kItemDataChangedCmd = 'TWch', + kSelectionChangedCmd = 'TWsc' + }; + public: ToggleWidget(GuiObject* boss, const GUI::Font& font, int x, int y, int cols, int rows); diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index 0ebf3beb0..0f5f8cc46 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -42,7 +42,7 @@ CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size, myDisplayImage = myProgramImage + 8192; // Initialize the DPC data fetcher registers - for(uInt16 i = 0; i < 8; ++i) + for(int i = 0; i < 8; ++i) myTops[i] = myBottoms[i] = myCounters[i] = myFlags[i] = 0; // None of the data fetchers are in music mode diff --git a/src/emucore/CartDPC.hxx b/src/emucore/CartDPC.hxx index dfbed84c2..20b0de496 100644 --- a/src/emucore/CartDPC.hxx +++ b/src/emucore/CartDPC.hxx @@ -30,8 +30,12 @@ class System; /** Cartridge class used for Pitfall II. There are two 4K program banks, a - 2K display bank, and the DPC chip. For complete details on the DPC chip - see David P. Crane's United States Patent Number 4,644,495. + 2K display bank, and the DPC chip. The bankswitching itself is the same + as F8 scheme (hotspots at $1FF8 and $1FF9). DPC chip access is mapped to + $1000 - $1080 ($1000 - $103F is read port, $1040 - $107F is write port). + + For complete details on the DPC chip see David P. Crane's United States + Patent Number 4,644,495. @author Bradford W. Mott @version $Id$ diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 6e8b9172d..c52f27c2d 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -56,10 +56,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size, // If the image is larger than 29K, we assume any excess at the // beginning is ARM code, and skip over it if(size > 29 * 1024) - { - int offset = size - 29 * 1024; - myProgramImage += offset; - } + myProgramImage += (size - 29 * 1024); #ifdef THUMB_SUPPORT // Create Thumbulator ARM emulator diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 2366edb70..9fbbaa417 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -582,7 +582,7 @@ bool Dialog::handleNavEvent(Event::Type e) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Dialog::getTabIdForWidget(Widget* w) { - if(_myTabList.size() == 0) + if(_myTabList.size() == 0 || !w) return; for(uInt32 id = 0; id < _myTabList.size(); ++id)