From feb58ad52b925dd6a35eb6d9d22d2558bacf05a1 Mon Sep 17 00:00:00 2001 From: Keith Leonardo Date: Sun, 15 Oct 2023 23:17:56 +1100 Subject: [PATCH] Only store lower 6-bits of the palette entry value --- src/ppu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ppu.c b/src/ppu.c index b184c68..323930e 100644 --- a/src/ppu.c +++ b/src/ppu.c @@ -115,6 +115,7 @@ unsigned char read_palette_ppu(ppu_t *ppu, unsigned char palette_index) { void write_palette_ppu(ppu_t *ppu, unsigned char palette_index, unsigned char value) { + value &= 0x3F; // Only include the lower 6 bits ppu->palette[palette_index] = value; if ((palette_index & 0x3) == 0) { ppu->palette[palette_index ^ 0x10] = value;