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

This commit is contained in:
Rekai Nyangadzayi Musuka 2022-03-29 09:06:26 -03:00
parent e127669549
commit 3046e6243a
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 {
var cycles: u64 = 0;
while (cycles < cycles_per_frame) : (cycles += 1) {
const frame_end = sched.tick + cycles_per_frame;
while (sched.tick < frame_end) {
sched.tick += 1;
_ = cpu.step();