Minor improvements to APU
Some checks failed
Cargo Build & Test / Rust project - latest (stable) (push) Failing after 9s

This commit is contained in:
2026-04-08 21:16:54 -05:00
parent 875e493cd2
commit f84009aeb9
4 changed files with 156 additions and 14 deletions

View File

@@ -1,7 +1,3 @@
use std::iter::repeat_n;
use tracing::debug;
macro_rules! lut {
($name:ident: [$ty:ty; $len:expr] = |$n:ident| $expr:expr) => {
const $name: [$ty; $len] = {
@@ -264,7 +260,7 @@ Output: {16:>4} ${16:02X}
self.sweep.period(),
self.sweep.enable(),
self.period,
0,
self.counter.current,
self.enabled,
self.period_timer,
self.cur, // ?
@@ -423,6 +419,7 @@ bitfield::bitfield! {
}
#[derive(Debug, Clone)]
#[allow(dead_code)]
struct NoiseChannel {
enabled: bool,
evelope: NoiseEnvelope,
@@ -447,7 +444,7 @@ impl NoiseChannel {
}
}
pub fn write(&mut self, offset: u16, val: u8) {
pub fn write(&mut self, offset: u16, _val: u8) {
match offset {
0x00 => (),
0x01 => (),
@@ -505,7 +502,7 @@ impl DeltaChannel {
}
}
pub fn write(&mut self, offset: u16, val: u8) {
pub fn write(&mut self, offset: u16, _val: u8) {
match offset {
0x00 => (),
0x01 => (),
@@ -553,12 +550,21 @@ pub struct APU {
impl std::fmt::Debug for APU {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
// write!(
// f,
// "PPU: f {}, s {}, p {}",
// self.frame_count, self.scanline, self.pixel
// )
Ok(())
write!(
f,
"APU
{:#?}
{:#?}
{:#?}
{:#?}
{:#?}
",
self.pulse_1,
self.pulse_2,
self.triangle,
self.noise,
self.dmc,
)
}
}
@@ -577,7 +583,7 @@ impl APU {
irq: false,
},
samples: vec![0; 100],
samples: Vec::with_capacity(10000),
}
}
@@ -739,3 +745,6 @@ mod apu_iced {
}
}
}
#[cfg(test)]
mod tests;