From 4f80523828abfcaf5013c0d3d3e898d6de00fd7b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 31 Mar 2021 22:51:20 -0400 Subject: [PATCH] Tweaks contended timing. --- Machines/Sinclair/ZXSpectrum/Video.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Machines/Sinclair/ZXSpectrum/Video.hpp b/Machines/Sinclair/ZXSpectrum/Video.hpp index 8419b882c..2c03545ec 100644 --- a/Machines/Sinclair/ZXSpectrum/Video.hpp +++ b/Machines/Sinclair/ZXSpectrum/Video.hpp @@ -88,9 +88,12 @@ template class Video { .cycles_per_line = 228 * 2, .lines_per_frame = 311, - .interrupt_time = 56545 * 2, + .interrupt_time = 56542 * 2, - .contention_leadin = 2 * 2, // TODO: is this 2? Or 4? Or... ? + // i.e. video fetching begins five cycles after the start of the + // contended memory pattern below; that should put a clear two + // cycles between a Z80 access and the first video fetch. + .contention_leadin = 5 * 2, .contention_duration = 129 * 2, .delays = { @@ -311,7 +314,9 @@ template class Video { } const int time_into_line = delay_time % timings.cycles_per_line; - if(time_into_line >= timings.contention_duration) return 0; + if(time_into_line >= timings.contention_duration) { + return 0; + } return timings.delays[time_into_line & 15]; }