Repository navigation
Fix Freeboy noise channel playback for srw = 1. - #4538
Conversation
|
Oops, seems like some debug include got left in there. Will be removing that later today. |
In order for `GB_apu` to correctly generate samples when the LSFR width is set to `7`, the trigger write to `0xff23` must happen after all other writes.
50e31a5 to
c5dbb7d
Compare
|
@PhysSong This looks like a pretty simple fix. Do you want to merge this into 1.2 since it's technically not a feature or defer it to 1.3? @BonsaiDen Could you give a bit more information at a higher level as to what issue this PR solves? |
|
@Secondflight Sure thing. If you set up channel 4 with the However, if you switch the What would be expected instead is a similar waveform but with a "faster" sounding noise. The issues arises from the way the APU registers on the GameBoy must be accessed. Writing the enable bit (1000_0000) to This is what causes the "silent" output above. Moving the output enable write so it occurs after the noise channel registers have all been set up (as in the PR) fixes this issue :) |
|
@BonsaiDen Thank you for the detailed explanation! |
|
Read the CPU's manual and looks good. The only concerns are possible minor compatibility issues. |
Writing the enable bit to `FF23` causes the noise oscillator to start outputting samples and writing the other registers (including the one for the SRW value) during the time the oscillator is active has undefined behaviour. In order for `GB_apu` to correctly generate samples when the LSFR width is set to `7`, the trigger write to `0xff23` must happen after all other writes.


In order for
GB_aputo correctly generate samples when the LSFR width isset to
7, the trigger write to0xff23must happen after all otherwrites.