The ZX Spectrum Reverse Engineering and Clone Desgin Blog

Harlequin

A site dedicated to the reverse engineering of the ZX Spectrum and related projects.

< 41 of 68 >

Acknowledging the Interrupt (again)

Jun 30, 2007

I've been thinking that perhaps the interrupt acknowledge may not be resetting the interrupt reliably, causing the observed interrupt response to be unstable. I'm leaning towards this conclusion as I'm confident through testing and analysis that the interrupt start is itself consistent and stable.

Measuring the INTack signal is proving quite difficult as it is not produced at exactly the same time with respect to INT, depending on what the Z80 is doing at the time. The oscilloscope fails to trigger correctly.

According to the comp.sys.sinclair FAQ Z80 Technical Reference the ZX Spectrum holds the INT line low for exactly 32 T-states. As a test and an alternative to using the Z80s acknowledge I could try duplicating the interrupt pulse duration demonstrated by the ZX Spectrum of 32 T-states, and see if the response becomes more reliable.

The Harlequin interrupt is generated exactly as the horizontal counter resets. In order to wait 32 T-states I merely have to wait until HC6 goes high and use that to reset the interrupt flip-flop (or rather put its output into a high state).

This was quick to configure, passing HC6 through a spare inverter and using that to drive the interrupt output flip-flop Clr line.

Running floatspy, again modified slightly to start at T-state 14346 instead of 14347, showed valid floating bus values being read - showing it was still working with the new interrupt duration. To see if the interrupt response was any more stable, the full test was run:

For the first time this concluded in a successful test! I ran the test several times to make sure - powering down and up in between to make sure. All were successful.

The only real issue, and a small one at that, is that the Harlequin interrupt is generated one T-state later than a real ZX Spectrum. It has been observed that some ZX Spectrum machines produce an interrupt one T-state earlier than the usual 14336 (+11), and that does not appear to cause any problems. The Spectrum 128K/+2 generates an interrupt 21 T-states or so early, where as the Spectrum +2A/+3 is 30 T-states early! There is no floating bus with the Spectrum +2A/+3 anyway, so the interrupt timing is only useful for border effects.

Loading Dark Star and Aquaplane to test the new interrupt timing shows the following:



The Harlequin successfully displays the Dark Star border logo correctly in the center of the screen, but Aquaplane still has a border horizon that is too high.

I'm really puzzled by this, as everything appears to check out okay with the interrupts. There is one game however that is very sensitive to interrupt and floating bus timing issues, causing it to jerk about and/or flicker wildly.

Bring on Sidewize........