Spectrum Timings

Development talk ...

Background for those that need it...
Each operation performed on the spectrum (Z80 CPU) will take a length of time ( counted in T states, Cycles ) its widely documented how long each op will take allowing programmers to create time critical code.. simple enough.. But that's not the whole story the lower part of the 16/48k spectrum memory is used as the video memory and is accessed by the ULA - thus when displaying to the screen the Z80 process is halted if it needs to access this area of memory causing a greater number of Tstates to pass and dependent on what cycle in the frame we are at we experience a different delay

for more info. see Contended Memory

As we need to emulate all this behavior we found that some dedicated individuals have spent a lots of their time discovering how these delays break down on each operation! Its a lovely large table of values!

So ( borrowing Woody's code, don't tell him ) We wrote a set of tests to run each op across contended memory although this wouldt give the actual contended value for each loop it will however become a sum of loops and values to compare real Spectrums against one another and against the emulator.

In order to get the correct results we ran the tests on real Spectrums, Additionally there is a case known as "late/early timing" in which is thought some Spectrums are 1 Tstate later, Although what causes this still arent clearly understood.
So whilst building these test we thought it could be beneficial to ask the public to run the code on their own Spectrums and send in the results this way we can get a little closer to the effects and a snapshot ratio of late/early machines... So if you have a spectrum run the tests! . . . . . . please.

48k Tests

How do the tests work?
At present there are a set of 35 tests each test contains a group of OPs ( to cover all documented OP's ).

Before running a test a section of memory is set up to catch the interrupt and redirect the execution to a compare routine against known values. The idea of each test is to run the batch of OPs as many times as possible before the next interrupt fires, a loop count, a running memory fetch R value and the memory location reached when the interrupt happened.

For the early/late (type1/type2) detection the test loop is the simplest tightest loop possible JP (HL) back to itself which is only broken once an interrupt fires, running in non contended memory causing (1R, 4T) on each execute.

Initial finds...


Firstly:
The emulator works perfectly and passes all the tests! Which is nice as there must be a few hundred chances a number could have been out!

Secondly:
We rewrote a quick check for late/early timing using the known values of our test, this showed some interesting results when run on a cold early machine could initially report late and then early after warming up, so after some changes we wrote the test to stream the results on the screen this way you could see the values wavering when cold!


 

The Tests

Download The Tests Here
Important: When running the test please remove any additional hardware, Also press enter and run all tests, If any should fail wait until Spectrum has fully warmed up before re-trying.

Submit Your Results Here

Important: Only submit results from genuine hardware no emulators!

View The Results Here


 



Thanks for reading, please if you can help out do so - Enjoy ZXSpectrum4.net Team.

we need your help!

ZX Spectrum Cassette Database

In order to maximise the database we need to find as many cassettes as possible, from unknown ones to ones known but we are unable to locate.

If you can help us with any old cassettes you may have in the loft you no longer want or know someone that has then please contact us and give them to a good home, If we can't get there in person we can get them collected by courier - please don't throw them!

Don't worry if you have no old cassettes please register your copy of the emulator by doing so helps us obtain further hardware and software for the project, and plus gives you full functionality of the emulator.

Help by donating or registering

Register

A big "THANK YOU!" to everyone the has donated, time, money, knowledge, tapes and hardware we are truly grateful - ZXSpectrum4.net Team.

emulator

ZX Spectrum Emulator for Microsoft Windows, developed under Microsoft .net framework.

It emulates all known ZX Spectrum behaviours, timing and models 16k, 48k, 128k, +2, +3 (including 3 inch floppy disk drive and tape deck emulation), Sound, Border, Basic, Snapshot saving and more... supported file formats include .wav .tzx .sna .z80 .tap .dsk

GAMES!

We've now included a couple of games in different formats to help those non technical get started, for more help please visit the help section

Requirements

Microsoft Windows 8, 7, Vista, XP
( XP requires microsoft .net framework )

NO install required, and NO registry garbage.

Download the latest ZXSpectrum4.zip for free.
Latest Version 1.0.6313 Build: 35929 (32567)

Download
DOWNLOAD - learn more

If automatic setup fails use
manual download above
Download
Setup click and choose 'RUN '