I am programming an emulator and my colours are wrong. After a lot of searching, I think that I haven't fully understood how the palettes works.
From the explanation on NesDev, the background palettes are arranged like this:
$3F01-$3F03 Background palette 0
$3F05-$3F07 Background palette 1
$3F09-$3F0B Background palette 2
$3F0D-$3F0F Background palette 3
For my RGB palettes, I got 64 colours. When I am building up the bits from the pattern table and the attribute table, I am taking the 2 upper bits from the attribute table and the 2 lowers from the pattern table (1st bit from the first address, 2nd bit from the address + 8). Then, this gives me a number from 0 to 15 (0xf). So, I take this number and I add it to 3F00 to get the correct address. For example, let's say that the value is 5 so, the address is 3F05. Then I read the value in this address (3F05) and I use this value as the index one of the 64 colours in the palettes.
Is it right? I am trying to run balloon fight, but the background is always gray : RGB(128,128,128), like the 0 index palette entry.
I feel that there is probably another pointer that I am not aware of...
From the explanation on NesDev, the background palettes are arranged like this:
$3F01-$3F03 Background palette 0
$3F05-$3F07 Background palette 1
$3F09-$3F0B Background palette 2
$3F0D-$3F0F Background palette 3
For my RGB palettes, I got 64 colours. When I am building up the bits from the pattern table and the attribute table, I am taking the 2 upper bits from the attribute table and the 2 lowers from the pattern table (1st bit from the first address, 2nd bit from the address + 8). Then, this gives me a number from 0 to 15 (0xf). So, I take this number and I add it to 3F00 to get the correct address. For example, let's say that the value is 5 so, the address is 3F05. Then I read the value in this address (3F05) and I use this value as the index one of the 64 colours in the palettes.
Is it right? I am trying to run balloon fight, but the background is always gray : RGB(128,128,128), like the 0 index palette entry.
I feel that there is probably another pointer that I am not aware of...