From 15dc4ce03affe713a86bd3cd26149c5979d2da04 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:11:52 -0300 Subject: [PATCH] chore(io): DISPSTAT bits 3 and 4 better match GBATEK documentation --- src/scheduler.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/scheduler.zig b/src/scheduler.zig index 0718942..467887c 100644 --- a/src/scheduler.zig +++ b/src/scheduler.zig @@ -44,7 +44,6 @@ pub const Scheduler = struct { bus.ppu.drawScanline(&bus.io); bus.io.vcount.scanline.write(new_scanline); - bus.io.dispstat.hblank.unset(); if (new_scanline < 160) { // Transitioning to another Draw @@ -69,6 +68,8 @@ pub const Scheduler = struct { const new_scanline = scanline + 1; bus.io.vcount.scanline.write(new_scanline); + if (new_scanline == 227) bus.io.dispstat.vblank.unset(); + if (new_scanline < 228) { // Transition to another Vblank self.push(.VBlank, self.tick + (308 * 4)); @@ -76,7 +77,7 @@ pub const Scheduler = struct { // Transition to another Draw bus.io.vcount.scanline.write(0); // Reset Scanline - bus.io.dispstat.vblank.unset(); + // DISPSTAT was disabled on scanline 227 self.push(.Draw, self.tick + (240 * 4)); } },