Skip to content

Commit

Permalink
Add channel 4 lfsr mode flip rom tests
Browse files Browse the repository at this point in the history
  • Loading branch information
YushiOMOTE committed Jul 31, 2024
1 parent 2c84ece commit 4e2c91d
Show file tree
Hide file tree
Showing 5 changed files with 311 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ Test status of [Same Suite](https://github.com/YushiOMOTE/SameSuite/tree/430ab7f
* [x] `apu/div_trigger_volume_10.gb`
* [x] `apu/channel_4/channel_4_lfsr.gb`
* [x] `apu/channel_4/channel_4_lfsr15.gb`
* [x] `apu/channel_4/channel_4_lfsr_7_15.gb`
* [x] `apu/channel_4/channel_4_lfsr_15_7.gb`

## Projects

Expand Down
5 changes: 5 additions & 0 deletions core/src/apu/noise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl Noise {
}

self.nr43 = Nr43::from_bits(value);
self.lfsr.set_mode(self.nr43.step());
}

/// Read NR44 register (0xff23)
Expand Down Expand Up @@ -277,6 +278,10 @@ impl Lfsr {
self.value = 0xff;
}

fn set_mode(&mut self, short: bool) {
self.short = short;
}

fn update(&mut self) {
// Xor bit 0 and 1.
let bit = (self.value & 1) ^ ((self.value & 2) >> 1) & 1;
Expand Down
Loading

0 comments on commit 4e2c91d

Please sign in to comment.