From 5ef26a25ee97b689f46f56c5f7deffb854e6cd1e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 2 Jan 2025 15:52:20 -0500 Subject: [PATCH] Fix shift timing. --- Machines/Commodore/Plus4/Video.hpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Machines/Commodore/Plus4/Video.hpp b/Machines/Commodore/Plus4/Video.hpp index f90076862..a56f19c1e 100644 --- a/Machines/Commodore/Plus4/Video.hpp +++ b/Machines/Commodore/Plus4/Video.hpp @@ -870,8 +870,6 @@ private: mode == VideoMode::ExtendedColourText ) { const auto attributes = output_.attributes<0>(); - output_.advance_pixels(length); - const auto colours = [&]() -> std::array { if constexpr(mode == VideoMode::Text) { return { @@ -895,19 +893,12 @@ private: } }(); draw_1bpp_segment(target, colours.data()); + output_.advance_pixels(length); } if constexpr (mode == VideoMode::BitmapMulticolour) { const auto attributes = output_.attributes<0>(); const auto character = output_.attributes<1>(); - - constexpr int leftover = is_leftovers && (length & 1); - if(is_leftovers) { - output_.advance_pixels(length + leftover); - } else { - output_.advance_pixels(length & ~1); - } - const uint16_t colours[] = { background_[0], colour((character >> 4) & 0xf, (attributes >> 0) & 0x7), @@ -915,6 +906,13 @@ private: background_[1], }; draw_2bpp_segment(target, colours); + + constexpr int leftover = is_leftovers && (length & 1); + if(is_leftovers) { + output_.advance_pixels(length + leftover); + } else { + output_.advance_pixels(length & ~1); + } } if constexpr (mode == VideoMode::Blank) {