tmp: implement mechanisms for a emu reset fn (currently crashes)

This commit is contained in:
2023-02-23 22:12:06 -06:00
parent 3fff4fd742
commit d985eac0fc
15 changed files with 131 additions and 30 deletions

View File

@@ -3,17 +3,16 @@ const io = @import("../../bus/io.zig");
const Self = @This();
/// Period Timer
timer: u3,
timer: u3 = 0,
/// Current Volume
vol: u4,
vol: u4 = 0,
pub fn create() Self {
return .{ .timer = 0, .vol = 0 };
return .{};
}
pub fn reset(self: *Self) void {
self.timer = 0;
self.vol = 0;
self.* = .{};
}
pub fn tick(self: *Self, nrx2: io.Envelope) void {

View File

@@ -1,13 +1,13 @@
const Self = @This();
timer: u9,
timer: u9 = 0,
pub fn create() Self {
return .{ .timer = 0 };
return .{};
}
pub fn reset(self: *Self) void {
self.timer = 0;
self.* = .{};
}
pub fn tick(self: *Self, enabled: bool, ch_enable: *bool) void {

View File

@@ -3,26 +3,18 @@ const ToneSweep = @import("../ToneSweep.zig");
const Self = @This();
timer: u8,
enabled: bool,
shadow: u11,
timer: u8 = 0,
enabled: bool = false,
shadow: u11 = 0,
calc_performed: bool,
calc_performed: bool = false,
pub fn create() Self {
return .{
.timer = 0,
.enabled = false,
.shadow = 0,
.calc_performed = false,
};
return .{};
}
pub fn reset(self: *Self) void {
self.timer = 0;
self.enabled = false;
self.shadow = 0;
self.calc_performed = false;
self.* = .{};
}
pub fn tick(self: *Self, ch1: *ToneSweep) void {