In the site http://wiki.nesdev.com/w/index.php/APU_Noise, it clearly states "Feedback is calculated as the exclusive-OR of bit 0 and one other bit: bit 6 if Mode flag is set, otherwise bit 1. " It all starts at Bit 14. To get to Bit 6 you have to right shift 8 bits:
------------------------>
14-13-12-11-10-9-8-7-6-5-4-3-2-1-0
And I technically already small stepped it. Take a look at this C# code from another emulator that was commented inside the function:
Although ugly, if you break it down, its actuallyCode:'if (Noise.datatype) ' Noise.CurD = (Noise.CurD << 1) | (((Noise.CurD >> 14) ^ (Noise.CurD >> 8)) & 0x1); 'else Noise.CurD = (Noise.CurD << 1) | (((Noise.CurD >> 14) ^ (Noise.CurD >> 13)) & 0x1);
And even though I did it a tad different, the results were the same either way. Removing &H1 in any of those places resulted in a much higher pitched Noise.Code:'if (Noise.datatype){ ' Bit_0 = (Noise.CurD >> 14); ' Bit_6 = (Noise.CurD >> 8); ' Feedback = (Bit_0 ^ Bit_6); ' Noise.CurD = (Noise.CurD << 1) | (Feedback & 0x1); '} 'else { ' Bit_0 = (Noise.CurD >> 14); ' Bit_1 = (Noise.CurD >> 13); ' Feedback = (Bit_0 ^ Bit_1); ' Noise.CurD = (Noise.CurD << 1) | (Feedback & 0x1); '}
[EDIT] I was playing around with my emulators noise code and, not sure if you have or not but download my NES Emulator, and remove the ".Length_Counter > 0" if statement in the beginning of the function. Play Super Mario Bros, ignor the Noise sound for a minute (youll see why), grab a mushroom, and break a brick block. Youll hear something that was missing. The sound of bricks breaking with a nice bass thump. Although the length counter code is correct, I may have to do what the C++ emulator did, and actually use a lookup table that I can XOR tap.





Mark Thread Resolved
Reply With Quote