mirror of https://github.com/stella-emu/stella.git
Fix and hook up speed setting.
This commit is contained in:
parent
22af25e77c
commit
91044b3b4f
|
@ -125,6 +125,7 @@ void DevSettingsHandler::saveSettings(SettingsSet set)
|
||||||
#endif
|
#endif
|
||||||
// Thumb ARM emulation exception
|
// Thumb ARM emulation exception
|
||||||
settings.setValue("dev.thumb.trapfatal", myThumbException[set]);
|
settings.setValue("dev.thumb.trapfatal", myThumbException[set]);
|
||||||
|
settings.setValue("dev.arm.mips", myArmSpeed[set]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// AtariVox/SaveKey/PlusROM access
|
// AtariVox/SaveKey/PlusROM access
|
||||||
|
|
|
@ -203,7 +203,21 @@ namespace {
|
||||||
default:
|
default:
|
||||||
throw runtime_error("invalid system type");
|
throw runtime_error("invalid system type");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uInt32 get6502SpeedHz(ConsoleTiming timing) {
|
||||||
|
switch (timing) {
|
||||||
|
case ConsoleTiming::ntsc:
|
||||||
|
return 262 * 76 * 60;
|
||||||
|
|
||||||
|
case ConsoleTiming::pal:
|
||||||
|
case ConsoleTiming::secam:
|
||||||
|
return 312 * 76 * 50;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw runtime_error("invalid console timing");
|
||||||
|
}
|
||||||
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -232,11 +246,15 @@ void CartridgeELF::reset()
|
||||||
{
|
{
|
||||||
const bool devMode = mySettings.getBool("dev.settings");
|
const bool devMode = mySettings.getBool("dev.settings");
|
||||||
const bool strictMode = devMode && mySettings.getBool("dev.thumb.trapfatal");
|
const bool strictMode = devMode && mySettings.getBool("dev.thumb.trapfatal");
|
||||||
|
const uInt32 mips = devMode ? mySettings.getInt("dev.arm.mips") : MIPS_MAX;
|
||||||
|
|
||||||
std::fill_n(myLastPeekResult.get(), 0x1000, 0);
|
std::fill_n(myLastPeekResult.get(), 0x1000, 0);
|
||||||
myIsBusDriven = false;
|
myIsBusDriven = false;
|
||||||
myDriveBusValue = 0;
|
myDriveBusValue = 0;
|
||||||
myArmCyclesOffset = 0;
|
myArmCyclesOffset = 0;
|
||||||
|
myArmCyclesPer6502Cycle = (mips * 1000000) / get6502SpeedHz(myConsoleTiming);
|
||||||
|
|
||||||
|
cout << myArmCyclesPer6502Cycle << std::endl;
|
||||||
|
|
||||||
mySystemType = determineSystemType(myProperties);
|
mySystemType = determineSystemType(myProperties);
|
||||||
myLinker->relink(externalSymbols(mySystemType));
|
myLinker->relink(externalSymbols(mySystemType));
|
||||||
|
@ -530,22 +548,6 @@ void CartridgeELF::setupMemoryMap(bool strictMode)
|
||||||
myFallbackDelegate.setErrorsAreFatal(strictMode);
|
myFallbackDelegate.setErrorsAreFatal(strictMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
uInt32 CartridgeELF::getCoreClock() const
|
|
||||||
{
|
|
||||||
switch (myConsoleTiming) {
|
|
||||||
case ConsoleTiming::ntsc:
|
|
||||||
return myArmCyclesPer6502Cycle * 262 * 76 * 60;
|
|
||||||
|
|
||||||
case ConsoleTiming::pal:
|
|
||||||
case ConsoleTiming::secam:
|
|
||||||
return myArmCyclesPer6502Cycle * 312 * 76 * 50;
|
|
||||||
|
|
||||||
default:
|
|
||||||
throw runtime_error("invalid console timing");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CartridgeELF::switchExecutionStage()
|
void CartridgeELF::switchExecutionStage()
|
||||||
{
|
{
|
||||||
|
@ -603,7 +605,7 @@ void CartridgeELF::callMain()
|
||||||
err |= myCortexEmu.write32(sp, 0);
|
err |= myCortexEmu.write32(sp, 0);
|
||||||
|
|
||||||
sp -= 4;
|
sp -= 4;
|
||||||
err |= myCortexEmu.write32(sp, getCoreClock());
|
err |= myCortexEmu.write32(sp, myArmCyclesPer6502Cycle * get6502SpeedHz(myConsoleTiming));
|
||||||
|
|
||||||
sp -= 4;
|
sp -= 4;
|
||||||
err |= myCortexEmu.write32(sp, getSystemTypeParam(mySystemType));
|
err |= myCortexEmu.write32(sp, getSystemTypeParam(mySystemType));
|
||||||
|
|
|
@ -29,6 +29,10 @@
|
||||||
class ElfLinker;
|
class ElfLinker;
|
||||||
|
|
||||||
class CartridgeELF: public Cartridge {
|
class CartridgeELF: public Cartridge {
|
||||||
|
public:
|
||||||
|
static constexpr uInt32 MIPS_MAX = 300;
|
||||||
|
static constexpr uInt32 MIPS_MIN = 50;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CartridgeELF(const ByteBuffer& image, size_t size, string_view md5,
|
CartridgeELF(const ByteBuffer& image, size_t size, string_view md5,
|
||||||
const Settings& settings);
|
const Settings& settings);
|
||||||
|
@ -102,8 +106,6 @@ class CartridgeELF: public Cartridge {
|
||||||
void allocationSections();
|
void allocationSections();
|
||||||
void setupMemoryMap(bool strictMode);
|
void setupMemoryMap(bool strictMode);
|
||||||
|
|
||||||
uInt32 getCoreClock() const;
|
|
||||||
|
|
||||||
void switchExecutionStage();
|
void switchExecutionStage();
|
||||||
void callFn(uInt32 ptr, uInt32 sp);
|
void callFn(uInt32 ptr, uInt32 sp);
|
||||||
void callMain();
|
void callMain();
|
||||||
|
@ -138,7 +140,7 @@ class CartridgeELF: public Cartridge {
|
||||||
BusFallbackDelegate myFallbackDelegate;
|
BusFallbackDelegate myFallbackDelegate;
|
||||||
|
|
||||||
ConsoleTiming myConsoleTiming{ConsoleTiming::ntsc};
|
ConsoleTiming myConsoleTiming{ConsoleTiming::ntsc};
|
||||||
uInt32 myArmCyclesPer6502Cycle{160};
|
uInt32 myArmCyclesPer6502Cycle{100};
|
||||||
|
|
||||||
Int64 myArmCyclesOffset{0};
|
Int64 myArmCyclesOffset{0};
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "StateManager.hxx"
|
#include "StateManager.hxx"
|
||||||
#include "RewindManager.hxx"
|
#include "RewindManager.hxx"
|
||||||
#include "M6502.hxx"
|
#include "M6502.hxx"
|
||||||
|
#include "CartELF.hxx"
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
#include "DebuggerDialog.hxx"
|
#include "DebuggerDialog.hxx"
|
||||||
|
@ -224,10 +225,10 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
|
||||||
ypos += lineHeight + VGAP;
|
ypos += lineHeight + VGAP;
|
||||||
|
|
||||||
myArmSpeedWidget = new SliderWidget(myTab, font, HBORDER + INDENT * 1, ypos - 1,
|
myArmSpeedWidget = new SliderWidget(myTab, font, HBORDER + INDENT * 1, ypos - 1,
|
||||||
fontWidth * 10, lineHeight, "Limit ARM speed ",
|
fontWidth * 10, lineHeight, "Limit ARM speed ",
|
||||||
0, kArmSpeedChanged, fontWidth * 9, " MIPS");
|
0, kArmSpeedChanged, fontWidth * 9, " MIPS");
|
||||||
myArmSpeedWidget->setMinValue(50); // TODO: use constant
|
myArmSpeedWidget->setMinValue(CartridgeELF::MIPS_MIN); // TODO: use constant
|
||||||
myArmSpeedWidget->setMaxValue(250); // TODO: use constant
|
myArmSpeedWidget->setMaxValue(CartridgeELF::MIPS_MAX); // TODO: use constant
|
||||||
myArmSpeedWidget->setTickmarkIntervals(4);
|
myArmSpeedWidget->setTickmarkIntervals(4);
|
||||||
myArmSpeedWidget->setStepValue(2);
|
myArmSpeedWidget->setStepValue(2);
|
||||||
myArmSpeedWidget->setToolTip("Limit emulation speed to simulate ARM CPU used.");
|
myArmSpeedWidget->setToolTip("Limit emulation speed to simulate ARM CPU used.");
|
||||||
|
|
Loading…
Reference in New Issue