From e5440a414674cfd35540100d6c4d7b53ea2879b9 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 20 Dec 2019 23:49:38 -0500 Subject: [PATCH] Hacks in a colour burst. With a major flaw: it's implicit. I think I need a minor rethink of various components here. --- Machines/Atari/ST/Video.cpp | 25 +++++++++++++++++++++++-- Machines/Atari/ST/Video.hpp | 3 ++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Machines/Atari/ST/Video.cpp b/Machines/Atari/ST/Video.cpp index 943c865db..b321e01fe 100644 --- a/Machines/Atari/ST/Video.cpp +++ b/Machines/Atari/ST/Video.cpp @@ -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; diff --git a/Machines/Atari/ST/Video.hpp b/Machines/Atari/ST/Video.hpp index 269d92d59..4e240b9c1 100644 --- a/Machines/Atari/ST/Video.hpp +++ b/Machines/Atari/ST/Video.hpp @@ -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;