Skip to content

Commit

Permalink
fix off-by-one error when for scanline number
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanballs committed Oct 4, 2024
1 parent 9601f80 commit d3f1957
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mmu/ppu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ impl PPU {

// Full line takes 114 ticks
if self.modeclock >= 456 {
self.modeclock -= 456;
self.ly = (self.ly + 1) % 154;

if self.ly < SCREEN_HEIGHT as u8 {
self.render_scanline(self.ly);
}

self.modeclock -= 456;
self.ly = (self.ly + 1) % 154;

// Enter mode 1 (VBLANK)
if self.ly == 144 {
self.vblank_irq = true
Expand Down

0 comments on commit d3f1957

Please sign in to comment.