1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-09-30 07:55:01 +00:00

Corrects asymmetrical flash, ensures consistent burst phase.

This commit is contained in:
Thomas Harte 2021-03-21 20:22:27 -04:00
parent 58be770eaa
commit 064667c0c3

View File

@ -91,10 +91,13 @@ template <VideoTiming timing> class Video {
const int cycles_this_line = std::min(cycles_remaining, timings.cycles_per_line - offset); const int cycles_this_line = std::min(cycles_remaining, timings.cycles_per_line - offset);
const int end_offset = offset + cycles_this_line; const int end_offset = offset + cycles_this_line;
if(!line && !offset) { if(!offset) {
++flash_counter_; is_alternate_line_ ^= true;
flash_mask_ = uint8_t(flash_counter_ >> 4);
flash_counter_ &= 31; if(!line) {
flash_counter_ = (flash_counter_ + 1) & 31;
flash_mask_ = uint8_t(flash_counter_ >> 4);
}
} }
if(line < 3) { if(line < 3) {
@ -122,7 +125,7 @@ template <VideoTiming timing> class Video {
if(offset >= burst_position && offset < burst_position+burst_length && end_offset > offset) { if(offset >= burst_position && offset < burst_position+burst_length && end_offset > offset) {
const int burst_duration = std::min(burst_position + burst_length, end_offset) - offset; const int burst_duration = std::min(burst_position + burst_length, end_offset) - offset;
crt_.output_colour_burst(burst_duration, (line&1) * 128); crt_.output_colour_burst(burst_duration, line, is_alternate_line_);
offset += burst_duration; offset += burst_duration;
} }
@ -199,7 +202,7 @@ template <VideoTiming timing> class Video {
if(offset >= burst_position && offset < burst_position+burst_length && end_offset > offset) { if(offset >= burst_position && offset < burst_position+burst_length && end_offset > offset) {
const int burst_duration = std::min(burst_position + burst_length, end_offset) - offset; const int burst_duration = std::min(burst_position + burst_length, end_offset) - offset;
crt_.output_colour_burst(burst_duration, (line&1) * 128); crt_.output_colour_burst(burst_duration, 0, is_alternate_line_);
offset += burst_duration; offset += burst_duration;
} }
@ -298,6 +301,7 @@ template <VideoTiming timing> class Video {
uint8_t flash_mask_ = 0; uint8_t flash_mask_ = 0;
int flash_counter_ = 0; int flash_counter_ = 0;
bool is_alternate_line_ = false;
#define RGB(r, g, b) (r << 4) | (g << 2) | b #define RGB(r, g, b) (r << 4) | (g << 2) | b
static constexpr uint8_t palette[] = { static constexpr uint8_t palette[] = {