4 shift registers in and out getting artifact

(xFirst - 255) * -1)

It looks like you are trying to invert the bits. You should probably use the bit inversion operator:
~xFirst

And since these are 8-bit registers, you should probably use 'byte' values rather than 'int'.

1 Like