2021-06-14 14:24:42 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// 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)
|
2021-06-15 15:31:08 +00:00
|
|
|
mySystem->incrementCycles(cycles); // * ~1.11 is the limit for ZEVIOUZ title screen (~142,000 cycles)
|
2021-06-14 14:24:42 +00:00
|
|
|
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
|
|
|
|
{
|
2021-06-16 10:39:58 +00:00
|
|
|
out.putInt(myPrevStats.cycles);
|
2021-06-14 14:24:42 +00:00
|
|
|
out.putInt(myPrevStats.fetches);
|
|
|
|
out.putInt(myPrevStats.reads);
|
|
|
|
out.putInt(myPrevStats.writes);
|
2021-06-16 10:39:58 +00:00
|
|
|
out.putInt(myStats.cycles);
|
2021-06-14 14:24:42 +00:00
|
|
|
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
|
|
|
|
{
|
2021-06-16 10:39:58 +00:00
|
|
|
myPrevStats.cycles = in.getInt();
|
2021-06-14 14:24:42 +00:00
|
|
|
myPrevStats.fetches = in.getInt();
|
|
|
|
myPrevStats.reads = in.getInt();
|
|
|
|
myPrevStats.writes = in.getInt();
|
2021-06-16 10:39:58 +00:00
|
|
|
myStats.cycles = in.getInt();
|
2021-06-14 14:24:42 +00:00
|
|
|
myStats.fetches = in.getInt();
|
|
|
|
myStats.reads = in.getInt();
|
|
|
|
myStats.writes = in.getInt();
|
|
|
|
}
|
|
|
|
catch(...)
|
|
|
|
{
|
|
|
|
cerr << "ERROR: CartridgeARM::load" << endl;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|