From d68257bb294b31052c2dfde736319ee6a6c8068f Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Sat, 14 Aug 2021 22:03:01 -0500 Subject: [PATCH] fix(ppu): improve accuracy of SCX discard --- src/ppu.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ppu.rs b/src/ppu.rs index 3ebe413..df6208f 100644 --- a/src/ppu.rs +++ b/src/ppu.rs @@ -381,12 +381,12 @@ impl Ppu { } if self.fifo.is_enabled() { - if self.x_pos == 0 && !self.fifo.back.is_empty() && self.scanline_start { + if self.x_pos == 0 && self.scanline_start { self.to_discard = self.pos.scroll_x % 8; self.scanline_start = false; } - if self.to_discard > 0 { + if self.to_discard > 0 && !self.fifo.back.is_empty() { let _ = self.fifo.back.pop_front(); self.to_discard -= 1;