chore: ensure consistency across project

This commit is contained in:
Rekai Nyangadzayi Musuka 2021-10-26 20:10:22 -03:00
parent 19077200cd
commit 8bbf7b2d31
2 changed files with 4 additions and 5 deletions

View File

@ -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;

View File

@ -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 {