added UI elements for ARM cycles to debugger widgets

refactored ARM cart classes a bit
This commit is contained in:
Thomas Jentzsch 2021-06-14 16:24:42 +02:00
parent 0c511805c7
commit f9d7f66125
22 changed files with 462 additions and 387 deletions

View File

@ -3544,7 +3544,7 @@
</tr><tr>
<td><pre>-dev.thumb.incycles &lt;1|0&gt;</pre></td>
<td>When enabled, ARM emulation cycles are added to system cycles. This
allows detecting timer overruns.</br>
allows detecting timer overruns, but will also distort IRQ driven audio.</br>
Note: The ARM emulation cycles are only a coarse approximation.
</td>
</tr><tr>

View File

@ -0,0 +1,199 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "OSystem.hxx"
#include "EditTextWidget.hxx"
#include "CartARMWidget.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeARMWidget::CartridgeARMWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeARM& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
myCart{cart}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARMWidget::addCycleWidgets(int xpos, int ypos)
{
const int INDENT = 20;
const int VGAP = 4;
new StaticTextWidget(_boss, _font, xpos, ypos + 1, "ARM emulation cycles:");
xpos += INDENT; ypos += myLineHeight + VGAP;
myIncCycles = new CheckboxWidget(_boss, _font, xpos, ypos + 1, "Increase 6507 cycles", kIncCyclesChanged);
myIncCycles->setToolTip("Increase 6507 cycles with approximated ARM cycles.");
myIncCycles->setTarget(this);
addFocusWidget(myIncCycles);
myCycleFactor = new SliderWidget(_boss, _font, myIncCycles->getRight() + _fontWidth * 2, ypos - 1,
_fontWidth * 10, _lineHeight, "Factor ", _fontWidth * 7,
kFactorChanged, _fontWidth * 4, "%");
myCycleFactor->setMinValue(100); myCycleFactor->setMaxValue(200);
myCycleFactor->setTickmarkIntervals(4);
myCycleFactor->setToolTip("Multiply approximated ARM cycles by factor.");
myCycleFactor->setTarget(this);
addFocusWidget(myCycleFactor);
ypos += myLineHeight + VGAP;
StaticTextWidget* s = new StaticTextWidget(_boss, _font, xpos, ypos + 1, "Mem. cycles ");
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 ");
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 writes of last ARM run.");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARMWidget::saveOldState()
{
myOldState.armStats.clear();
myOldState.armPrevStats.clear();
myOldState.armStats.push_back(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes);
myOldState.armStats.push_back(myCart.stats().fetches);
myOldState.armStats.push_back(myCart.stats().reads);
myOldState.armStats.push_back(myCart.stats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches);
myOldState.armPrevStats.push_back(myCart.prevStats().reads);
myOldState.armPrevStats.push_back(myCart.prevStats().writes);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARMWidget::loadConfig()
{
// ARM cycles
myIncCycles->setState(instance().settings().getBool("dev.thumb.inccycles"));
myCycleFactor->setValue(std::round(instance().settings().getFloat("dev.thumb.cyclefactor") * 100.F));
handleArmCycles();
bool isChanged;
isChanged = myCart.prevStats().fetches + myCart.prevStats().reads + myCart.prevStats().writes
!= myOldState.armPrevStats[0];
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().fetches != myOldState.armPrevStats[1];
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().reads != myOldState.armPrevStats[2];
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().writes != myOldState.armPrevStats[3];
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes
!= myOldState.armStats[0];
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches != myOldState.armStats[1];
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().reads != myOldState.armStats[2];
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().writes != myOldState.armStats[3];
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6), isChanged);
CartDebugWidget::loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARMWidget::handleCommand(CommandSender* sender,
int cmd, int data, int id)
{
switch(cmd)
{
case kIncCyclesChanged:
case kFactorChanged:
handleArmCycles();
break;
default:
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARMWidget::handleArmCycles()
{
bool devSettings = instance().settings().getBool("dev.settings");
bool enable = myIncCycles->getState();
double factor = myCycleFactor->getValue() / 100.F;
if(devSettings)
{
instance().settings().setValue("dev.thumb.inccycles", enable);
instance().settings().setValue("dev.thumb.cyclefactor", factor);
}
myIncCycles->setEnabled(devSettings);
enable &= devSettings;
myCart.incCycles(enable);
myCycleFactor->setEnabled(enable);
myCart.cycleFactor(factor);
}

View File

@ -0,0 +1,88 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#ifndef CARTRIDGE_ARM_WIDGET_HXX
#define CARTRIDGE_ARM_WIDGET_HXX
#include "CartARM.hxx"
#include "CartDebugWidget.hxx"
class CheckboxWidget;
class SliderWidget;
class EditTextWidget;
/**
Abstract base class for ARM cart widgets.
@author Thomas Jentzsch
*/
class CartridgeARMWidget : public CartDebugWidget
{
public:
CartridgeARMWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont,
int x, int y, int w, int h,
CartridgeARM& cart);
~CartridgeARMWidget() override = default;
protected:
void addCycleWidgets(int xpos, int ypos);
void saveOldState() override;
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
private:
void handleArmCycles();
private:
struct CartState {
uIntArray armStats;
uIntArray armPrevStats;
};
CartridgeARM& myCart;
CheckboxWidget* myIncCycles{nullptr};
SliderWidget* myCycleFactor{nullptr};
EditTextWidget* myPrevThumbMemCycles{nullptr};
EditTextWidget* myPrevThumbFetches{nullptr};
EditTextWidget* myPrevThumbReads{nullptr};
EditTextWidget* myPrevThumbWrites{nullptr};
EditTextWidget* myThumbMemCycles{nullptr};
EditTextWidget* myThumbFetches{nullptr};
EditTextWidget* myThumbReads{nullptr};
EditTextWidget* myThumbWrites{nullptr};
CartState myOldState;
enum {
kIncCyclesChanged = 'inCH',
kFactorChanged = 'fcCH'
};
private:
// Following constructors and assignment operators not supported
CartridgeARMWidget() = delete;
CartridgeARMWidget(const CartridgeARMWidget&) = delete;
CartridgeARMWidget(CartridgeARMWidget&&) = delete;
CartridgeARMWidget& operator=(const CartridgeARMWidget&) = delete;
CartridgeARMWidget& operator=(CartridgeARMWidget&&) = delete;
};
#endif

View File

@ -25,7 +25,7 @@
CartridgeBUSWidget::CartridgeBUSWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeBUS& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
: CartridgeARMWidget(boss, lfont, nfont, x, y, w, h, cart),
myCart{cart}
{
uInt16 size = 8 * 4096;
@ -186,54 +186,7 @@ CartridgeBUSWidget::CartridgeBUSWidget(
myDigitalSample->setEditable(false);
xpos = 10; ypos += myLineHeight + 4 * 2;
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 ");
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 ");
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 writes of last ARM run.");
addCycleWidgets(xpos, ypos);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -250,8 +203,6 @@ void CartridgeBUSWidget::saveOldState()
myOldState.mwavesizes.clear();
myOldState.internalram.clear();
myOldState.samplepointer.clear();
myOldState.armStats.clear();
myOldState.armPrevStats.clear();
for(uInt32 i = 0; i < 18; ++i)
{
@ -293,17 +244,7 @@ void CartridgeBUSWidget::saveOldState()
myOldState.samplepointer.push_back(myCart.getSample());
myOldState.armStats.push_back(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes);
myOldState.armStats.push_back(myCart.stats().fetches);
myOldState.armStats.push_back(myCart.stats().reads);
myOldState.armStats.push_back(myCart.stats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches);
myOldState.armPrevStats.push_back(myCart.prevStats().reads);
myOldState.armPrevStats.push_back(myCart.prevStats().writes);
CartridgeARMWidget::saveOldState();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -430,39 +371,7 @@ void CartridgeBUSWidget::loadConfig()
mySamplePointer->setCrossed(true);
}
bool isChanged;
isChanged = myCart.prevStats().fetches + myCart.prevStats().reads + myCart.prevStats().writes
!= myOldState.armPrevStats[0];
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().fetches != myOldState.armPrevStats[1];
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().reads != myOldState.armPrevStats[2];
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().writes != myOldState.armPrevStats[3];
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes
!= myOldState.armStats[0];
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches != myOldState.armStats[1];
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().reads != myOldState.armStats[2];
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().writes != myOldState.armStats[3];
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6), isChanged);
CartDebugWidget::loadConfig();
CartridgeARMWidget::loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -476,6 +385,8 @@ void CartridgeBUSWidget::handleCommand(CommandSender* sender,
myCart.lockBank();
invalidate();
}
else
CartridgeARMWidget::handleCommand(sender, cmd, data, id);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -24,9 +24,9 @@ class CheckboxWidget;
class DataGridWidget;
class EditTextWidget;
#include "CartDebugWidget.hxx"
#include "CartARMWidget.hxx"
class CartridgeBUSWidget : public CartDebugWidget
class CartridgeBUSWidget : public CartridgeARMWidget
{
public:
CartridgeBUSWidget(GuiObject* boss, const GUI::Font& lfont,
@ -47,8 +47,6 @@ class CartridgeBUSWidget : public CartDebugWidget
IntArray mwaves;
IntArray mwavesizes;
IntArray samplepointer;
uIntArray armStats;
uIntArray armPrevStats;
uInt32 random{0};
ByteArray internalram;
};
@ -68,14 +66,6 @@ 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};
EditTextWidget* myThumbWrites{nullptr};
std::array<StaticTextWidget*, 6> myDatastreamLabels{nullptr};
CartState myOldState;

View File

@ -15,6 +15,7 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "OSystem.hxx"
#include "DataGridWidget.hxx"
#include "PopUpWidget.hxx"
#include "EditTextWidget.hxx"
@ -24,7 +25,7 @@
CartridgeCDFWidget::CartridgeCDFWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeCDF& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
: CartridgeARMWidget(boss, lfont, nfont, x, y, w, h, cart),
myCart{cart}
{
const int VBORDER = 8;
@ -56,7 +57,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
myLineHeight, items,
"Set bank ", 0, kBankChanged);
myBank->setTarget(this);
//addFocusWidget(myBank);
addFocusWidget(myBank);
// Fast Fetch flag
myFastFetch = new CheckboxWidget(boss, _font, myBank->getRight() + 24, ypos + 1,
@ -69,7 +70,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
// Datastream Pointers
#define DS_X (HBORDER + _font.getStringWidth("xx "))
xpos = DS_X;
ypos += myLineHeight + VGAP * 3;
ypos += myLineHeight + VGAP * 2;
new StaticTextWidget(boss, _font, xpos, ypos, "Datastream Pointers");
myDatastreamPointers = new DataGridWidget(boss, _nfont, DS_X,
@ -136,7 +137,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
Common::Base::Fmt::_16_2_2);
myJumpStreamIncrements->setTarget(this);
myJumpStreamIncrements->setEditable(false);
xpos = HBORDER; ypos += myLineHeight * 11 + VGAP * 3;
xpos = HBORDER; ypos += myLineHeight * 11 + VGAP * 2;
lwidth = _font.getStringWidth("Waveform Sizes ");
@ -201,55 +202,7 @@ CartridgeCDFWidget::CartridgeCDFWidget(
mySamplePointer->setEditable(false);
xpos = HBORDER; ypos += myLineHeight + VGAP * 2;
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 ");
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 ");
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 writes of last ARM run.");
addCycleWidgets(xpos, ypos);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -266,8 +219,6 @@ void CartridgeCDFWidget::saveOldState()
myOldState.mwavesizes.clear();
myOldState.internalram.clear();
myOldState.samplepointer.clear();
myOldState.armStats.clear();
myOldState.armPrevStats.clear();
for(uInt32 i = 0; i < static_cast<uInt32>((isCDFJ() || isCDFJplus()) ? 35 : 34); ++i)
{
@ -300,17 +251,7 @@ void CartridgeCDFWidget::saveOldState()
myOldState.samplepointer.push_back(myCart.getSample());
myOldState.armStats.push_back(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes);
myOldState.armStats.push_back(myCart.stats().fetches);
myOldState.armStats.push_back(myCart.stats().reads);
myOldState.armStats.push_back(myCart.stats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches);
myOldState.armPrevStats.push_back(myCart.prevStats().reads);
myOldState.armPrevStats.push_back(myCart.prevStats().writes);
CartridgeARMWidget::saveOldState();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -442,39 +383,8 @@ void CartridgeCDFWidget::loadConfig()
mySamplePointer->setCrossed(true);
}
bool isChanged;
isChanged = myCart.prevStats().fetches + myCart.prevStats().reads + myCart.prevStats().writes
!= myOldState.armPrevStats[0];
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().fetches != myOldState.armPrevStats[1];
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().reads != myOldState.armPrevStats[2];
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().writes != myOldState.armPrevStats[3];
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes
!= myOldState.armStats[0];
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches != myOldState.armStats[1];
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().reads != myOldState.armStats[2];
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().writes != myOldState.armStats[3];
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6), isChanged);
CartDebugWidget::loadConfig();
// ARM cycles
CartridgeARMWidget::loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -488,6 +398,8 @@ void CartridgeCDFWidget::handleCommand(CommandSender* sender,
myCart.lockBank();
invalidate();
}
else
CartridgeARMWidget::handleCommand(sender, cmd, data, id);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -23,11 +23,12 @@ class CheckboxWidget;
class DataGridWidget;
class StaticTextWidget;
class EditTextWidget;
class SliderWidget;
#include "CartCDF.hxx"
#include "CartDebugWidget.hxx"
#include "CartARMWidget.hxx"
class CartridgeCDFWidget : public CartDebugWidget
class CartridgeCDFWidget : public CartridgeARMWidget
{
public:
CartridgeCDFWidget(GuiObject* boss, const GUI::Font& lfont,
@ -48,8 +49,6 @@ class CartridgeCDFWidget : public CartDebugWidget
IntArray mwaves;
IntArray mwavesizes;
IntArray samplepointer;
uIntArray armStats;
uIntArray armPrevStats;
uInt32 random{0};
ByteArray internalram;
};
@ -72,14 +71,6 @@ 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};
EditTextWidget* myThumbWrites{nullptr};
CartState myOldState;
@ -92,8 +83,8 @@ class CartridgeCDFWidget : public CartDebugWidget
static string describeCDFVersion(CartridgeCDF::CDFSubtype subtype);
void saveOldState() override;
void loadConfig() override;
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
string bankState() override;

View File

@ -25,7 +25,7 @@
CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
GuiObject* boss, const GUI::Font& lfont, const GUI::Font& nfont,
int x, int y, int w, int h, CartridgeDPCPlus& cart)
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
: CartridgeARMWidget(boss, lfont, nfont, x, y, w, h, cart),
myCart{cart}
{
size_t size = cart.mySize;
@ -181,56 +181,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
myIMLDA->setEditable(false);
xpos = 2; ypos += myLineHeight + 4 * 1;
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 ");
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 ");
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 writes of last ARM run.");
addCycleWidgets(xpos, ypos);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -246,8 +197,6 @@ void CartridgeDPCPlusWidget::saveOldState()
myOldState.mfreqs.clear();
myOldState.mwaves.clear();
myOldState.internalram.clear();
myOldState.armStats.clear();
myOldState.armPrevStats.clear();
for(uInt32 i = 0; i < 8; ++i)
{
@ -272,17 +221,7 @@ void CartridgeDPCPlusWidget::saveOldState()
myOldState.bank = myCart.getBank();
myOldState.armStats.push_back(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes);
myOldState.armStats.push_back(myCart.stats().fetches);
myOldState.armStats.push_back(myCart.stats().reads);
myOldState.armStats.push_back(myCart.stats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes);
myOldState.armPrevStats.push_back(myCart.prevStats().fetches);
myOldState.armPrevStats.push_back(myCart.prevStats().reads);
myOldState.armPrevStats.push_back(myCart.prevStats().writes);
CartridgeARMWidget::saveOldState();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -373,39 +312,7 @@ void CartridgeDPCPlusWidget::loadConfig()
myFastFetch->setState(myCart.myFastFetch);
myIMLDA->setState(myCart.myLDAimmediate);
bool isChanged;
isChanged = myCart.prevStats().fetches + myCart.prevStats().reads + myCart.prevStats().writes
!= myOldState.armPrevStats[0];
myPrevThumbMemCycles->setText(Common::Base::toString(myCart.prevStats().fetches
+ myCart.prevStats().reads + myCart.prevStats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().fetches != myOldState.armPrevStats[1];
myPrevThumbFetches->setText(Common::Base::toString(myCart.prevStats().fetches,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().reads != myOldState.armPrevStats[2];
myPrevThumbReads->setText(Common::Base::toString(myCart.prevStats().reads,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.prevStats().writes != myOldState.armPrevStats[3];
myPrevThumbWrites->setText(Common::Base::toString(myCart.prevStats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches + myCart.stats().reads + myCart.stats().writes
!= myOldState.armStats[0];
myThumbMemCycles->setText(Common::Base::toString(myCart.stats().fetches
+ myCart.stats().reads + myCart.stats().writes,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().fetches != myOldState.armStats[1];
myThumbFetches->setText(Common::Base::toString(myCart.stats().fetches,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().reads != myOldState.armStats[2];
myThumbReads->setText(Common::Base::toString(myCart.stats().reads,
Common::Base::Fmt::_10_6), isChanged);
isChanged = myCart.stats().writes != myOldState.armStats[3];
myThumbWrites->setText(Common::Base::toString(myCart.stats().writes,
Common::Base::Fmt::_10_6), isChanged);
CartDebugWidget::loadConfig();
CartridgeARMWidget::loadConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -419,6 +326,8 @@ void CartridgeDPCPlusWidget::handleCommand(CommandSender* sender,
myCart.lockBank();
invalidate();
}
else
CartridgeARMWidget::handleCommand(sender, cmd, data, id);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -24,9 +24,9 @@ class CheckboxWidget;
class DataGridWidget;
class EditTextWidget;
#include "CartDebugWidget.hxx"
#include "CartARMWidget.hxx"
class CartridgeDPCPlusWidget : public CartDebugWidget
class CartridgeDPCPlusWidget : public CartridgeARMWidget
{
public:
CartridgeDPCPlusWidget(GuiObject* boss, const GUI::Font& lfont,
@ -46,8 +46,6 @@ class CartridgeDPCPlusWidget : public CartDebugWidget
IntArray mcounters;
IntArray mfreqs;
IntArray mwaves;
uIntArray armStats;
uIntArray armPrevStats;
uInt32 random{0};
ByteArray internalram;
uInt16 bank{0};
@ -68,14 +66,6 @@ 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};
EditTextWidget* myThumbWrites{nullptr};
CartState myOldState;

View File

@ -251,11 +251,15 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
case Event::MoveRightChar:
if(_currentPos < _promptEndPos)
_currentPos++;
else
handled = false;
break;
case Event::MoveLeftChar:
if(_currentPos > _promptStartPos)
_currentPos--;
else
handled = false;
break;
// scrolling events

View File

@ -14,6 +14,7 @@ MODULE_OBJS := \
src/debugger/gui/Cart4A50Widget.o \
src/debugger/gui/Cart4KSCWidget.o \
src/debugger/gui/Cart4KWidget.o \
src/debugger/gui/CartARMWidget.o \
src/debugger/gui/CartARWidget.o \
src/debugger/gui/CartBFSCWidget.o \
src/debugger/gui/CartBFWidget.o \

92
src/emucore/CartARM.cxx Normal file
View File

@ -0,0 +1,92 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "System.hxx"
#include "Settings.hxx"
#include "CartARM.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeARM::CartridgeARM(const string& md5, const Settings& settings)
: Cartridge(settings, md5)
{
myIncCycles = settings.getBool("dev.settings")
&& settings.getBool("dev.thumb.inccycles");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARM::updateCycles(int cycles)
{
if(myIncCycles)
{
mySystem->incrementCycles(cycles); // * ~1.79 is the limit for ZEVIOUZ title screen (~88,000 cycles)
cerr << cycles << " ";
}
myStats = myThumbEmulator->stats();
myPrevStats = myThumbEmulator->prevStats();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARM::incCycles(bool enable)
{
myIncCycles = enable;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeARM::cycleFactor(double factor)
{
myThumbEmulator->cycleFactor(factor);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeARM::save(Serializer& out) const
{
try
{
out.putInt(myPrevStats.fetches);
out.putInt(myPrevStats.reads);
out.putInt(myPrevStats.writes);
out.putInt(myStats.fetches);
out.putInt(myStats.reads);
out.putInt(myStats.writes);
}
catch(...)
{
cerr << "ERROR: CartridgeARM::save" << endl;
return false;
}
return true;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartridgeARM::load(Serializer& in)
{
try
{
myPrevStats.fetches = in.getInt();
myPrevStats.reads = in.getInt();
myPrevStats.writes = in.getInt();
myStats.fetches = in.getInt();
myStats.reads = in.getInt();
myStats.writes = in.getInt();
}
catch(...)
{
cerr << "ERROR: CartridgeARM::load" << endl;
return false;
}
return true;
}

View File

@ -23,7 +23,6 @@
#include "System.hxx"
#include "M6532.hxx"
#include "TIA.hxx"
#include "Thumbulator.hxx"
#include "CartBUS.hxx"
#include "exception/FatalEmulationError.hxx"
@ -43,7 +42,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
: CartridgeARM(md5, settings),
myImage{make_unique<uInt8[]>(32_KB)}
{
// Copy the ROM image into my buffer
@ -76,8 +75,6 @@ CartridgeBUS::CartridgeBUS(const ByteBuffer& image, size_t size,
Thumbulator::ConfigureFor::BUS,
this);
myIncCycles = devSettings ? settings.getBool("dev.thumb.inccycles") : false,
setInitialState();
}
@ -174,8 +171,7 @@ inline void CartridgeBUS::callFunction(uInt8 value)
myARMCycles = mySystem->cycles();
myThumbEmulator->run(cycles);
if(myIncCycles)
mySystem->incrementCycles(cycles);
updateCycles(cycles);
}
catch(const runtime_error& e) {
if(!mySystem->autodetectMode())
@ -593,6 +589,8 @@ bool CartridgeBUS::save(Serializer& out) const
// Indicates if in the middle of a fast jump
out.putByte(myFastJumpActive);
CartridgeARM::save(out);
}
catch(...)
{
@ -634,6 +632,8 @@ bool CartridgeBUS::load(Serializer& in)
// Indicates if in the middle of a fast jump
myFastJumpActive = in.getByte();
CartridgeARM::load(in);
}
catch(...)
{

View File

@ -19,14 +19,13 @@
#define CARTRIDGE_BUS_HXX
class System;
class Thumbulator;
#ifdef DEBUGGER_SUPPORT
#include "CartBUSWidget.hxx"
#endif
#include "bspf.hxx"
#include "Thumbulator.hxx"
#include "Cart.hxx"
#include "CartARM.hxx"
/**
Cartridge class used for BUS.
@ -41,7 +40,7 @@ class Thumbulator;
@authors: Darrell Spice Jr, Chris Walton, Fred Quimby,
Stephen Anthony, Bradford W. Mott
*/
class CartridgeBUS : public Cartridge
class CartridgeBUS : public CartridgeARM
{
friend class CartridgeBUSWidget;
friend class CartridgeRamBUSWidget;
@ -233,10 +232,6 @@ class CartridgeBUS : public Cartridge
uInt32 getWaveformSize(uInt8 index) const;
uInt32 getSample();
// 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
ByteBuffer myImage;
@ -256,9 +251,6 @@ class CartridgeBUS : public Cartridge
// $1800 - 2K C Variable & Stack
std::array<uInt8, 8_KB> myRAM;
// Pointer to the Thumb ARM emulator object
unique_ptr<Thumbulator> myThumbEmulator;
// Indicates the offset into the ROM image (aligns to current bank)
uInt16 myBankOffset{0};
@ -299,9 +291,6 @@ class CartridgeBUS : public Cartridge
uInt8 myFastJumpActive{false};
// ARM code increases 6507 cycles
bool myIncCycles{false};
private:
// Following constructors and assignment operators not supported
CartridgeBUS() = delete;

View File

@ -24,7 +24,6 @@
#endif
#include "System.hxx"
#include "Thumbulator.hxx"
#include "CartCDF.hxx"
#include "TIA.hxx"
#include "exception/FatalEmulationError.hxx"
@ -65,7 +64,7 @@ namespace {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5)
: CartridgeARM(md5, settings)
{
// Copy the ROM image into my buffer
mySize = std::min(size, 512_KB);
@ -112,8 +111,6 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,
thumulatorConfiguration(myCDFSubtype),
this);
myIncCycles = devSettings ? settings.getBool("dev.thumb.inccycles") : false,
setInitialState();
}
@ -202,8 +199,7 @@ inline void CartridgeCDF::callFunction(uInt8 value)
myARMCycles = mySystem->cycles();
myThumbEmulator->run(cycles);
if(myIncCycles)
mySystem->incrementCycles(cycles); // * ~1.79 is the limit for ZEVIOUZ title screen
updateCycles(cycles);
}
catch(const runtime_error& e) {
if(!mySystem->autodetectMode())
@ -565,6 +561,8 @@ bool CartridgeCDF::save(Serializer& out) const
out.putLong(myAudioCycles);
out.putDouble(myFractionalClocks);
out.putLong(myARMCycles);
CartridgeARM::save(out);
}
catch(...)
{
@ -605,6 +603,8 @@ bool CartridgeCDF::load(Serializer& in)
myAudioCycles = in.getLong();
myFractionalClocks = in.getDouble();
myARMCycles = in.getLong();
CartridgeARM::load(in);
}
catch(...)
{

View File

@ -21,8 +21,7 @@
class System;
#include "bspf.hxx"
#include "Thumbulator.hxx"
#include "Cart.hxx"
#include "CartARM.hxx"
/**
Cartridge class used for CDF/CDFJ/CDFJ+.
@ -52,7 +51,7 @@ class System;
@authors: Darrell Spice Jr, Chris Walton, Fred Quimby, John Champeau
Thomas Jentzsch, Stephen Anthony, Bradford W. Mott
*/
class CartridgeCDF : public Cartridge
class CartridgeCDF : public CartridgeARM
{
friend class CartridgeCDFWidget;
friend class CartridgeCDFInfoWidget;
@ -263,10 +262,6 @@ class CartridgeCDF : public Cartridge
uInt32 getSample();
void setupVersion();
// 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
ByteBuffer myImage{nullptr};
@ -292,9 +287,6 @@ class CartridgeCDF : public Cartridge
// $0800 - Display Data, C Variables & Stack
std::array<uInt8, 32_KB> myRAM;
// Pointer to the Thumb ARM emulator object
unique_ptr<Thumbulator> myThumbEmulator;
// Indicates the offset into the ROM image (aligns to current bank)
uInt16 myBankOffset{0};
@ -369,9 +361,6 @@ class CartridgeCDF : public Cartridge
// CDF subtype
CDFSubtype myCDFSubtype{CDFSubtype::CDF0};
// ARM code increases 6507 cycles
bool myIncCycles{false};
private:
// Following constructors and assignment operators not supported
CartridgeCDF() = delete;

View File

@ -20,7 +20,6 @@
#endif
#include "MD5.hxx"
#include "System.hxx"
#include "Thumbulator.hxx"
#include "CartDPCPlus.hxx"
#include "TIA.hxx"
#include "exception/FatalEmulationError.hxx"
@ -28,7 +27,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
: CartridgeARM(md5, settings),
myImage{make_unique<uInt8[]>(32_KB)},
mySize{std::min(size, 32_KB)}
{
@ -78,8 +77,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size,
myDriverMD5 == "8dd73b44fd11c488326ce507cbeb19d1" )
myFractionalLowMask = 0x0F0000;
myIncCycles = devSettings ? settings.getBool("dev.thumb.inccycles") : false,
setInitialState();
}
@ -207,8 +204,7 @@ inline void CartridgeDPCPlus::callFunction(uInt8 value)
myARMCycles = mySystem->cycles();
myThumbEmulator->run(cycles);
if(myIncCycles)
mySystem->incrementCycles(cycles);
updateCycles(cycles);
}
catch(const runtime_error& e) {
if(!mySystem->autodetectMode())
@ -715,6 +711,8 @@ bool CartridgeDPCPlus::save(Serializer& out) const
// Clock info for Thumbulator
out.putLong(myARMCycles);
CartridgeARM::save(out);
}
catch(...)
{
@ -776,6 +774,8 @@ bool CartridgeDPCPlus::load(Serializer& in)
// Clock info for Thumbulator
myARMCycles = in.getLong();
CartridgeARM::load(in);
}
catch(...)
{

View File

@ -20,13 +20,12 @@
class System;
#include "Thumbulator.hxx"
#ifdef DEBUGGER_SUPPORT
#include "CartDPCPlusWidget.hxx"
#endif
#include "bspf.hxx"
#include "Cart.hxx"
#include "CartARM.hxx"
/**
Cartridge class used for DPC+, derived from Pitfall II. There are six 4K
@ -42,7 +41,7 @@ class System;
@authors Darrell Spice Jr, Fred Quimby, Stephen Anthony, Bradford W. Mott
*/
class CartridgeDPCPlus : public Cartridge
class CartridgeDPCPlus : public CartridgeARM
{
friend class CartridgeDPCPlusWidget;
friend class CartridgeRamDPCPlusWidget;
@ -223,10 +222,6 @@ class CartridgeDPCPlus : public Cartridge
*/
void callFunction(uInt8 value);
// 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
ByteBuffer myImage;
@ -244,9 +239,6 @@ class CartridgeDPCPlus : public Cartridge
// 1K Frequency Data
std::array<uInt8, 8_KB> myDPCRAM;
// Pointer to the Thumb ARM emulator object
unique_ptr<Thumbulator> myThumbEmulator;
// Pointer to the 1K frequency table
uInt8* myFrequencyImage{nullptr};
@ -312,9 +304,6 @@ class CartridgeDPCPlus : public Cartridge
// For current versions, this is 0x0F00FF; older versions need 0x0F0000
uInt32 myFractionalLowMask{0x0F00FF};
// ARM code increases 6507 cycles
bool myIncCycles{false};
private:
// Following constructors and assignment operators not supported
CartridgeDPCPlus() = delete;

View File

@ -104,6 +104,10 @@ class Thumbulator
#endif
#ifndef NO_THUMB_STATS
static void cycleFactor(double factor) { arm_cycle_factor = factor; }
double cycleFactor() const { return arm_cycle_factor; }
#else
static void cycleFactor(double) { }
double cycleFactor() const { return 1.0; }
#endif
/**

View File

@ -5,6 +5,7 @@ MODULE_OBJS := \
src/emucore/Bankswitch.o \
src/emucore/Booster.o \
src/emucore/Cart.o \
src/emucore/CartARM.o \
src/emucore/CartCreator.o \
src/emucore/CartDetector.o \
src/emucore/CartEnhanced.o \

View File

@ -576,6 +576,7 @@
<ClCompile Include="..\debugger\gui\Cart4KWidget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartARMWidget.cxx" />
<ClCompile Include="..\debugger\gui\CartARWidget.cxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClCompile>
@ -737,6 +738,7 @@
<ClCompile Include="..\emucore\Cart3EPlus.cxx" />
<ClCompile Include="..\emucore\Cart3EX.cxx" />
<ClCompile Include="..\emucore\Cart4KSC.cxx" />
<ClCompile Include="..\emucore\CartARM.cxx" />
<ClCompile Include="..\emucore\CartCreator.cxx" />
<ClCompile Include="..\emucore\CartEnhanced.cxx" />
<ClCompile Include="..\emucore\CartBF.cxx" />
@ -1629,6 +1631,7 @@
<ClInclude Include="..\debugger\gui\Cart4KWidget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartARMWidget.hxx" />
<ClInclude Include="..\debugger\gui\CartARWidget.hxx">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug-NoDebugger|x64'">true</ExcludedFromBuild>
</ClInclude>
@ -1801,6 +1804,7 @@
<ClInclude Include="..\emucore\Cart3EPlus.hxx" />
<ClInclude Include="..\emucore\Cart3EX.hxx" />
<ClInclude Include="..\emucore\Cart4KSC.hxx" />
<ClInclude Include="..\emucore\CartARM.hxx" />
<ClInclude Include="..\emucore\CartCreator.hxx" />
<ClInclude Include="..\emucore\CartEnhanced.hxx" />
<ClInclude Include="..\emucore\CartBF.hxx" />

View File

@ -1110,6 +1110,12 @@
<ClCompile Include="..\common\repository\CompositeKeyValueRepository.cxx">
<Filter>Source Files\repository</Filter>
</ClCompile>
<ClCompile Include="..\emucore\CartARM.cxx">
<Filter>Source Files\emucore</Filter>
</ClCompile>
<ClCompile Include="..\debugger\gui\CartARMWidget.cxx">
<Filter>Source Files\debugger</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\bspf.hxx">
@ -2282,6 +2288,12 @@
<ClInclude Include="..\emucore\OSystemStandalone.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\emucore\CartARM.hxx">
<Filter>Header Files\emucore</Filter>
</ClInclude>
<ClInclude Include="..\debugger\gui\CartARMWidget.hxx">
<Filter>Header Files\debugger</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="stella.ico">