Timing improvements.

This commit is contained in:
Christian Speckner 2024-07-30 08:22:48 +02:00
parent 7085cea510
commit 49b1b9f258
2 changed files with 3 additions and 11 deletions

View File

@ -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()
{

View File

@ -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();