I am working on a Noise Generator that uses the Linear Feedback Shift Register algorithm, but I am stuck. LFSR was used for the Noise channel in the NES and GameBoy, and that's the sound I am going for. LFSR generates a pseudorandom sequence through bit shift. The feedback loop works like this:
You start with a fixed-length register as the seed (I am using 15 bits in the example). And then, every time the LSFR is triggered, it does the following:
XOR bits 0 and 1 (the two right-most bits in the sequence)
Right-shift the sequence (It's now 1 bit shorter)
Put the XOR result into the empty last bit (the left-most bit)
I got it to work in Message Land with no problem:
[Left: verbose version - Right: condensed version]

But I am stuck trying to move this to signal, mostly because I don't fully understand fexpr~:
I guess I should use fexpr~ since I am using feedback here? Also because every bit in the sequence corresponds to a sample and I need to look up earlier samples to generate the next step (Again, guessing). I am also unsure about the difference between $x and $y. I am guessing I would have to use $y too for this, not just $x. But how do I send an output back as an input, to keep the loop running?
Here's an attempt at converting the above message version to signal, but it obviously doesn't work (I stubbornly tried to connect the right-most outlet to the left-most inlet but that gives a DSP Loop Error of course):

I would also like to be able to control the clock speed for this, but that would probably just be with sample and hold once the main part is done.
Here's the patch so far:
lfsr_expr_stuck.pd
Thanks for having a look!
And here are the websites I used as sources if anyone is interested:
https://gbadev.net/gbadoc/audio/sound4.html
https://gbdev.gg8.se/wiki/articles/Gameboy_sound_hardware
https://www.mjsyts.com/development/lfsr-noise-part-1/

Thanks for this, I've come a bit closer to understanding fexpr~ now through your help, never used fexpr~ before.