From 52c51b525f09e939d06470a44841b6e4c2a8eeff Mon Sep 17 00:00:00 2001 From: Christian Speckner Date: Tue, 30 Jul 2024 08:22:48 +0200 Subject: [PATCH] Timing improvements. --- src/emucore/CartELF.cxx | 13 +++---------- src/emucore/CartELF.hxx | 1 - 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/emucore/CartELF.cxx b/src/emucore/CartELF.cxx index d6ec51b61..8613956ac 100644 --- a/src/emucore/CartELF.cxx +++ b/src/emucore/CartELF.cxx @@ -340,10 +340,11 @@ inline uInt64 CartridgeELF::getArmCycles() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - inline uInt8 CartridgeELF::driveBus(uInt16 address, uInt8 value) { - auto* nextTransaction = myTransactionQueue.getNextTransaction(address, getArmCycles()); + auto* nextTransaction = myTransactionQueue.getNextTransaction(address, + mySystem->cycles() * myArmCyclesPer6502Cycle - myArmCyclesOffset); if (nextTransaction) { nextTransaction->setBusState(myIsBusDriven, myDriveBusValue); - syncClock(*nextTransaction); + myArmCyclesOffset = mySystem->cycles() * myArmCyclesPer6502Cycle - nextTransaction->timestamp; } if (myIsBusDriven) value |= myDriveBusValue; @@ -355,14 +356,6 @@ inline uInt8 CartridgeELF::driveBus(uInt16 address, uInt8 value) return value; } -inline void CartridgeELF::syncClock(const BusTransactionQueue::Transaction& transaction) -{ - const Int64 currentSystemArmCycles = mySystem->cycles() * myArmCyclesPer6502Cycle; - const Int64 transactionArmCycles = transaction.timestamp + myArmCyclesOffset; - - myArmCyclesOffset += currentSystemArmCycles - transactionArmCycles; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CartridgeELF::parseAndLinkElf() { diff --git a/src/emucore/CartELF.hxx b/src/emucore/CartELF.hxx index 1ac58242b..91acd8021 100644 --- a/src/emucore/CartELF.hxx +++ b/src/emucore/CartELF.hxx @@ -79,7 +79,6 @@ class CartridgeELF: public Cartridge { uInt64 getArmCycles() const; uInt8 driveBus(uInt16 address, uInt8 value); - void syncClock(const BusTransactionQueue::Transaction& transaction); void parseAndLinkElf(); void setupMemoryMap();