From 29af5542f8e5235195f436b7a3860a14eeade1a4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 30 Jan 2023 21:06:04 -0500 Subject: [PATCH] Make an effort at doing _something_ for G4. --- Components/9918/Implementation/Draw.hpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Components/9918/Implementation/Draw.hpp b/Components/9918/Implementation/Draw.hpp index caf3c00c3..355f09d69 100644 --- a/Components/9918/Implementation/Draw.hpp +++ b/Components/9918/Implementation/Draw.hpp @@ -292,9 +292,19 @@ template template void Base::draw_yamaha(LineBuffer &buffer, int start, int end) { // TODO: sprites. And all other graphics modes. + // TODO: much smarter loops. Duff plus a tail? + + if constexpr (mode == ScreenMode::YamahaGraphics4) { + for(int c = start >> 2; c < end >> 2; c++) { + pixel_target_[c] = Storage::palette_[ + buffer.bitmap[c >> 1] >> ((((c & 1) ^ 1) << 2)) & 0xf + ]; + } + + return; + } if constexpr (mode == ScreenMode::YamahaGraphics5) { - // TODO: a much smarter loop. for(int c = start >> 1; c < end >> 1; c++) { pixel_target_[c] = Storage::palette_[ buffer.bitmap[c >> 2] >> ((((c & 3) ^ 3) << 1)) & 3 @@ -310,13 +320,18 @@ template void Base::draw_yamaha(int start, int end) { LineBuffer &line_buffer = line_buffers_[output_pointer_.row]; +#define Dispatch(x) case ScreenMode::x: draw_yamaha(line_buffer, start, end); break; if constexpr (is_yamaha_vdp(personality)) { switch(line_buffer.screen_mode) { - case ScreenMode::YamahaGraphics5: draw_yamaha(line_buffer, start, end); break; - + Dispatch(YamahaGraphics3); + Dispatch(YamahaGraphics4); + Dispatch(YamahaGraphics5); + Dispatch(YamahaGraphics6); + Dispatch(YamahaGraphics7); default: break; } } +#undef Dispatch } // MARK: - Mega Drive