feat(apu): clock pulse/triangle/noise timers and sequencers

This commit is contained in:
2026-03-13 16:07:57 +03:00
parent cd0a99a813
commit 49568a582b
2 changed files with 63 additions and 0 deletions

View File

@@ -67,6 +67,8 @@ impl Apu {
0x4003 => {
self.reload_length_counter(0, value >> 3);
self.envelope_start_flags |= 1 << 0;
self.pulse_duty_step[0] = 0;
self.pulse_timer_counter[0] = self.pulse_timer_period(0x02);
}
0x4001 => {
self.sweep_reload_flags |= 1 << 0;
@@ -74,6 +76,8 @@ impl Apu {
0x4007 => {
self.reload_length_counter(1, value >> 3);
self.envelope_start_flags |= 1 << 1;
self.pulse_duty_step[1] = 0;
self.pulse_timer_counter[1] = self.pulse_timer_period(0x06);
}
0x4005 => {
self.sweep_reload_flags |= 1 << 1;
@@ -160,6 +164,9 @@ impl Apu {
self.clock_frame_counter();
}
self.clock_dmc();
self.clock_pulse_timers();
self.clock_triangle_timer();
self.clock_noise_timer();
self.cpu_cycle_parity = !self.cpu_cycle_parity;
}