GO64! Issue 03/98: A solved secret
In part 7 of our tutorial we had a short section about ASL $D019 (aswell as INC, DEC) not
working in native mode IRQ routines, (See
here) but instead we had to use LDA $D019 STA $D019.
Johannes Niedermayr found the answer on the net and described it as follows:
The instruction timing of the 6510 looks like this:
> Operational diagram of LSR $D019: <#> <data> <address> <R/W> <Description> [1] 4E PC R fetch opcode [2] 19 PC+1 R fetch address low [3] D0 PC+2 R fetch opcode high [4] xx $D019 R read memory [5] xx $D019 W write the value back, rotate right [6] xx/2 $D019 W write the new value back
On cycle 5 the interrupt is confirmed by writing the value read in cycle 4 (same value)
to $D019. When running a standard IRQ the 6th cycle isn't needed anymore, as the IRQ is
already confirmed.
On CMOS versions of the 6502 such as the 65c02 (and the 65c816 aswell) 2 read cycles and 1
write cycle are performed. On our 6502 just 1 read cycle and 2 write cycles are done.
That appears to be the main difference causing a native IRQ not to be confirmed properly
when doing INC $D019 or alike.
< Just a quick translation, but it should have the point :) ... >
For additions please contact me at: count0@scs-trc.net or click here.