From 858721a7a507438bebb2b0ad03a13a8bd6993448 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 4 Oct 2018 18:52:23 -0400 Subject: [PATCH] Added left border hiding. --- Components/9918/9918.cpp | 11 +++++++++-- Components/9918/Implementation/9918Base.hpp | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Components/9918/9918.cpp b/Components/9918/9918.cpp index f39fd605b..98e899524 100644 --- a/Components/9918/9918.cpp +++ b/Components/9918/9918.cpp @@ -255,7 +255,7 @@ void TMS9918::run_for(const HalfCycles cycles) { mode_timing_.first_pixel_output_column, mode_timing_.next_border_column, if(start == mode_timing_.first_pixel_output_column) { - pixel_target_ = reinterpret_cast( + pixel_origin_ = pixel_target_ = reinterpret_cast( crt_->allocate_write_area(static_cast(mode_timing_.next_border_column - mode_timing_.first_pixel_output_column) + 8) // TODO: the +8 is really for the SMS only; make it optional. ); } @@ -275,7 +275,7 @@ void TMS9918::run_for(const HalfCycles cycles) { if(end == mode_timing_.next_border_column) { const unsigned int length = static_cast(mode_timing_.next_border_column - mode_timing_.first_pixel_output_column); crt_->output_data(length * 4, length); - pixel_target_ = nullptr; + pixel_origin_ = pixel_target_ = nullptr; } ); @@ -647,6 +647,8 @@ void Base::draw_tms_text(int start, int end) { } void Base::draw_sms(int start, int end) { + const bool is_end = end == 256; + // Shift the output window by the fine scroll amount, and fill in // any border pixels that leaves on the left-hand side. start -= master_system_.horizontal_scroll & 7; @@ -707,6 +709,11 @@ void Base::draw_sms(int start, int end) { pattern = *reinterpret_cast(master_system_.tile_graphics[byte_column]); } + if(is_end && master_system_.hide_left_column) { + pixel_origin_[0] = pixel_origin_[1] = pixel_origin_[2] = pixel_origin_[3] = + pixel_origin_[4] = pixel_origin_[5] = pixel_origin_[6] = pixel_origin_[7] = + master_system_.colour_ram[16 + background_colour_]; + } // const int pixels_left = pixels_end - output_column_; // const int pixel_location = output_column_ - first_pixel_column_; // const int reverses[2] = {0, 7}; diff --git a/Components/9918/Implementation/9918Base.hpp b/Components/9918/Implementation/9918Base.hpp index de34e51b8..8410d50a5 100644 --- a/Components/9918/Implementation/9918Base.hpp +++ b/Components/9918/Implementation/9918Base.hpp @@ -687,7 +687,7 @@ class Base { #undef external_slot #undef slot - uint32_t *pixel_target_ = nullptr; + uint32_t *pixel_target_ = nullptr, *pixel_origin_ = nullptr; void draw_tms_character(int start, int end); void draw_tms_text(int start, int end); void draw_sms(int start, int end);