chore: ensure consistency across project
This commit is contained in:
parent
19077200cd
commit
8bbf7b2d31
|
@ -233,11 +233,11 @@ fn execute(cpu: *Cpu, display: *Display, mem: *[0x1000]u8, instr: Instruction) v
|
|||
},
|
||||
.LD_DT_Vx => |x| {
|
||||
const when = scheduler.now() + OPS_PER_HZ * @as(u64, cpu.v[x]);
|
||||
scheduler.ReplaceOrPush(EventKind.DelayTimer, when);
|
||||
scheduler.replaceOrPush(EventKind.DelayTimer, when);
|
||||
},
|
||||
.LD_ST_Vx => |x| {
|
||||
const when = scheduler.now() + OPS_PER_HZ * @as(u64, cpu.v[x]);
|
||||
scheduler.ReplaceOrPush(EventKind.SoundTimer, when);
|
||||
scheduler.replaceOrPush(EventKind.SoundTimer, when);
|
||||
},
|
||||
.ADD_I_Vx => |x| {
|
||||
const sum: u16 = cpu.i + cpu.v[x];
|
||||
|
@ -248,8 +248,7 @@ fn execute(cpu: *Cpu, display: *Display, mem: *[0x1000]u8, instr: Instruction) v
|
|||
cpu.i = 0x50 + (5 * cpu.v[x]);
|
||||
},
|
||||
.LD_B_Vx => |x| {
|
||||
var value = cpu.v[x];
|
||||
|
||||
const value = cpu.v[x];
|
||||
mem[cpu.i] = value / 100;
|
||||
mem[cpu.i + 1] = (value / 10) % 10;
|
||||
mem[cpu.i + 2] = value % 10;
|
||||
|
|
|
@ -38,7 +38,7 @@ pub const Scheduler = struct {
|
|||
self.pushEvent(Event{ .kind = kind, .timestamp = when });
|
||||
}
|
||||
|
||||
pub fn ReplaceOrPush(self: *Scheduler, kind: EventKind, when: u64) void {
|
||||
pub fn replaceOrPush(self: *Scheduler, kind: EventKind, when: u64) void {
|
||||
if (self.find(kind)) |event| {
|
||||
self.queue.update(event, Event{ .kind = kind, .timestamp = when }) catch unreachable;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue