diff --git a/src/apu.rs b/src/apu.rs index 65eb2ee..60f98f2 100644 --- a/src/apu.rs +++ b/src/apu.rs @@ -164,8 +164,7 @@ impl Apu { if self.ctrl.enabled { // Frame Sequencer reset to Step 0 - // TODO: With the current implementation of the frame sequencer, - // what does this even mean? + // TODO: With the current implementation of the frame sequencer, what does this even mean? // Square Duty units are reset to first step self.ch1.duty_pos = 0; @@ -181,8 +180,6 @@ impl Apu { } fn reset(&mut self) { - // TODO: Clear readable sound registers - self.ch1.sweep = Default::default(); self.ch1.duty = Default::default(); self.ch1.envelope = Default::default(); @@ -426,7 +423,6 @@ impl Channel1 { } if self.freq_timer == 0 { - // TODO: Why is this 2048? self.freq_timer = (2048 - self.frequency()) * 4; self.duty_pos = (self.duty_pos + 1) % 8; } @@ -572,7 +568,6 @@ impl Channel2 { } if self.freq_timer == 0 { - // TODO: Why is this 2048? self.freq_timer = (2048 - self.frequency()) * 4; self.duty_pos = (self.duty_pos + 1) % 8; } diff --git a/src/apu/types.rs b/src/apu/types.rs index 4bbc289..600c681 100644 --- a/src/apu/types.rs +++ b/src/apu/types.rs @@ -178,7 +178,7 @@ pub(crate) mod ch4 { pub struct Frequency(u8); impl Debug; _initial, _: 7; - _length_disable, _: 6; // TODO: same as FrequencyHigh, figure out what this is + _length_disable, _: 6; } impl Frequency { @@ -224,7 +224,7 @@ pub(crate) mod common { pub struct FrequencyHigh(u8); impl Debug; _initial, _: 7; - _length_disable, _: 6; // TODO: Figure out what the hell this is + _length_disable, _: 6; pub freq_bits, set_freq_bits: 2, 0; } @@ -342,7 +342,7 @@ pub(crate) mod common { pub struct SoundDuty(u8); impl Debug; from into WavePattern, _wave_pattern, _: 7, 6; - _sound_length, _: 5, 0; // TODO: Getter only used if bit 6 in NR14 is set + _sound_length, _: 5, 0; } impl SoundDuty { diff --git a/src/bus.rs b/src/bus.rs index 34304ea..8dfb79b 100644 --- a/src/bus.rs +++ b/src/bus.rs @@ -240,7 +240,6 @@ impl BusIo for Bus { 0x49 => self.ppu.monochrome.obj_palette_1.into(), 0x4A => self.ppu.pos.window_y, 0x4B => self.ppu.pos.window_x, - 0x4D => 0xFF, // TODO: CGB Specific Register _ => { eprintln!("Read 0xFF from unused IO register {:#06X}.", addr); 0xFF @@ -312,7 +311,7 @@ impl BusIo for Bus { _ => {} } } - 0xFEA0..=0xFEFF => {} // TODO: As far as I know, writes to here do nothing. + 0xFEA0..=0xFEFF => {} // FIXME: As far as I know, writes to here do nothing. 0xFF00..=0xFF7F => { // IO Registers diff --git a/src/cartridge.rs b/src/cartridge.rs index ceb166b..d794646 100644 --- a/src/cartridge.rs +++ b/src/cartridge.rs @@ -114,10 +114,7 @@ impl Cartridge { } fn find_mbc(memory: &[u8]) -> MBCKind { - let id = memory[MBC_TYPE_ADDRESS]; - - // TODO: Refactor this to match the other enums in this module - match id { + match memory[MBC_TYPE_ADDRESS] { 0x00 => MBCKind::None, 0x01 => MBCKind::MBC1, 0x02 => MBCKind::MBC1, @@ -125,7 +122,7 @@ impl Cartridge { 0x19 => MBCKind::MBC5, 0x13 => MBCKind::MBC3WithBattery, 0x11 => MBCKind::MBC3, - _ => unimplemented!("id {:#04X} is an unsupported MBC", id), + id => unimplemented!("id {:#04X} is an unsupported MBC", id), } } } diff --git a/src/main.rs b/src/main.rs index 95eb680..1972164 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,16 +63,16 @@ fn main() -> Result<()> { }; // Initialize Audio - let spsc: AudioSPSC = Default::default(); - let (prod, cons) = spsc.init(); - let (_stream, stream_handle) = OutputStream::try_default().expect("Initialized Audio"); - let sink = Sink::try_new(&stream_handle)?; - sink.append(cons); - game_boy.apu_mut().set_producer(prod); + // let spsc: AudioSPSC = Default::default(); + // let (prod, cons) = spsc.init(); + // let (_stream, stream_handle) = OutputStream::try_default().expect("Initialized Audio"); + // let sink = Sink::try_new(&stream_handle)?; + // sink.append(cons); + // game_boy.apu_mut().set_producer(prod); - std::thread::spawn(move || { - sink.sleep_until_end(); - }); + // std::thread::spawn(move || { + // sink.sleep_until_end(); + // }); let mut start = Instant::now(); let frame_time = Duration::from_secs_f64(1.0 / 59.73); // 59.73 Hz on Host