From 6449403f6a9e51712a627fe4de5ba0ffbb6416f8 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 29 Dec 2019 21:53:45 -0500 Subject: [PATCH] Corrects pending_events_ test for sequence points. Simplifies around as possible. --- Machines/Atari/ST/Video.cpp | 15 ++++++--------- .../xcshareddata/xcschemes/Clock Signal.xcscheme | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Machines/Atari/ST/Video.cpp b/Machines/Atari/ST/Video.cpp index fd0e69d8c..9da6b1afd 100644 --- a/Machines/Atari/ST/Video.cpp +++ b/Machines/Atari/ST/Video.cpp @@ -400,7 +400,7 @@ HalfCycles Video::get_next_sequence_point() { // If any events are pending, give the first of those the chance to be next. if(!pending_events_.empty()) { - event_time = std::min(event_time, x_ + event_time); + event_time = std::min(event_time, x_ + pending_events_.front().delay); } // If this is a vertically-enabled line, check for the display enable boundaries, + the standard delay. @@ -418,17 +418,14 @@ HalfCycles Video::get_next_sequence_point() { event_time = std::min(event_time, vsync_x_position); } - // Test for beginning and end of horizontal sync, and the times when those will actually be communicated. - if(x_ < line_length_ - hsync_start) { - event_time = std::min(line_length_ - hsync_start, event_time); - } else if(x_ < line_length_ - hsync_start + hsync_delay_period) { + // Test for beginning and end of horizontal sync. + if(x_ < line_length_ - hsync_start + hsync_delay_period) { event_time = std::min(line_length_ - hsync_start + hsync_delay_period, event_time); - } else if(x_ < line_length_ - hsync_end) { - event_time = std::min(line_length_ - hsync_end, event_time); } - /* Assumed: hsync end will become visible at end of line. */ + /* Hereby assumed: hsync end will be communicated at end of line: */ + static_assert(hsync_end == hsync_delay_period); - // It wasn't any of those, so as a temporary expedient, just supply end of line. + // It wasn't any of those, just supply end of line. That's when the static_assert above assumes a visible hsync transition. return HalfCycles(event_time - x_); } diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme index 1465a4f62..47f9c7286 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme +++ b/OSBindings/Mac/Clock Signal.xcodeproj/xcshareddata/xcschemes/Clock Signal.xcscheme @@ -67,7 +67,7 @@