mirror of https://github.com/stella-emu/stella.git
Fix delay queue, add delay to pfx writes.
This commit is contained in:
parent
cdafe8d0a4
commit
c8dc5e2db9
|
@ -29,8 +29,7 @@ DelayQueue::DelayQueue(uInt8 length, uInt8 size)
|
|||
for (uInt16 i = 0; i < length; i++)
|
||||
myMembers.emplace_back(size);
|
||||
|
||||
for (uInt8& i : myIndices)
|
||||
i = 0xFF;
|
||||
memset(myIndices, 0xFF, 0xFF);
|
||||
}
|
||||
|
||||
void DelayQueue::push(uInt8 address, uInt8 value, uInt8 delay)
|
||||
|
|
|
@ -71,7 +71,7 @@ template<class T> void DelayQueue::execute(T executor) {
|
|||
|
||||
currentMember.clear();
|
||||
|
||||
myIndex = (myIndex + 1) & myMembers.size();
|
||||
myIndex = (myIndex + 1) % myMembers.size();
|
||||
}
|
||||
|
||||
} // namespace TIA6502tsCore
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
|
||||
namespace TIA6502tsCore {
|
||||
|
||||
DelayQueueMember::DelayQueueMember(uInt8 capacity)
|
||||
: myEntries(capacity),
|
||||
DelayQueueMember::DelayQueueMember(uInt8 size)
|
||||
: myEntries(size),
|
||||
mySize(0)
|
||||
{}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class DelayQueueMember {
|
|||
|
||||
public:
|
||||
|
||||
DelayQueueMember(uInt8 capacity);
|
||||
DelayQueueMember(uInt8 size);
|
||||
|
||||
DelayQueueMember(DelayQueueMember&&) = default;
|
||||
|
||||
|
|
|
@ -22,12 +22,23 @@
|
|||
#include "M6502.hxx"
|
||||
|
||||
enum CollisionMask : uInt32 {
|
||||
player0 = 0b0111110000000000,
|
||||
player1 = 0b0100001111000000,
|
||||
missile0 = 0b0010001000111000,
|
||||
missile1 = 0b0001000100100110,
|
||||
ball = 0b0000100010010101,
|
||||
playfield = 0b0000010001001011
|
||||
player0 = 0b0111110000000000,
|
||||
player1 = 0b0100001111000000,
|
||||
missile0 = 0b0010001000111000,
|
||||
missile1 = 0b0001000100100110,
|
||||
ball = 0b0000100010010101,
|
||||
playfield = 0b0000010001001011
|
||||
};
|
||||
|
||||
enum Delay: uInt8 {
|
||||
hmove = 6,
|
||||
pf = 2,
|
||||
grp = 1,
|
||||
shufflePlayer = 1,
|
||||
hmp = 2,
|
||||
hmm = 2,
|
||||
hmbl = 2,
|
||||
hmclr = 2
|
||||
};
|
||||
|
||||
namespace TIA6502tsCore {
|
||||
|
@ -174,20 +185,17 @@ bool TIA::poke(uInt16 address, uInt8 value)
|
|||
break;
|
||||
|
||||
case PF0:
|
||||
myLinesSinceChange = 0;
|
||||
myPlayfield.pf0(value);
|
||||
myDelayQueue.push(PF0, value, Delay::pf);
|
||||
|
||||
break;
|
||||
|
||||
case PF1:
|
||||
myLinesSinceChange = 0;
|
||||
myPlayfield.pf1(value);
|
||||
myDelayQueue.push(PF1, value, Delay::pf);
|
||||
|
||||
break;
|
||||
|
||||
case PF2:
|
||||
myLinesSinceChange = 0;
|
||||
myPlayfield.pf2(value);
|
||||
myDelayQueue.push(PF2, value, Delay::pf);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -464,8 +472,27 @@ void TIA::onFrameStart()
|
|||
myCurrentFrameBuffer.swap(myPreviousFrameBuffer);
|
||||
}
|
||||
|
||||
// TODO: stub
|
||||
void TIA::delayedWrite(uInt8 address, uInt8 value)
|
||||
{}
|
||||
{
|
||||
switch (address) {
|
||||
case PF0:
|
||||
myLinesSinceChange = 0;
|
||||
myPlayfield.pf0(value);
|
||||
|
||||
break;
|
||||
|
||||
case PF1:
|
||||
myLinesSinceChange = 0;
|
||||
myPlayfield.pf1(value);
|
||||
|
||||
break;
|
||||
|
||||
case PF2:
|
||||
myLinesSinceChange = 0;
|
||||
myPlayfield.pf2(value);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace TIA6502tsCore
|
Loading…
Reference in New Issue