From fcf8cafb5d917f363eceae66581b69618f39121d Mon Sep 17 00:00:00 2001
From: Thomas Harte <thomas.harte@gmail.com>
Date: Mon, 6 Feb 2017 18:27:44 -0500
Subject: [PATCH] Sought to ensure that communicating a colour burst in
 multiple parts doesn't ruin the phase.

---
 Outputs/CRT/CRT.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Outputs/CRT/CRT.cpp b/Outputs/CRT/CRT.cpp
index f1d0c3f88..550a9d624 100644
--- a/Outputs/CRT/CRT.cpp
+++ b/Outputs/CRT/CRT.cpp
@@ -222,6 +222,7 @@ void CRT::advance_cycles(unsigned int number_of_cycles, bool hsync_requested, bo
 								(*(uint16_t *)&input_buffer[position + SourceVertexOffsetOfOutputStart + 2]) = output_y;
 							}
 						});
+					colour_burst_amplitude_ = 0;
 				}
 				is_writing_composite_run_ ^= true;
 			}
@@ -284,7 +285,7 @@ void CRT::output_scan(const Scan *const scan)
 	// simplified colour burst logic: if it's within the back porch we'll take it
 	if(scan->type == Scan::Type::ColourBurst)
 	{
-		if(horizontal_flywheel_->get_current_time() < (horizontal_flywheel_->get_standard_period() * 12) >> 6)
+		if(!colour_burst_amplitude_ && horizontal_flywheel_->get_current_time() < (horizontal_flywheel_->get_standard_period() * 12) >> 6)
 		{
 			unsigned int position_phase = (horizontal_flywheel_->get_current_time() * colour_cycle_numerator_ * 256) / phase_denominator_;
 			colour_burst_phase_ = (position_phase + scan->phase) & 255;