From 55fd9122d0eee90f63a9979683b80975d1089fae Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 30 Jul 2017 21:19:42 -0400 Subject: [PATCH] Slightly relaxed vertical sync testing. --- Outputs/CRT/CRT.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Outputs/CRT/CRT.cpp b/Outputs/CRT/CRT.cpp index 2fdab779f..aed91f634 100644 --- a/Outputs/CRT/CRT.cpp +++ b/Outputs/CRT/CRT.cpp @@ -36,7 +36,10 @@ void CRT::set_new_timing(unsigned int cycles_per_line, unsigned int height_of_di cycles_per_line_ = cycles_per_line; unsigned int multiplied_cycles_per_line = cycles_per_line * time_multiplier_; - sync_capacitor_charge_threshold_ = (vertical_sync_half_lines * cycles_per_line) >> 1; + // allow sync to be detected (and acted upon) a line earlier than the specified requirement, + // as a simple way of avoiding not-quite-exact comparison issues while still being true enough to + // the gist for simple debugging + sync_capacitor_charge_threshold_ = ((vertical_sync_half_lines - 2) * cycles_per_line) >> 1; // create the two flywheels horizontal_flywheel_.reset(new Flywheel(multiplied_cycles_per_line, (millisecondsHorizontalRetraceTime * multiplied_cycles_per_line) >> 6, multiplied_cycles_per_line >> 6));