drfiemost wrote:
Just for completeness the same test was passing before I've refactored the CIA code to make another test pass.
I think what's happening here is that your CIA refactoring has changed the timing of the CIA interrupt such that it is now occurring later than before.
As far as I understand the test, the CIA interrupt is timed to occur during the JMP DC0C instruction. So the following instuction (at DCOC) is not actually executed. Instead, it's replaced by the 7-cycle interrupt sequence which looks like:
Code:
T1 - read PC
T2 - read PC
T3 - push PCH
T4 - push PCL
T5 - push PSW
T6 - read $FFFE
T7 - read $FFFF
The test checks whether DCOD is ever read, by checking if the CIA interrupt status flag has already been cleared.
If the CIA interrupts happens late, or not at all, the instruction as DC0C is executed as a normal instruction, which will start:
Code:
T1 - read PC
T2 - read PC + 1
All instructions start this way, even 1-byte instructions like NOP.
The test doesn't actually setup an instruction at DC0C (which is the CIA shift register). But if it happens to be a BRK, then this will look very like an interupt, apart from T2:
Code:
T1 - read PC
T2 - read PC + 1
T3 - push PCH
T4 - push PCL
T5 - push PSW
T6 - read $FFFE
T7 - read $FFFF
So I would look at your CIA refactor, to see if anything has changed the timing of the CIA interrupt
Dave