The ZX Spectrum Reverse Engineering and Clone Desgin Blog


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

< 35 of 68 >

The keyboard and interrupt test - Success!

Jun 22, 2007

The keyboard interface was a little tricky to wire because there was even more data bus routing to be done! While I was there I made sure I placed both the input buffer and output latch in a sensible location on the breadboard to make routing as easy as possible, with sufficient space around them to implement the other interfaces. This meant relocating a couple of transistors used in the RGB generation, but nothing major.

The interrupt generator was easy by comparison, single 74HC74, one OR gate and three wires to the Z80. I was pretty sure I hadn't wired that up incorrectly, but I checked with the oscilloscope that I was getting one interrupt every 50th of a second (or every 20ms), which I was. Hardly surprising since it is generated from VSyncEn. That done I plugged into the TV and turned on.

The keyboard worked! Which of course meant that the interrupts were working. Here is a picture of a simple 10 line demo I typed in:

I feel like I'm one small step away from a full test! Ramsoft describe the floating bus in great detail, and provide a test program (TAP format) that emulators can use to verify correct operation.

This test program uses the interrupt to start the test, from which it waits an exact number of T-states before sampling the floating bus. So this program will not only analyse how accurate the interrupt timing is, but also how accurate the floating bus is.

In addition to the floatspy test program, several well known games use either the interrupt timing, floating bus behaviour or both together to run correctly. These should be used as tests for the Harlequin too!

GameInterruptFloating BusDescription
DarkstarYesno Graphics in top border
AquaplaneYesnoFull screen horizon
Arkanoid??Yes Sprite redraw timing
Cobra??Yes Sprite redraw timing
SidewizeYesYesSprite redraw timing/
flicker removal

I'm not sure whether the interrupt timing affects Cobra or Arkanoid, a missing floating bus certainly does.

All I need now is a cassette interface! I've some of the above on (real!) cassette, but pretty much all of them are available from the World Of Spectrum as tzx files.