chore: don't assume 1cpi when stepping by a frame

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-10-21 05:12:30 -03:00
parent 147f6ac9ec
commit b76481b34c
1 changed files with 3 additions and 2 deletions

View File

@ -43,8 +43,9 @@ pub fn run(kind: RunKind, quit: *Atomic(bool), fps: *FpsAverage, sched: *Schedul
} }
pub fn runFrame(sched: *Scheduler, cpu: *Arm7tdmi, bus: *Bus) void { pub fn runFrame(sched: *Scheduler, cpu: *Arm7tdmi, bus: *Bus) void {
var cycles: u64 = 0; const frame_end = sched.tick + cycles_per_frame;
while (cycles < cycles_per_frame) : (cycles += 1) {
while (sched.tick < frame_end) {
sched.tick += 1; sched.tick += 1;
_ = cpu.step(); _ = cpu.step();