chore(cpu): add inline fn isHalted()
This commit is contained in:
parent
db08edbdb9
commit
dba8873f76
|
@ -148,6 +148,10 @@ pub const Arm7tdmi = struct {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub inline fn isHalted(self: *const Self) bool {
|
||||||
|
return self.bus.io.haltcnt == .Halt;
|
||||||
|
}
|
||||||
|
|
||||||
pub fn setCpsr(self: *Self, value: u32) void {
|
pub fn setCpsr(self: *Self, value: u32) void {
|
||||||
if (value & 0x1F != self.cpsr.raw & 0x1F) self.changeModeFromIdx(@truncate(u5, value & 0x1F));
|
if (value & 0x1F != self.cpsr.raw & 0x1F) self.changeModeFromIdx(@truncate(u5, value & 0x1F));
|
||||||
self.cpsr.raw = value;
|
self.cpsr.raw = value;
|
||||||
|
|
|
@ -52,7 +52,7 @@ pub fn runFrame(sched: *Scheduler, cpu: *Arm7tdmi) void {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
while (sched.tick < std.math.min(frame_end, sched.nextTimestamp())) {
|
while (sched.tick < std.math.min(frame_end, sched.nextTimestamp())) {
|
||||||
if (cpu.bus.io.haltcnt == .Execute) cpu.step() else sched.tick += 1;
|
if (!cpu.isHalted()) cpu.step() else sched.tick += 1;
|
||||||
cpu.handleDMATransfers();
|
cpu.handleDMATransfers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue