From 47068ee0814a70d30c63828ad93c635ba285ce5c Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 29 Dec 2019 17:51:50 -0500 Subject: [PATCH] Ensures visible hsync end generates a sequence point. --- Machines/Atari/ST/Video.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Machines/Atari/ST/Video.cpp b/Machines/Atari/ST/Video.cpp index 162b1226e..cfd6fcf3c 100644 --- a/Machines/Atari/ST/Video.cpp +++ b/Machines/Atari/ST/Video.cpp @@ -412,9 +412,15 @@ HalfCycles Video::get_next_sequence_point() { event_time = std::min(event_time, vsync_x_position); } - // Test for beginning and end of horizontal sync. - if(x_ < line_length_ - hsync_start) event_time = std::min(line_length_ - hsync_start, event_time); - else if(x_ < line_length_ - hsync_end) event_time = std::min(line_length_ - hsync_end, event_time); + // 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) { + 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. */ // It wasn't any of those, so as a temporary expedient, just supply end of line. return HalfCycles(event_time - x_);