summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2022-12-15 01:50:18 +0300
committerOxore <oxore@protonmail.com>2022-12-15 01:50:18 +0300
commit3b142d4b0d8e3300999dddf0cf9d43b05a4f0f16 (patch)
treeb1d698f0231d42b7f0686f9973e6a89f8c7851ae
parent695242c3d8a6659dd6af80a7aabba38290eedb9b (diff)
Fix showing the color palette
-rw-r--r--vdp.cpp14
1 files 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;
}