Skip to content

Commit

Permalink
Only store lower 6-bits of the palette entry value
Browse files Browse the repository at this point in the history
  • Loading branch information
SirBob01 committed Oct 15, 2023
1 parent b22c727 commit feb58ad
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/ppu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit feb58ad

Please sign in to comment.