mirror of https://github.com/stella-emu/stella.git
Improve timing emulation, bump ARM MIPS to 190 for now.
This commit is contained in:
parent
a3899278a5
commit
7085cea510
|
@ -340,7 +340,7 @@ inline uInt64 CartridgeELF::getArmCycles() const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline uInt8 CartridgeELF::driveBus(uInt16 address, uInt8 value)
|
inline uInt8 CartridgeELF::driveBus(uInt16 address, uInt8 value)
|
||||||
{
|
{
|
||||||
auto* nextTransaction = myTransactionQueue.getNextTransaction(address);
|
auto* nextTransaction = myTransactionQueue.getNextTransaction(address, getArmCycles());
|
||||||
if (nextTransaction) {
|
if (nextTransaction) {
|
||||||
nextTransaction->setBusState(myIsBusDriven, myDriveBusValue);
|
nextTransaction->setBusState(myIsBusDriven, myDriveBusValue);
|
||||||
syncClock(*nextTransaction);
|
syncClock(*nextTransaction);
|
||||||
|
@ -361,9 +361,6 @@ inline void CartridgeELF::syncClock(const BusTransactionQueue::Transaction& tran
|
||||||
const Int64 transactionArmCycles = transaction.timestamp + myArmCyclesOffset;
|
const Int64 transactionArmCycles = transaction.timestamp + myArmCyclesOffset;
|
||||||
|
|
||||||
myArmCyclesOffset += currentSystemArmCycles - transactionArmCycles;
|
myArmCyclesOffset += currentSystemArmCycles - transactionArmCycles;
|
||||||
|
|
||||||
if (transactionArmCycles > currentSystemArmCycles)
|
|
||||||
Logger::error("ARM took too many cycles between bus transitions");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -120,7 +120,7 @@ class CartridgeELF: public Cartridge {
|
||||||
BusFallbackDelegate myFallbackDelegate;
|
BusFallbackDelegate myFallbackDelegate;
|
||||||
|
|
||||||
ConsoleTiming myConsoleTiming{ConsoleTiming::ntsc};
|
ConsoleTiming myConsoleTiming{ConsoleTiming::ntsc};
|
||||||
uInt32 myArmCyclesPer6502Cycle{140};
|
uInt32 myArmCyclesPer6502Cycle{160};
|
||||||
|
|
||||||
Int64 myArmCyclesOffset{0};
|
Int64 myArmCyclesOffset{0};
|
||||||
|
|
||||||
|
|
|
@ -124,12 +124,12 @@ bool BusTransactionQueue::hasPendingTransaction() const
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
BusTransactionQueue::Transaction* BusTransactionQueue::getNextTransaction(uInt16 address)
|
BusTransactionQueue::Transaction* BusTransactionQueue::getNextTransaction(uInt16 address, uInt64 timestamp)
|
||||||
{
|
{
|
||||||
if (myQueueSize == 0) return nullptr;
|
if (myQueueSize == 0) return nullptr;
|
||||||
|
|
||||||
Transaction* nextTransaction = &myQueue[myQueueNext];
|
Transaction* nextTransaction = &myQueue[myQueueNext];
|
||||||
if (nextTransaction->address != (address & 0x1fff)) return nullptr;
|
if (nextTransaction->address != (address & 0x1fff) || nextTransaction->timestamp > timestamp) return nullptr;
|
||||||
|
|
||||||
myQueueNext = (myQueueNext + 1) % myQueueCapacity;
|
myQueueNext = (myQueueNext + 1) % myQueueCapacity;
|
||||||
myQueueSize--;
|
myQueueSize--;
|
||||||
|
|
|
@ -50,7 +50,7 @@ class BusTransactionQueue {
|
||||||
BusTransactionQueue& yield(uInt16 address);
|
BusTransactionQueue& yield(uInt16 address);
|
||||||
|
|
||||||
bool hasPendingTransaction() const;
|
bool hasPendingTransaction() const;
|
||||||
Transaction* getNextTransaction(uInt16 address);
|
Transaction* getNextTransaction(uInt16 address, uInt64 timestamp);
|
||||||
|
|
||||||
inline size_t size() const {
|
inline size_t size() const {
|
||||||
return myQueueSize;
|
return myQueueSize;
|
||||||
|
|
Loading…
Reference in New Issue