diff --git a/src/debugger/gui/CartBUSWidget.cxx b/src/debugger/gui/CartBUSWidget.cxx index fb0c7f29b..903bd3d42 100644 --- a/src/debugger/gui/CartBUSWidget.cxx +++ b/src/debugger/gui/CartBUSWidget.cxx @@ -189,29 +189,51 @@ CartridgeBUSWidget::CartridgeBUSWidget( new StaticTextWidget(boss, _font, xpos, ypos + 1, "Last ARM run stats:"); xpos = 10 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4; StaticTextWidget* s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Mem. cycles "); - myThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + myPrevThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbMemCycles->setEditable(false); + myPrevThumbMemCycles->setToolTip("Number of memory cycles of last but one ARM run."); + + myThumbMemCycles = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getRight() + _fontWidth / 2, ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbMemCycles->setEditable(false); myThumbMemCycles->setToolTip("Number of memory cycles of last ARM run."); s = new StaticTextWidget(boss, _font, myThumbMemCycles->getRight() + _fontWidth * 2, ypos + 1, "Fetches "); - myThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + myPrevThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbFetches->setEditable(false); + myPrevThumbFetches->setToolTip("Number of fetches/instructions of last but one ARM run."); + + myThumbFetches = new EditTextWidget(boss, _font, myPrevThumbFetches->getRight() + _fontWidth / 2, ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbFetches->setEditable(false); myThumbFetches->setToolTip("Number of fetches/instructions of last ARM run."); ypos += myLineHeight + 4; s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Reads "); + + myPrevThumbReads = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getLeft(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbReads->setEditable(false); + myPrevThumbReads->setToolTip("Number of reads of last but one ARM run."); + myThumbReads = new EditTextWidget(boss, _font, myThumbMemCycles->getLeft(), ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbReads->setEditable(false); myThumbReads->setToolTip("Number of reads of last ARM run."); s = new StaticTextWidget(boss, _font, myThumbReads->getRight() + _fontWidth * 2, ypos + 1, "Writes "); + + myPrevThumbWrites = new EditTextWidget(boss, _font, myPrevThumbFetches->getLeft(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbWrites->setEditable(false); + myPrevThumbWrites->setToolTip("Number of writes of last but one ARM run."); + myThumbWrites = new EditTextWidget(boss, _font, myThumbFetches->getLeft(), ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbWrites->setEditable(false); - myThumbWrites->setToolTip("Number of write of last ARM run."); + myThumbWrites->setToolTip("Number of writes of last ARM run."); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -394,6 +416,16 @@ void CartridgeBUSWidget::loadConfig() mySamplePointer->setCrossed(true); } + myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches + + myCart.prevStats().reads + myCart.prevStats().writes, + Common::Base::Fmt::_10_6)); + myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches, + Common::Base::Fmt::_10_6)); + myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads, + Common::Base::Fmt::_10_6)); + myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes, + Common::Base::Fmt::_10_6)); + myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes, Common::Base::Fmt::_10_6)); diff --git a/src/debugger/gui/CartBUSWidget.hxx b/src/debugger/gui/CartBUSWidget.hxx index 75b4d0332..72fb6ffd3 100644 --- a/src/debugger/gui/CartBUSWidget.hxx +++ b/src/debugger/gui/CartBUSWidget.hxx @@ -66,6 +66,10 @@ class CartridgeBUSWidget : public CartDebugWidget DataGridWidget* mySamplePointer{nullptr}; CheckboxWidget* myBusOverdrive{nullptr}; CheckboxWidget* myDigitalSample{nullptr}; + EditTextWidget* myPrevThumbMemCycles{nullptr}; + EditTextWidget* myPrevThumbFetches{nullptr}; + EditTextWidget* myPrevThumbReads{nullptr}; + EditTextWidget* myPrevThumbWrites{nullptr}; EditTextWidget* myThumbMemCycles{nullptr}; EditTextWidget* myThumbFetches{nullptr}; EditTextWidget* myThumbReads{nullptr}; diff --git a/src/debugger/gui/CartCDFWidget.cxx b/src/debugger/gui/CartCDFWidget.cxx index 121679450..78748c442 100644 --- a/src/debugger/gui/CartCDFWidget.cxx +++ b/src/debugger/gui/CartCDFWidget.cxx @@ -204,29 +204,52 @@ CartridgeCDFWidget::CartridgeCDFWidget( new StaticTextWidget(boss, _font, xpos, ypos + 1, "Last ARM run stats:"); xpos = HBORDER + INDENT; ypos += myLineHeight + VGAP; StaticTextWidget* s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Mem. cycles "); - myThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, - EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + + myPrevThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbMemCycles->setEditable(false); + myPrevThumbMemCycles->setToolTip("Number of memory cycles of last but one ARM run."); + + myThumbMemCycles = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getRight() + _fontWidth / 2, ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbMemCycles->setEditable(false); myThumbMemCycles->setToolTip("Number of memory cycles of last ARM run."); s = new StaticTextWidget(boss, _font, myThumbMemCycles->getRight() + _fontWidth * 2, ypos + 1, "Fetches "); - myThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, - EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbFetches->setEditable(false); + myPrevThumbFetches->setToolTip("Number of fetches/instructions of last but one ARM run."); + + myThumbFetches = new EditTextWidget(boss, _font, myPrevThumbFetches->getRight() + _fontWidth / 2, ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbFetches->setEditable(false); myThumbFetches->setToolTip("Number of fetches/instructions of last ARM run."); ypos += myLineHeight + VGAP; s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Reads "); + + myPrevThumbReads = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getLeft(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbReads->setEditable(false); + myPrevThumbReads->setToolTip("Number of reads of last but one ARM run."); + myThumbReads = new EditTextWidget(boss, _font, myThumbMemCycles->getLeft(), ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbReads->setEditable(false); myThumbReads->setToolTip("Number of reads of last ARM run."); s = new StaticTextWidget(boss, _font, myThumbReads->getRight() + _fontWidth * 2, ypos + 1, "Writes "); + + myPrevThumbWrites = new EditTextWidget(boss, _font, myPrevThumbFetches->getLeft(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbWrites->setEditable(false); + myPrevThumbWrites->setToolTip("Number of writes of last but one ARM run."); + myThumbWrites = new EditTextWidget(boss, _font, myThumbFetches->getLeft(), ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbWrites->setEditable(false); - myThumbWrites->setToolTip("Number of write of last ARM run."); + myThumbWrites->setToolTip("Number of writes of last ARM run."); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -405,6 +428,16 @@ void CartridgeCDFWidget::loadConfig() mySamplePointer->setCrossed(true); } + myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches + + myCart.prevStats().reads + myCart.prevStats().writes, + Common::Base::Fmt::_10_6)); + myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches, + Common::Base::Fmt::_10_6)); + myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads, + Common::Base::Fmt::_10_6)); + myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes, + Common::Base::Fmt::_10_6)); + myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes, Common::Base::Fmt::_10_6)); diff --git a/src/debugger/gui/CartCDFWidget.hxx b/src/debugger/gui/CartCDFWidget.hxx index faf93aa87..b8269e4bf 100644 --- a/src/debugger/gui/CartCDFWidget.hxx +++ b/src/debugger/gui/CartCDFWidget.hxx @@ -70,6 +70,10 @@ class CartridgeCDFWidget : public CartDebugWidget CheckboxWidget* myFastFetch{nullptr}; CheckboxWidget* myDigitalSample{nullptr}; + EditTextWidget* myPrevThumbMemCycles{nullptr}; + EditTextWidget* myPrevThumbFetches{nullptr}; + EditTextWidget* myPrevThumbReads{nullptr}; + EditTextWidget* myPrevThumbWrites{nullptr}; EditTextWidget* myThumbMemCycles{nullptr}; EditTextWidget* myThumbFetches{nullptr}; EditTextWidget* myThumbReads{nullptr}; diff --git a/src/debugger/gui/CartDPCPlusWidget.cxx b/src/debugger/gui/CartDPCPlusWidget.cxx index 9e0113d73..4555e001e 100644 --- a/src/debugger/gui/CartDPCPlusWidget.cxx +++ b/src/debugger/gui/CartDPCPlusWidget.cxx @@ -184,30 +184,53 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget( new StaticTextWidget(boss, _font, xpos, ypos + 1, "Last ARM run stats:"); xpos = 2 + _font.getMaxCharWidth() * 2; ypos += myLineHeight + 4; StaticTextWidget* s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Mem. cycles "); - myThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + + myPrevThumbMemCycles = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbMemCycles->setEditable(false); + myPrevThumbMemCycles->setToolTip("Number of memory cycles of last but one ARM run."); + + myThumbMemCycles = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getRight() + _fontWidth / 2, ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbMemCycles->setEditable(false); myThumbMemCycles->setToolTip("Number of memory cycles of last ARM run."); s = new StaticTextWidget(boss, _font, myThumbMemCycles->getRight() + _fontWidth * 2, ypos + 1, "Fetches "); - myThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + + myPrevThumbFetches = new EditTextWidget(boss, _font, s->getRight(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbFetches->setEditable(false); + myPrevThumbFetches->setToolTip("Number of fetches/instructions of last but one ARM run."); + + myThumbFetches = new EditTextWidget(boss, _font, myPrevThumbFetches->getRight() + _fontWidth / 2, ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbFetches->setEditable(false); myThumbFetches->setToolTip("Number of fetches/instructions of last ARM run."); ypos += myLineHeight + 4; s = new StaticTextWidget(boss, _font, xpos, ypos + 1, "Reads "); + + myPrevThumbReads = new EditTextWidget(boss, _font, myPrevThumbMemCycles->getLeft(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbReads->setEditable(false); + myPrevThumbReads->setToolTip("Number of reads of last but one ARM run."); + myThumbReads = new EditTextWidget(boss, _font, myThumbMemCycles->getLeft(), ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbReads->setEditable(false); myThumbReads->setToolTip("Number of reads of last ARM run."); s = new StaticTextWidget(boss, _font, myThumbReads->getRight() + _fontWidth * 2, ypos + 1, "Writes "); + + myPrevThumbWrites = new EditTextWidget(boss, _font, myPrevThumbFetches->getLeft(), ypos - 1, + EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); + myPrevThumbWrites->setEditable(false); + myPrevThumbWrites->setToolTip("Number of writes of last but one ARM run."); + myThumbWrites = new EditTextWidget(boss, _font, myThumbFetches->getLeft(), ypos - 1, EditTextWidget::calcWidth(_font, 6), myLineHeight, ""); myThumbWrites->setEditable(false); - myThumbWrites->setToolTip("Number of write of last ARM run."); - + myThumbWrites->setToolTip("Number of writes of last ARM run."); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -336,6 +359,16 @@ void CartridgeDPCPlusWidget::loadConfig() myFastFetch->setState(myCart.myFastFetch); myIMLDA->setState(myCart.myLDAimmediate); + myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches + + myCart.prevStats().reads + myCart.prevStats().writes, + Common::Base::Fmt::_10_6)); + myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches, + Common::Base::Fmt::_10_6)); + myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads, + Common::Base::Fmt::_10_6)); + myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes, + Common::Base::Fmt::_10_6)); + myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes, Common::Base::Fmt::_10_6)); diff --git a/src/debugger/gui/CartDPCPlusWidget.hxx b/src/debugger/gui/CartDPCPlusWidget.hxx index 8206e31ac..0251e519a 100644 --- a/src/debugger/gui/CartDPCPlusWidget.hxx +++ b/src/debugger/gui/CartDPCPlusWidget.hxx @@ -66,6 +66,10 @@ class CartridgeDPCPlusWidget : public CartDebugWidget CheckboxWidget* myFastFetch{nullptr}; CheckboxWidget* myIMLDA{nullptr}; DataGridWidget* myRandom{nullptr}; + EditTextWidget* myPrevThumbMemCycles{nullptr}; + EditTextWidget* myPrevThumbFetches{nullptr}; + EditTextWidget* myPrevThumbReads{nullptr}; + EditTextWidget* myPrevThumbWrites{nullptr}; EditTextWidget* myThumbMemCycles{nullptr}; EditTextWidget* myThumbFetches{nullptr}; EditTextWidget* myThumbReads{nullptr}; diff --git a/src/emucore/CartBUS.hxx b/src/emucore/CartBUS.hxx index dde5faaa9..585d977dc 100644 --- a/src/emucore/CartBUS.hxx +++ b/src/emucore/CartBUS.hxx @@ -233,8 +233,9 @@ class CartridgeBUS : public Cartridge uInt32 getWaveformSize(uInt8 index) const; uInt32 getSample(); - // Get number of memory accesses of last ARM run. + // Get number of memory accesses of last and last but one ARM runs. const Thumbulator::Stats& stats() const { return myThumbEmulator->stats(); } + const Thumbulator::Stats& prevStats() const { return myThumbEmulator->prevStats(); } private: // The 32K ROM image of the cartridge diff --git a/src/emucore/CartCDF.hxx b/src/emucore/CartCDF.hxx index 9dc7aa782..2510ecf66 100644 --- a/src/emucore/CartCDF.hxx +++ b/src/emucore/CartCDF.hxx @@ -263,8 +263,9 @@ class CartridgeCDF : public Cartridge uInt32 getSample(); void setupVersion(); - // Get number of memory accesses of last ARM run. + // Get number of memory accesses of last and last but one ARM runs. const Thumbulator::Stats& stats() const { return myThumbEmulator->stats(); } + const Thumbulator::Stats& prevStats() const { return myThumbEmulator->prevStats(); } private: // The ROM image of the cartridge diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index 126591b4a..c87ca79f1 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -223,8 +223,9 @@ class CartridgeDPCPlus : public Cartridge */ void callFunction(uInt8 value); - // Get number of memory accesses of last ARM run. + // Get number of memory accesses of last and last but one ARM runs. const Thumbulator::Stats& stats() const { return myThumbEmulator->stats(); } + const Thumbulator::Stats& prevStats() const { return myThumbEmulator->prevStats(); } private: // The ROM image and size diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index 6ad155283..965937424 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -2548,6 +2548,9 @@ int Thumbulator::reset() statusMsg.str(""); #endif #ifndef NO_THUMB_STATS + _prevStats.fetches = _stats.fetches; + _prevStats.reads = _stats.reads; + _prevStats.writes = _stats.writes; _stats.fetches = _stats.reads = _stats.writes = 0; #endif diff --git a/src/emucore/Thumbulator.hxx b/src/emucore/Thumbulator.hxx index 2b56ff908..bb7640677 100644 --- a/src/emucore/Thumbulator.hxx +++ b/src/emucore/Thumbulator.hxx @@ -82,6 +82,7 @@ class Thumbulator string run(); string run(uInt32 cycles); const Stats& stats() const { return _stats; } + const Stats& prevStats() const { return _prevStats; } #ifndef UNSAFE_OPTIMIZATIONS /** @@ -209,6 +210,7 @@ class Thumbulator uInt32 instructions{0}; #endif Stats _stats; + Stats _prevStats; // For emulation of LPC2103's timer 1, used for NTSC/PAL/SECAM detection. // Register names from documentation: