From 3b142d4b0d8e3300999dddf0cf9d43b05a4f0f16 Mon Sep 17 00:00:00 2001 From: Oxore Date: Thu, 15 Dec 2022 01:50:18 +0300 Subject: Fix showing the color palette --- vdp.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/vdp.cpp b/vdp.cpp index 08640fa..930af09 100644 --- a/vdp.cpp +++ b/vdp.cpp @@ -142,13 +142,14 @@ bool VDP::Scanline() return true; } const uint16_t lines_per_screen = _status.pal_mode ? kLinesPerScreenPAL : kLinesPerScreenNTSC; - if (_lines_counter + 1 == lines_per_screen) { + // TODO remove the `1 || ` part + if (1 || _lines_counter + 1 == lines_per_screen) { for (size_t i = 0; i < render_width; i++) { const size_t color_index = (i * 2) % kCRAMSize; - const uint16_t cram_color = ((_cram[color_index] & 0x1) << 8) | _cram[color_index + 1]; - const uint8_t blue = cram_color & 7; - const uint8_t green = (cram_color >> 3) & 7; - const uint8_t red = (cram_color >> 6) & 7; + const uint16_t cram_color = (((uint16_t)_cram[color_index]) << 8) | _cram[color_index + 1]; + const uint8_t blue = ((cram_color >> 9) & 7) << 4; + const uint8_t green = ((cram_color >> 5) & 7) << 4; + const uint8_t red = ((cram_color >> 1) & 7) << 4; const uint32_t color = 0xff000000 | (red << 16) | (green << 8) | blue; _rendered_buffer[render_width * _lines_counter + i] = color; } @@ -161,7 +162,8 @@ bool VDP::Scanline() if (_lines_counter >= lines_per_screen) { _lines_counter = 0; if (MODESET2_IE0_GET(mode_set_2)) { - m68k_set_irq(6); + // TODO somehow this acknowledgment messes up the `hello word` example + //m68k_set_irq(6); _status.vblank = true; return true; } -- cgit v1.2.3