accelerated emulation by using forced inlines

This commit is contained in:
Thomas Jentzsch 2022-11-29 10:53:31 +01:00
parent 38e8121b10
commit 025de6e8e9
13 changed files with 28 additions and 24 deletions

View File

@ -28,6 +28,8 @@
* Enhanced Kid Vid support to play tape audio
* Acclerated emulation up to ~15% (ARM).
* Added BUS bankswitching support for some older demos
* Fixed broken 7800 pause key support

View File

@ -98,7 +98,7 @@ class FBBackendSDL2 : public FBBackend
@param g The green 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); }
/**

View File

@ -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) {
if (myFormatFrom.stereo) {

View File

@ -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
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);

View File

@ -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
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);

View File

@ -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
// 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
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);

View File

@ -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)
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)
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
const auto cycles = static_cast<uInt32>(mySystem->cycles() - myAudioCycles);

View File

@ -237,7 +237,7 @@ string Thumbulator::run(uInt32& cycles, bool irqDrivenAudio)
#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
<< 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)
{
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;
@ -789,15 +789,15 @@ uInt32 Thumbulator::read_register(uInt32 reg)
if(data & 1)
{
DO_DBUG(statusMsg << "pc has lsbit set 0x" << Base::HEX8 << data << endl);
data &= ~1;
}
data &= ~1;
}
#endif
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;
@ -827,12 +827,14 @@ void Thumbulator::do_cvflag(uInt32 a, uInt32 b, uInt32 c)
{
uInt32 rc = (a & 0x7FFFFFFF) + (b & 0x7FFFFFFF) + c; //carry in
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
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;
}

View File

@ -48,7 +48,7 @@ class Cartridge;
#ifdef DEBUGGER_SUPPORT
#define THUMB_CYCLE_COUNT
#define COUNT_OPS
#define THUMB_STATS
//#define THUMB_STATS
#endif
#ifdef THUMB_CYCLE_COUNT

View File

@ -167,12 +167,12 @@ class Ball : public Serializable
/**
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).
*/
inline void tick(bool isReceivingRegularClock = true);
FORCE_INLINE void tick(bool isReceivingRegularClock = true);
public:

View File

@ -76,9 +76,9 @@ class Missile : public Serializable
bool save(Serializer& out) const 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:

View File

@ -87,9 +87,9 @@ class Player : public Serializable
bool save(Serializer& out) const 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:

View File

@ -134,7 +134,7 @@ class Playfield : public Serializable
/**
Tick one color clock. Inline for performance (implementation below).
*/
inline void tick(uInt32 x);
FORCE_INLINE void tick(uInt32 x);
public: