mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-29 20:31:46 +00:00
Reintroduces colour phase acquisition from the colour burst.
This commit is contained in:
parent
eb28095041
commit
1effb97b74
@ -185,7 +185,6 @@ void CRT::advance_cycles(int number_of_cycles, bool hsync_requested, bool vsync_
|
|||||||
scan_target_->announce(Outputs::Display::ScanTarget::Event::HorizontalRetrace);
|
scan_target_->announce(Outputs::Display::ScanTarget::Event::HorizontalRetrace);
|
||||||
is_alernate_line_ ^= phase_alternates_;
|
is_alernate_line_ ^= phase_alternates_;
|
||||||
colour_burst_amplitude_ = 0;
|
colour_burst_amplitude_ = 0;
|
||||||
phase_numerator_ = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also announce if this is vertical retrace.
|
// Also announce if this is vertical retrace.
|
||||||
@ -216,12 +215,16 @@ void CRT::output_scan(const Scan *const scan) {
|
|||||||
// simplified colour burst logic: if it's within the back porch we'll take it
|
// simplified colour burst logic: if it's within the back porch we'll take it
|
||||||
if(scan->type == Scan::Type::ColourBurst) {
|
if(scan->type == Scan::Type::ColourBurst) {
|
||||||
if(!colour_burst_amplitude_ && 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) {
|
||||||
// int position_phase = (horizontal_flywheel_->get_current_time() * colour_cycle_numerator_ * 256) / phase_denominator_;
|
// Load phase_numerator_ as a fixed-point quantity in the range [0, 255].
|
||||||
// colour_burst_phase_ = (position_phase + scan->phase) & 255;
|
phase_numerator_ = scan->phase;
|
||||||
colour_burst_amplitude_ = scan->amplitude;
|
if(colour_burst_phase_adjustment_ != 0xff)
|
||||||
|
phase_numerator_ = (phase_numerator_ & ~63) + colour_burst_phase_adjustment_;
|
||||||
|
|
||||||
// if(colour_burst_phase_adjustment_ != 0xff)
|
// Multiply the phase_numerator_ up to be to the proper scale.
|
||||||
// colour_burst_phase_ = (colour_burst_phase_ & ~63) + colour_burst_phase_adjustment_;
|
phase_numerator_ = (phase_numerator_ * phase_denominator_) >> 8;
|
||||||
|
|
||||||
|
// Crib the colour burst amplitude.
|
||||||
|
colour_burst_amplitude_ = scan->amplitude;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: inspect raw data for potential colour burst if required; the DPLL and some zero crossing logic
|
// TODO: inspect raw data for potential colour burst if required; the DPLL and some zero crossing logic
|
||||||
@ -313,6 +316,7 @@ void CRT::output_colour_burst(int number_of_cycles, uint8_t phase, uint8_t ampli
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CRT::output_default_colour_burst(int number_of_cycles) {
|
void CRT::output_default_colour_burst(int number_of_cycles) {
|
||||||
|
// TODO: avoid applying a rounding error here?
|
||||||
output_colour_burst(number_of_cycles, static_cast<uint8_t>((phase_numerator_ * 256) / phase_denominator_));
|
output_colour_burst(number_of_cycles, static_cast<uint8_t>((phase_numerator_ * 256) / phase_denominator_));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class CRT {
|
|||||||
|
|
||||||
int16_t colour_burst_angle_ = 0;
|
int16_t colour_burst_angle_ = 0;
|
||||||
uint8_t colour_burst_amplitude_ = 30;
|
uint8_t colour_burst_amplitude_ = 30;
|
||||||
int colour_burst_phase_adjustment_ = 0;
|
int colour_burst_phase_adjustment_ = 0xff;
|
||||||
bool is_writing_composite_run_ = false;
|
bool is_writing_composite_run_ = false;
|
||||||
|
|
||||||
int64_t phase_denominator_ = 1;
|
int64_t phase_denominator_ = 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user