feat(sched): add HBlank and VBlank events to the scheduler

This commit is contained in:
2022-01-05 17:34:42 -05:00
parent 5037b8f0cc
commit f709458638
6 changed files with 25 additions and 13 deletions

View File

@@ -4,14 +4,14 @@ const Bus = @import("bus.zig").Bus;
const cycles_per_frame: u64 = 100; // TODO: How many cycles actually?
pub fn runFrame(sch: *Scheduler, cpu: *Arm7tdmi, bus: *Bus) void {
pub fn runFrame(sched: *Scheduler, cpu: *Arm7tdmi, bus: *Bus) void {
var cycles: u64 = 0;
while (cycles < cycles_per_frame) : (cycles += 1) {
sch.tick += 1;
sched.tick += 1;
_ = cpu.step();
while (sch.tick >= sch.nextTimestamp()) {
sch.handleEvent(cpu, bus);
while (sched.tick >= sched.nextTimestamp()) {
sched.handleEvent(cpu, bus);
}
}
}