Skip to content
Snippets Groups Projects
Verified Commit c57db943 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: support for the hblank and vblank

parent e312908a
No related branches found
No related tags found
No related merge requests found
......@@ -92,8 +92,37 @@ impl Ppu {
self.mode = PpuMode::Hblank;
}
}
PpuMode::Hblank => todo!(),
PpuMode::VBlank => todo!(),
PpuMode::Hblank => {
if self.mode_clock >= 204 {
self.line += 1;
// in case we've reached the end of the
// screen we're now entering the v-blank
if self.line == 143 {
self.mode = PpuMode::VBlank;
// self.drawData @todo implement this one
} else {
self.mode = PpuMode::OamRead;
}
self.mode_clock = 0;
}
}
PpuMode::VBlank => {
if self.mode_clock >= 456 {
self.line += 1;
// in case the end of v-blank has been reached then
// we must jump again to the OAM read mode and reset
// the scan line counter to the zero value
if self.line == 153 {
self.mode = PpuMode::OamRead;
self.line = 0;
}
self.mode_clock = 0;
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment