diff --git a/Changes.txt b/Changes.txt index 5de2d0194..527716690 100644 --- a/Changes.txt +++ b/Changes.txt @@ -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 diff --git a/src/common/FBBackendSDL2.hxx b/src/common/FBBackendSDL2.hxx index 780592fa2..80a5d4d03 100644 --- a/src/common/FBBackendSDL2.hxx +++ b/src/common/FBBackendSDL2.hxx @@ -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); } /** diff --git a/src/common/audio/LanczosResampler.cxx b/src/common/audio/LanczosResampler.cxx index 4134fefce..d87ae4493 100644 --- a/src/common/audio/LanczosResampler.cxx +++ b/src/common/audio/LanczosResampler.cxx @@ -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) { diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index 2033f741e..f4f3127eb 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -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(mySystem->cycles() - myAudioCycles); diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index d6bbd2fe6..19e97ee19 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -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(mySystem->cycles() - myAudioCycles); diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index b72c67903..aea18931a 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -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(mySystem->cycles() - myAudioCycles); diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 6c5ad8dfb..9916496d6 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -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(mySystem->cycles() - myAudioCycles); diff --git a/src/emucore/Thumbulator.cxx b/src/emucore/Thumbulator.cxx index 55b429cb5..87cddfd06 100644 --- a/src/emucore/Thumbulator.cxx +++ b/src/emucore/Thumbulator.cxx @@ -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; } diff --git a/src/emucore/Thumbulator.hxx b/src/emucore/Thumbulator.hxx index 3e9ef9377..02e954328 100644 --- a/src/emucore/Thumbulator.hxx +++ b/src/emucore/Thumbulator.hxx @@ -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 diff --git a/src/emucore/tia/Ball.hxx b/src/emucore/tia/Ball.hxx index 822e6f104..6c258500d 100644 --- a/src/emucore/tia/Ball.hxx +++ b/src/emucore/tia/Ball.hxx @@ -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: diff --git a/src/emucore/tia/Missile.hxx b/src/emucore/tia/Missile.hxx index f0f6bcb1c..8e256a685 100644 --- a/src/emucore/tia/Missile.hxx +++ b/src/emucore/tia/Missile.hxx @@ -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: diff --git a/src/emucore/tia/Player.hxx b/src/emucore/tia/Player.hxx index cbff8968e..9d2b0cc1a 100644 --- a/src/emucore/tia/Player.hxx +++ b/src/emucore/tia/Player.hxx @@ -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: diff --git a/src/emucore/tia/Playfield.hxx b/src/emucore/tia/Playfield.hxx index a060cbc6e..bc382a629 100644 --- a/src/emucore/tia/Playfield.hxx +++ b/src/emucore/tia/Playfield.hxx @@ -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: