You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ppu.rs
+11-4Lines changed: 11 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,7 @@ pub struct Ppu {
49
49
vram:[u8;2048],
50
50
51
51
/// Palette Table
52
+
/// Backgrounds and sprites each have 4 palettes of 4 colors located at $3F00-$3F1F in VRAM
52
53
palette_table:[u8;32],
53
54
oam_data:[u8;256],
54
55
@@ -74,7 +75,7 @@ pub struct PaletteIdx(usize);
74
75
pubstructSprite{
75
76
pubx:u8,
76
77
puby:u8,
77
-
pubuse_tile_bank_1:bool,
78
+
pubuse_pattern_table_1:bool,
78
79
pubtile_idx:u8,
79
80
pubis_8_by_16:bool,
80
81
pubpalette_idx:PaletteIdx,
@@ -226,7 +227,7 @@ impl Ppu {
226
227
Sprite{
227
228
x,
228
229
y,
229
-
use_tile_bank_1: pattern_table_idx == 1,
230
+
use_pattern_table_1: pattern_table_idx == 1,
230
231
tile_idx,
231
232
is_8_by_16,
232
233
palette_idx,
@@ -401,7 +402,13 @@ impl Ppu {
401
402
}
402
403
403
404
fnmirror_palettes_addr(&mutself,addr:u16) -> u16{
404
-
(addr - 0x3F00) % (self.palette_table.len()asu16)
405
+
match addr {
406
+
// Note that entry 0 of each palette is also unique in that its color value is shared between the background and sprite palettes, so writing to either one updates the same internal storage.
407
+
// This means that the backdrop color can be written through both $3F00 and $3F10.
0 commit comments