From c4aea446d34638f229543d224dfc9f75fc4b0a0a Mon Sep 17 00:00:00 2001 From: Jeff Linahan Date: Mon, 12 Jun 2023 02:03:37 -0400 Subject: [PATCH 1/2] sfc: noise linear feedback shift register state constructed with or not xor --- ares/sfc/dsp/misc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ares/sfc/dsp/misc.cpp b/ares/sfc/dsp/misc.cpp index 32690c8b57..30e3c44b76 100644 --- a/ares/sfc/dsp/misc.cpp +++ b/ares/sfc/dsp/misc.cpp @@ -24,6 +24,6 @@ auto DSP::misc30() -> void { //noise if(counterPoll(noise.frequency)) { s32 feedback = noise.lfsr << 13 ^ noise.lfsr << 14; - noise.lfsr = feedback & 0x4000 ^ noise.lfsr >> 1; + noise.lfsr = feedback & 0x4000 | noise.lfsr >> 1; } } From 1ed43da8a922fa7094aa327f0369f40452a47181 Mon Sep 17 00:00:00 2001 From: Jeff Linahan Date: Fri, 30 Jun 2023 15:58:33 -0400 Subject: [PATCH 2/2] sfc: brr bank -> brr page --- ares/sfc/dsp/dsp.hpp | 4 ++-- ares/sfc/dsp/memory.cpp | 2 +- ares/sfc/dsp/misc.cpp | 2 +- ares/sfc/dsp/serialization.cpp | 4 ++-- ares/sfc/dsp/voice.cpp | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ares/sfc/dsp/dsp.hpp b/ares/sfc/dsp/dsp.hpp index 70104e6708..1d274a3f9b 100644 --- a/ares/sfc/dsp/dsp.hpp +++ b/ares/sfc/dsp/dsp.hpp @@ -77,9 +77,9 @@ struct DSP : Thread { } noise; struct BRR { - n8 bank; + n8 page; - n8 _bank; + n8 _page; n8 _source; n16 _address; n16 _nextAddress; diff --git a/ares/sfc/dsp/memory.cpp b/ares/sfc/dsp/memory.cpp index 0145a96cde..4047cb03ac 100644 --- a/ares/sfc/dsp/memory.cpp +++ b/ares/sfc/dsp/memory.cpp @@ -49,7 +49,7 @@ auto DSP::write(n7 address, n8 data) -> void { for(u32 n : range(8)) voice[n].echo = data.bit(n); break; case 0x5d: //DIR - brr.bank = data; + brr.page = data; break; case 0x6d: //ESA echo.bank = data; diff --git a/ares/sfc/dsp/misc.cpp b/ares/sfc/dsp/misc.cpp index 30e3c44b76..5d517ce359 100644 --- a/ares/sfc/dsp/misc.cpp +++ b/ares/sfc/dsp/misc.cpp @@ -4,7 +4,7 @@ auto DSP::misc27() -> void { auto DSP::misc28() -> void { for(auto& v : voice) v._noise = v.noise, v._echo = v.echo; - brr._bank = brr.bank; + brr._page = brr.page; } auto DSP::misc29() -> void { diff --git a/ares/sfc/dsp/serialization.cpp b/ares/sfc/dsp/serialization.cpp index c7b3b8ae96..0fd8988ae4 100644 --- a/ares/sfc/dsp/serialization.cpp +++ b/ares/sfc/dsp/serialization.cpp @@ -32,8 +32,8 @@ auto DSP::serialize(serializer& s) -> void { s(noise.frequency); s(noise.lfsr); - s(brr.bank); - s(brr._bank); + s(brr.page); + s(brr._page); s(brr._source); s(brr._address); s(brr._nextAddress); diff --git a/ares/sfc/dsp/voice.cpp b/ares/sfc/dsp/voice.cpp index cbdade0798..b390459141 100644 --- a/ares/sfc/dsp/voice.cpp +++ b/ares/sfc/dsp/voice.cpp @@ -14,7 +14,7 @@ inline auto DSP::voiceOutput(Voice& v, n1 channel) -> void { } auto DSP::voice1(Voice& v) -> void { - brr._address = (brr._bank << 8) + (brr._source << 2); + brr._address = (brr._page << 8) + (brr._source << 2); brr._source = v.source; }