Hi mister-e.

Your code, after fixing the start/loop and flag issues, does not work on power up. It does work after a MCLR reset but so do all my attempts.

I am trying now to implement the full reset sequence in code.