Solved! Go to Solution.
SEI and CLI are used to disable and re-enable interrupts aren't there?
I don't see why I should have to disable interrupts during that block of code.
It's usually possible to find ISR-friendly solutions that do not require interrupts to be disabled. For example, you don't have to use a variable for counter. Instead you can do this:
LDAB #$80 GET_DIP_LP ROLA RORB BCC GET_DIP_LP COMB ANDB #$3F STAB INP1_TMP
Register B is initially loaded with Bit7 ($80) which, as it gets shifted to the right, it will eventually (after exactly 8 shifts) end up in the CCR[C]. You can check for this to control your loop.
That way you only write the final result into INP1_TMP (once, in one atomic operation).
Ah, of course.
I was only thinking about how the values in the accumulators could get messed up when I should have realized it was INP1_TMP.
Thank you for the help.