From e613f3054c956d225d5f23b7f16d2af7d131a4c6 Mon Sep 17 00:00:00 2001 From: Nathaniel Walizer Date: Sun, 16 Mar 2025 17:18:54 -0700 Subject: [PATCH] Fix palette transparency bug --- src/f6502.c | 2 +- src/linux/port.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/f6502.c b/src/f6502.c index 84ffeda..b590dee 100644 --- a/src/f6502.c +++ b/src/f6502.c @@ -198,7 +198,7 @@ static inline bool f6502_write(nes_Memory* mem, // Copy to render reference addr &= 0x1FU; uint8_t* pal = mem->ppu.palette; - if (0 == (addr & 0xF)) { + if (0 == (addr & 0x3)) { // TODO: Just initialize this pal[0] = pal[4] = pal[8] = pal[12] = pal[16] = pal[20] = pal[24] = diff --git a/src/linux/port.c b/src/linux/port.c index 89362c1..0379d02 100644 --- a/src/linux/port.c +++ b/src/linux/port.c @@ -123,6 +123,24 @@ int nese_frame_ready(void* plat_data) { t_last = t_now; */ +/* + uint8_t* ptr = &plat->sys->core.memory.ppu.vram[0x3C0]; + for (int y = 0; y < 16; y += 2) { + printf("%04lX", 0x2000 + ptr - plat->sys->core.memory.ppu.vram); + for (int x = 0; x < 8; ++x) { + printf(" %d %d", (*ptr >> 0) & 3, (*ptr >> 2) & 3); + ++ptr; + } + ptr -= 8; + fputs("\n ", stdout); + for (int x = 0; x < 8; ++x) { + printf(" %d %d", (*ptr >> 4) & 3, (*ptr >> 6) & 3); + ++ptr; + } + putc('\n', stdout); + } + putc('\n', stdout); +*/ SDL_BlitSurface(plat->screen, NULL, plat->target, NULL);