From 883680731ac350a3ddf43fedd03878e32aa94060 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 21 Oct 2018 21:18:41 -0400 Subject: [PATCH 1/2] Uses explicit state to determine whether a pixel target has been requested. --- Components/9918/9918.cpp | 4 +++- Components/9918/Implementation/9918Base.hpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Components/9918/9918.cpp b/Components/9918/9918.cpp index 49cbc86c1..0aa855b32 100644 --- a/Components/9918/9918.cpp +++ b/Components/9918/9918.cpp @@ -370,7 +370,8 @@ void TMS9918::run_for(const HalfCycles cycles) { intersect( line_buffer.first_pixel_output_column, line_buffer.next_border_column, - if(start == line_buffer.first_pixel_output_column) { + if(!asked_for_write_area_) { + asked_for_write_area_ = true; pixel_origin_ = pixel_target_ = reinterpret_cast( crt_->allocate_write_area(static_cast(line_buffer.next_border_column - line_buffer.first_pixel_output_column)) ); @@ -392,6 +393,7 @@ void TMS9918::run_for(const HalfCycles cycles) { const unsigned int length = static_cast(line_buffer.next_border_column - line_buffer.first_pixel_output_column); crt_->output_data(length * 4, length); pixel_origin_ = pixel_target_ = nullptr; + asked_for_write_area_ = false; } ); diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index c22b06bba..6a5f8fa02 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -788,6 +788,7 @@ class Base { #undef slot uint32_t *pixel_target_ = nullptr, *pixel_origin_ = nullptr; + bool asked_for_write_area_ = false; void draw_tms_character(int start, int end); void draw_tms_text(int start, int end); void draw_sms(int start, int end); From 7c65cfd932108a68e7109c6e548eb01b8b4d8cb4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 21 Oct 2018 21:18:54 -0400 Subject: [PATCH 2/2] Adds default values for `WriteArea`. --- Outputs/CRT/Internals/TextureBuilder.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Outputs/CRT/Internals/TextureBuilder.hpp b/Outputs/CRT/Internals/TextureBuilder.hpp index 9770fd03f..456a4e792 100644 --- a/Outputs/CRT/Internals/TextureBuilder.hpp +++ b/Outputs/CRT/Internals/TextureBuilder.hpp @@ -91,7 +91,7 @@ class TextureBuilder { void submit(); struct WriteArea { - uint16_t x, y, length; + uint16_t x = 0, y = 0, length = 0; }; /// Finalises all write areas allocated since the last call to @c flush. Only finalised areas will be /// submitted upon the next @c submit. The supplied function will be called with a list of write areas