mirror of https://github.com/stella-emu/stella.git
accelerated emulation by using forced inlines
This commit is contained in:
parent
38e8121b10
commit
025de6e8e9
|
@ -28,6 +28,8 @@
|
||||||
|
|
||||||
* Enhanced Kid Vid support to play tape audio
|
* Enhanced Kid Vid support to play tape audio
|
||||||
|
|
||||||
|
* Acclerated emulation up to ~15% (ARM).
|
||||||
|
|
||||||
* Added BUS bankswitching support for some older demos
|
* Added BUS bankswitching support for some older demos
|
||||||
|
|
||||||
* Fixed broken 7800 pause key support
|
* Fixed broken 7800 pause key support
|
||||||
|
|
|
@ -98,7 +98,7 @@ class FBBackendSDL2 : public FBBackend
|
||||||
@param g The green component of the color
|
@param g The green component of the color
|
||||||
@param b The blue component of the color
|
@param b The blue component of the color
|
||||||
*/
|
*/
|
||||||
inline void getRGB(uInt32 pixel, uInt8* r, uInt8* g, uInt8* b) const override
|
FORCE_INLINE void getRGB(uInt32 pixel, uInt8* r, uInt8* g, uInt8* b) const override
|
||||||
{ SDL_GetRGB(pixel, myPixelFormat, r, g, b); }
|
{ SDL_GetRGB(pixel, myPixelFormat, r, g, b); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -179,7 +179,7 @@ void LanczosResampler::fillFragment(float* fragment, uInt32 length)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void LanczosResampler::shiftSamples(uInt32 samplesToShift)
|
FORCE_INLINE void LanczosResampler::shiftSamples(uInt32 samplesToShift)
|
||||||
{
|
{
|
||||||
while (samplesToShift-- > 0) {
|
while (samplesToShift-- > 0) {
|
||||||
if (myFormatFrom.stereo) {
|
if (myFormatFrom.stereo) {
|
||||||
|
|
|
@ -172,7 +172,7 @@ void CartridgeCDF::install(System& system)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void CartridgeCDF::updateMusicModeDataFetchers()
|
FORCE_INLINE void CartridgeCDF::updateMusicModeDataFetchers()
|
||||||
{
|
{
|
||||||
// Calculate the number of cycles since the last update
|
// Calculate the number of cycles since the last update
|
||||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||||
|
|
|
@ -585,7 +585,7 @@ void CartridgeCTY::wipeAllScores()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void CartridgeCTY::updateMusicModeDataFetchers()
|
FORCE_INLINE void CartridgeCTY::updateMusicModeDataFetchers()
|
||||||
{
|
{
|
||||||
// Calculate the number of cycles since the last update
|
// Calculate the number of cycles since the last update
|
||||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||||
|
|
|
@ -73,7 +73,7 @@ void CartridgeDPC::install(System& system)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void CartridgeDPC::clockRandomNumberGenerator()
|
FORCE_INLINE void CartridgeDPC::clockRandomNumberGenerator()
|
||||||
{
|
{
|
||||||
// Table for computing the input bit of the random number generator's
|
// Table for computing the input bit of the random number generator's
|
||||||
// shift register (it's the NOT of the EOR of four bits)
|
// shift register (it's the NOT of the EOR of four bits)
|
||||||
|
@ -91,7 +91,7 @@ inline void CartridgeDPC::clockRandomNumberGenerator()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void CartridgeDPC::updateMusicModeDataFetchers()
|
FORCE_INLINE void CartridgeDPC::updateMusicModeDataFetchers()
|
||||||
{
|
{
|
||||||
// Calculate the number of cycles since the last update
|
// Calculate the number of cycles since the last update
|
||||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||||
|
|
|
@ -145,7 +145,7 @@ void CartridgeDPCPlus::install(System& system)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void CartridgeDPCPlus::clockRandomNumberGenerator()
|
FORCE_INLINE void CartridgeDPCPlus::clockRandomNumberGenerator()
|
||||||
{
|
{
|
||||||
// Update random number generator (32-bit LFSR)
|
// Update random number generator (32-bit LFSR)
|
||||||
myRandomNumber = ((myRandomNumber & (1<<10)) ? 0x10adab1e: 0x00) ^
|
myRandomNumber = ((myRandomNumber & (1<<10)) ? 0x10adab1e: 0x00) ^
|
||||||
|
@ -153,7 +153,7 @@ inline void CartridgeDPCPlus::clockRandomNumberGenerator()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void CartridgeDPCPlus::priorClockRandomNumberGenerator()
|
FORCE_INLINE void CartridgeDPCPlus::priorClockRandomNumberGenerator()
|
||||||
{
|
{
|
||||||
// Update random number generator (32-bit LFSR, reversed)
|
// Update random number generator (32-bit LFSR, reversed)
|
||||||
myRandomNumber = ((myRandomNumber & (1U<<31)) ?
|
myRandomNumber = ((myRandomNumber & (1U<<31)) ?
|
||||||
|
@ -162,7 +162,7 @@ inline void CartridgeDPCPlus::priorClockRandomNumberGenerator()
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline void CartridgeDPCPlus::updateMusicModeDataFetchers()
|
FORCE_INLINE void CartridgeDPCPlus::updateMusicModeDataFetchers()
|
||||||
{
|
{
|
||||||
// Calculate the number of cycles since the last update
|
// Calculate the number of cycles since the last update
|
||||||
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);
|
||||||
|
|
|
@ -237,7 +237,7 @@ string Thumbulator::run(uInt32& cycles, bool irqDrivenAudio)
|
||||||
|
|
||||||
#ifndef UNSAFE_OPTIMIZATIONS
|
#ifndef UNSAFE_OPTIMIZATIONS
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline int Thumbulator::fatalError(const char* opcode, uInt32 v1, const char* msg)
|
int Thumbulator::fatalError(const char* opcode, uInt32 v1, const char* msg)
|
||||||
{
|
{
|
||||||
statusMsg << "Thumb ARM emulation fatal error: " << endl
|
statusMsg << "Thumb ARM emulation fatal error: " << endl
|
||||||
<< opcode << "(" << Base::HEX8 << v1 << "), " << msg << endl;
|
<< opcode << "(" << Base::HEX8 << v1 << "), " << msg << endl;
|
||||||
|
@ -248,7 +248,7 @@ inline int Thumbulator::fatalError(const char* opcode, uInt32 v1, const char* ms
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline int Thumbulator::fatalError(const char* opcode, uInt32 v1, uInt32 v2,
|
int Thumbulator::fatalError(const char* opcode, uInt32 v1, uInt32 v2,
|
||||||
const char* msg)
|
const char* msg)
|
||||||
{
|
{
|
||||||
statusMsg << "Thumb ARM emulation fatal error: " << endl
|
statusMsg << "Thumb ARM emulation fatal error: " << endl
|
||||||
|
@ -777,7 +777,7 @@ uInt32 Thumbulator::read32(uInt32 addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
uInt32 Thumbulator::read_register(uInt32 reg)
|
FORCE_INLINE uInt32 Thumbulator::read_register(uInt32 reg)
|
||||||
{
|
{
|
||||||
reg &= 0xF;
|
reg &= 0xF;
|
||||||
|
|
||||||
|
@ -789,15 +789,15 @@ uInt32 Thumbulator::read_register(uInt32 reg)
|
||||||
if(data & 1)
|
if(data & 1)
|
||||||
{
|
{
|
||||||
DO_DBUG(statusMsg << "pc has lsbit set 0x" << Base::HEX8 << data << endl);
|
DO_DBUG(statusMsg << "pc has lsbit set 0x" << Base::HEX8 << data << endl);
|
||||||
|
data &= ~1;
|
||||||
}
|
}
|
||||||
data &= ~1;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Thumbulator::write_register(uInt32 reg, uInt32 data, bool isFlowBreak)
|
FORCE_INLINE void Thumbulator::write_register(uInt32 reg, uInt32 data, bool isFlowBreak)
|
||||||
{
|
{
|
||||||
reg &= 0xF;
|
reg &= 0xF;
|
||||||
|
|
||||||
|
@ -827,12 +827,14 @@ void Thumbulator::do_cvflag(uInt32 a, uInt32 b, uInt32 c)
|
||||||
{
|
{
|
||||||
uInt32 rc = (a & 0x7FFFFFFF) + (b & 0x7FFFFFFF) + c; //carry in
|
uInt32 rc = (a & 0x7FFFFFFF) + (b & 0x7FFFFFFF) + c; //carry in
|
||||||
rc >>= 31; //carry in in lsbit
|
rc >>= 31; //carry in in lsbit
|
||||||
uInt32 rd = (rc & 1) + ((a >> 31) & 1) + ((b >> 31) & 1); //carry out
|
a >>= 31;
|
||||||
|
b >>= 31;
|
||||||
|
uInt32 rd = (rc & 1) + (a & 1) + (b & 1); //carry out
|
||||||
rd >>= 1; //carry out in lsbit
|
rd >>= 1; //carry out in lsbit
|
||||||
|
|
||||||
vFlag = (rc ^ rd) & 1; //if carry in != carry out then signed overflow
|
vFlag = (rc ^ rd) & 1; //if carry in != carry out then signed overflow
|
||||||
|
|
||||||
rc += (a >> 31) + (b >> 31); //carry out
|
rc += a + b; //carry out
|
||||||
cFlag = rc & 2;
|
cFlag = rc & 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Cartridge;
|
||||||
#ifdef DEBUGGER_SUPPORT
|
#ifdef DEBUGGER_SUPPORT
|
||||||
#define THUMB_CYCLE_COUNT
|
#define THUMB_CYCLE_COUNT
|
||||||
#define COUNT_OPS
|
#define COUNT_OPS
|
||||||
#define THUMB_STATS
|
//#define THUMB_STATS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef THUMB_CYCLE_COUNT
|
#ifdef THUMB_CYCLE_COUNT
|
||||||
|
|
|
@ -167,12 +167,12 @@ class Ball : public Serializable
|
||||||
/**
|
/**
|
||||||
Process a single movement tick. Inline for performance (implementation below).
|
Process a single movement tick. Inline for performance (implementation below).
|
||||||
*/
|
*/
|
||||||
inline void movementTick(uInt32 clock, bool hblank);
|
FORCE_INLINE void movementTick(uInt32 clock, bool hblank);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Tick one color clock. Inline for performance (implementation below).
|
Tick one color clock. Inline for performance (implementation below).
|
||||||
*/
|
*/
|
||||||
inline void tick(bool isReceivingRegularClock = true);
|
FORCE_INLINE void tick(bool isReceivingRegularClock = true);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,9 @@ class Missile : public Serializable
|
||||||
bool save(Serializer& out) const override;
|
bool save(Serializer& out) const override;
|
||||||
bool load(Serializer& in) override;
|
bool load(Serializer& in) override;
|
||||||
|
|
||||||
inline void movementTick(uInt8 clock, uInt8 hclock, bool hblank);
|
FORCE_INLINE void movementTick(uInt8 clock, uInt8 hclock, bool hblank);
|
||||||
|
|
||||||
inline void tick(uInt8 hclock, bool isReceivingMclock = true);
|
FORCE_INLINE void tick(uInt8 hclock, bool isReceivingMclock = true);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,9 @@ class Player : public Serializable
|
||||||
bool save(Serializer& out) const override;
|
bool save(Serializer& out) const override;
|
||||||
bool load(Serializer& in) override;
|
bool load(Serializer& in) override;
|
||||||
|
|
||||||
inline void movementTick(uInt32 clock, bool hblank);
|
FORCE_INLINE void movementTick(uInt32 clock, bool hblank);
|
||||||
|
|
||||||
inline void tick();
|
FORCE_INLINE void tick();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ class Playfield : public Serializable
|
||||||
/**
|
/**
|
||||||
Tick one color clock. Inline for performance (implementation below).
|
Tick one color clock. Inline for performance (implementation below).
|
||||||
*/
|
*/
|
||||||
inline void tick(uInt32 x);
|
FORCE_INLINE void tick(uInt32 x);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue