From 986c4006a664b6d05ad334ec33387a68cdfabf58 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sat, 20 Mar 2021 23:45:49 -0400 Subject: [PATCH] Corrected: PAL machines can now be overt in terms of odd/even colour burst. --- Outputs/CRT/CRT.cpp | 9 +++++---- Outputs/CRT/CRT.hpp | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Outputs/CRT/CRT.cpp b/Outputs/CRT/CRT.cpp index c72d98a39..ad1d3cf1c 100644 --- a/Outputs/CRT/CRT.cpp +++ b/Outputs/CRT/CRT.cpp @@ -32,7 +32,7 @@ void CRT::set_new_timing(int cycles_per_line, int height_of_display, Outputs::Di phase_numerator_ = 0; colour_cycle_numerator_ = int64_t(colour_cycle_numerator); phase_alternates_ = should_alternate; - is_alernate_line_ &= phase_alternates_; + should_be_alternate_line_ &= phase_alternates_; cycles_per_line_ = cycles_per_line; const int multiplied_cycles_per_line = cycles_per_line * time_multiplier_; @@ -275,7 +275,7 @@ void CRT::advance_cycles(int number_of_cycles, bool hsync_requested, bool vsync_ // If retrace is starting, update phase if required and mark no colour burst spotted yet. if(next_horizontal_sync_event == Flywheel::SyncEvent::StartRetrace) { - is_alernate_line_ ^= phase_alternates_; + should_be_alternate_line_ ^= phase_alternates_; colour_burst_amplitude_ = 0; } } @@ -408,18 +408,19 @@ void CRT::output_level(int number_of_cycles) { output_scan(&scan); } -void CRT::output_colour_burst(int number_of_cycles, uint8_t phase, uint8_t amplitude) { +void CRT::output_colour_burst(int number_of_cycles, uint8_t phase, bool is_alternate_line, uint8_t amplitude) { Scan scan; scan.type = Scan::Type::ColourBurst; scan.number_of_cycles = number_of_cycles; scan.phase = phase; scan.amplitude = amplitude >> 1; + is_alernate_line_ = is_alternate_line; output_scan(&scan); } void CRT::output_default_colour_burst(int number_of_cycles, uint8_t amplitude) { // TODO: avoid applying a rounding error here? - output_colour_burst(number_of_cycles, uint8_t((phase_numerator_ * 256) / phase_denominator_), amplitude); + output_colour_burst(number_of_cycles, uint8_t((phase_numerator_ * 256) / phase_denominator_), should_be_alternate_line_, amplitude); } void CRT::set_immediate_default_phase(float phase) { diff --git a/Outputs/CRT/CRT.hpp b/Outputs/CRT/CRT.hpp index 7ab9dbcf5..9749d5011 100644 --- a/Outputs/CRT/CRT.hpp +++ b/Outputs/CRT/CRT.hpp @@ -61,7 +61,7 @@ class CRT { int64_t phase_denominator_ = 1; int64_t phase_numerator_ = 0; int64_t colour_cycle_numerator_ = 1; - bool is_alernate_line_ = false, phase_alternates_ = false; + bool is_alernate_line_ = false, phase_alternates_ = false, should_be_alternate_line_ = false; void advance_cycles(int number_of_cycles, bool hsync_requested, bool vsync_requested, const Scan::Type type, int number_of_samples); Flywheel::SyncEvent get_next_vertical_sync_event(bool vsync_is_requested, int cycles_to_run_for, int *cycles_advanced); @@ -207,7 +207,7 @@ class CRT { @param amplitude The amplitude of the colour burst in 1/255ths of the amplitude of the positive portion of the wave. */ - void output_colour_burst(int number_of_cycles, uint8_t phase, uint8_t amplitude = DefaultAmplitude); + void output_colour_burst(int number_of_cycles, uint8_t phase, bool is_alternate_line = false, uint8_t amplitude = DefaultAmplitude); /*! Outputs a colour burst exactly in phase with CRT expectations using the idiomatic amplitude.