chore: contain Timers in a tuple rather than a struct

This commit is contained in:
2022-10-21 05:12:42 -03:00
parent 8826242bf3
commit 5d5d3827fb
4 changed files with 45 additions and 58 deletions

View File

@@ -10,7 +10,7 @@ const Iwram = @import("bus/Iwram.zig");
const Ppu = @import("ppu.zig").Ppu;
const Apu = @import("apu.zig").Apu;
const DmaTuple = @import("bus/dma.zig").DmaTuple;
const Timers = @import("bus/timer.zig").Timers;
const TimerTuple = @import("bus/timer.zig").TimerTuple;
const Scheduler = @import("scheduler.zig").Scheduler;
const FilePaths = @import("util.zig").FilePaths;
@@ -19,6 +19,7 @@ const Allocator = std.mem.Allocator;
const log = std.log.scoped(.Bus);
const createDmaTuple = @import("bus/dma.zig").create;
const createTimerTuple = @import("bus/timer.zig").create;
const rotr = @import("util.zig").rotr;
const Self = @This();
@@ -27,7 +28,7 @@ bios: Bios,
ppu: Ppu,
apu: Apu,
dma: DmaTuple,
tim: Timers,
tim: TimerTuple,
iwram: Iwram,
ewram: Ewram,
io: Io,
@@ -44,7 +45,7 @@ pub fn init(alloc: Allocator, sched: *Scheduler, paths: FilePaths) !Self {
.iwram = try Iwram.init(alloc),
.ewram = try Ewram.init(alloc),
.dma = createDmaTuple(),
.tim = Timers.init(sched),
.tim = createTimerTuple(sched),
.io = Io.init(),
.cpu = null,
.sched = sched,