1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Corrected: PAL machines can now be overt in terms of odd/even colour burst.

This commit is contained in:
Thomas Harte 2021-03-20 23:45:49 -04:00
parent 07a63d62dd
commit 986c4006a6
2 changed files with 7 additions and 6 deletions

View File

@ -32,7 +32,7 @@ void CRT::set_new_timing(int cycles_per_line, int height_of_display, Outputs::Di
phase_numerator_ = 0; phase_numerator_ = 0;
colour_cycle_numerator_ = int64_t(colour_cycle_numerator); colour_cycle_numerator_ = int64_t(colour_cycle_numerator);
phase_alternates_ = should_alternate; phase_alternates_ = should_alternate;
is_alernate_line_ &= phase_alternates_; should_be_alternate_line_ &= phase_alternates_;
cycles_per_line_ = cycles_per_line; cycles_per_line_ = cycles_per_line;
const int multiplied_cycles_per_line = cycles_per_line * time_multiplier_; 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 retrace is starting, update phase if required and mark no colour burst spotted yet.
if(next_horizontal_sync_event == Flywheel::SyncEvent::StartRetrace) { if(next_horizontal_sync_event == Flywheel::SyncEvent::StartRetrace) {
is_alernate_line_ ^= phase_alternates_; should_be_alternate_line_ ^= phase_alternates_;
colour_burst_amplitude_ = 0; colour_burst_amplitude_ = 0;
} }
} }
@ -408,18 +408,19 @@ void CRT::output_level(int number_of_cycles) {
output_scan(&scan); 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 scan;
scan.type = Scan::Type::ColourBurst; scan.type = Scan::Type::ColourBurst;
scan.number_of_cycles = number_of_cycles; scan.number_of_cycles = number_of_cycles;
scan.phase = phase; scan.phase = phase;
scan.amplitude = amplitude >> 1; scan.amplitude = amplitude >> 1;
is_alernate_line_ = is_alternate_line;
output_scan(&scan); output_scan(&scan);
} }
void CRT::output_default_colour_burst(int number_of_cycles, uint8_t amplitude) { void CRT::output_default_colour_burst(int number_of_cycles, uint8_t amplitude) {
// TODO: avoid applying a rounding error here? // 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) { void CRT::set_immediate_default_phase(float phase) {

View File

@ -61,7 +61,7 @@ class CRT {
int64_t phase_denominator_ = 1; int64_t phase_denominator_ = 1;
int64_t phase_numerator_ = 0; int64_t phase_numerator_ = 0;
int64_t colour_cycle_numerator_ = 1; 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); 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); 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 @param amplitude The amplitude of the colour burst in 1/255ths of the amplitude of the
positive portion of the wave. 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. /*! Outputs a colour burst exactly in phase with CRT expectations using the idiomatic amplitude.