Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
SirBob01 committed Nov 27, 2023
1 parent d1cfe64 commit f117e32
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ppu.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ void create_ppu(ppu_t *ppu, ppu_bus_t *bus, interrupt_t *interrupt) {
ppu->suppress_vbl = false;
ppu->suppress_nmi = false;

ppu->sprite_index = 0;
ppu->sprite_m = 0;
ppu->sprite_count = 0;
ppu->sprite_count_latch = 0;

create_event_tables_ppu(ppu);
}

Expand Down Expand Up @@ -430,6 +435,7 @@ bool sprite_in_range_ppu(ppu_t *ppu, unsigned char y) {
}

void evaluate_sprites_ppu(ppu_t *ppu) {
// TODO: This algorithm is iffy
if (ppu->sprite_index >= 64) {
return;
}
Expand Down Expand Up @@ -457,7 +463,9 @@ void evaluate_sprites_ppu(ppu_t *ppu) {
ppu->sprite_indices[ppu->sprite_count] = ppu->sprite_index;
ppu->sprite_m = 0;
ppu->sprite_index++;
ppu->sprite_count++;
if (ppu->sprite_count < 8) {
ppu->sprite_count++;
}
}
}
}
Expand Down

0 comments on commit f117e32

Please sign in to comment.