From 7255408313791c5abe5c7c67730fc115a1ac4153 Mon Sep 17 00:00:00 2001
From: Thomas Harte <thomas.harte@gmail.com>
Date: Tue, 8 Mar 2016 22:54:05 -0500
Subject: [PATCH] Experimented with going back to horizontal sync on leading
 edge; not sure so (temporarily?) disabled.

---
 Outputs/CRT/CRT.cpp | 13 ++++++++-----
 Outputs/CRT/CRT.hpp |  2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Outputs/CRT/CRT.cpp b/Outputs/CRT/CRT.cpp
index fd139386e..62d4c39d4 100644
--- a/Outputs/CRT/CRT.cpp
+++ b/Outputs/CRT/CRT.cpp
@@ -274,14 +274,17 @@ void CRT::advance_cycles(unsigned int number_of_cycles, unsigned int source_divi
 
 #pragma mark - stream feeding methods
 
-void CRT::output_scan(Scan *scan)
+void CRT::output_scan(const Scan *const scan)
 {
-	bool this_is_sync = (scan->type == Scan::Type::Sync);
-	bool is_trailing_edge = (_is_receiving_sync && !this_is_sync);
-	bool hsync_requested = is_trailing_edge && (_sync_period < (_horizontal_flywheel->get_scan_period() >> 2));
-	bool vsync_requested = is_trailing_edge && (_sync_capacitor_charge_level >= _sync_capacitor_charge_threshold);
+	const bool this_is_sync = (scan->type == Scan::Type::Sync);
+	const bool is_trailing_edge = (_is_receiving_sync && !this_is_sync);
+//	const bool is_leading_edge = (!_is_receiving_sync && this_is_sync);
 	_is_receiving_sync = this_is_sync;
 
+//	const bool hsync_requested = is_leading_edge;
+	const bool hsync_requested = is_trailing_edge && (_sync_period < (_horizontal_flywheel->get_scan_period() >> 2));
+	const bool vsync_requested = is_trailing_edge && (_sync_capacitor_charge_level >= _sync_capacitor_charge_threshold);
+
 	// simplified colour burst logic: if it's within the back porch we'll take it
 	if(scan->type == Scan::Type::ColourBurst)
 	{
diff --git a/Outputs/CRT/CRT.hpp b/Outputs/CRT/CRT.hpp
index 3ccc46c9d..3391fdc4f 100644
--- a/Outputs/CRT/CRT.hpp
+++ b/Outputs/CRT/CRT.hpp
@@ -61,7 +61,7 @@ class CRT {
 				};
 			};
 		};
-		void output_scan(Scan *scan);
+		void output_scan(const Scan *scan);
 
 		uint8_t _colour_burst_phase, _colour_burst_amplitude;
 		uint16_t _colour_burst_time;