1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-01-13 22:32:03 +00:00

Hacks in a colour burst.

With a major flaw: it's implicit. I think I need a minor rethink of various components here.
This commit is contained in:
Thomas Harte 2019-12-20 23:49:38 -05:00
parent 57ce10418f
commit e5440a4146
2 changed files with 25 additions and 3 deletions

View File

@ -491,8 +491,9 @@ void Video::update_output_mode() {
void Video::Shifter::flush_output(OutputMode next_mode) {
switch(output_mode_) {
case OutputMode::Sync: crt_.output_sync(duration_); break;
case OutputMode::Blank: crt_.output_blank(duration_); break;
case OutputMode::Sync: crt_.output_sync(duration_); break;
case OutputMode::Blank: crt_.output_blank(duration_); break;
case OutputMode::ColourBurst: crt_.output_default_colour_burst(duration_); break;
case OutputMode::Border: {
// if(!border_colour_) {
// crt_.output_blank(duration_);
@ -512,9 +513,29 @@ void Video::Shifter::flush_output(OutputMode next_mode) {
output_mode_ = next_mode;
}
void Video::Shifter::output_colour_burst(int duration) {
// More hackery afoot here; if and when duration_ crosses a threshold of 40,
// output 40 cycles of colour burst and then redirect to blank.
if(output_mode_ != OutputMode::ColourBurst) {
flush_output(OutputMode::ColourBurst);
}
duration_ += duration;
if(duration_ >= 40) {
const int blank_duration = duration_ - 40;
duration_ = 40;
flush_output(OutputMode::Blank);
output_blank(blank_duration);
}
}
void Video::Shifter::output_blank(int duration) {
if(output_mode_ != OutputMode::Blank) {
// Bit of a hack: if this is a transition from sync or we're really in
// colour burst, divert into that.
if(output_mode_ == OutputMode::Sync || output_mode_ == OutputMode::ColourBurst) {
output_colour_burst(duration);
return;
}
flush_output(OutputMode::Blank);
}
duration_ += duration;

View File

@ -173,13 +173,14 @@ class Video {
void output_sync(int duration);
void output_border(int duration, OutputBpp bpp);
void output_pixels(int duration, OutputBpp bpp);
void output_colour_burst(int duration);
void load(uint64_t value);
private:
int duration_ = 0;
enum class OutputMode {
Sync, Blank, Border, Pixels
Sync, Blank, Border, Pixels, ColourBurst
} output_mode_ = OutputMode::Sync;
uint16_t border_colour_ = 0;
OutputBpp bpp_ = OutputBpp::Four;