summaryrefslogtreecommitdiff
path: root/mknes_ppu.c
diff options
context:
space:
mode:
Diffstat (limited to 'mknes_ppu.c')
-rw-r--r--mknes_ppu.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/mknes_ppu.c b/mknes_ppu.c
index 870439b..1a40de0 100644
--- a/mknes_ppu.c
+++ b/mknes_ppu.c
@@ -322,13 +322,22 @@ shift_and_fetch:
}
}
}
+
+ goto rendering_done;
+ }
+
+ if(dot == 256) { // NOTE(peter): THIS IS EXPENSIVE
+ ppu->sprite_count = 0;
}
+rendering_done:
+
if(dot == 1) {
switch(scanline) {
case 241: {
ppu->reg_status |= PPU_STATUS_VBLANK;
state->cpu.nmi_pending = (ppu->reg_ctrl & PPU_CTRL_NMI);
+ ppu->frame_ready = 1;
} break;
case 261: {
@@ -339,6 +348,7 @@ shift_and_fetch:
}
}
+
dot++;
if(dot > 340) {
dot = 0;
@@ -350,7 +360,6 @@ shift_and_fetch:
if(scanline > 261) {
scanline = 0;
- ppu->frame_ready = 1;
ppu->even_frame = !ppu->even_frame;
}