The best way I’ve found to set how X & Y works on a CoreXY is to set up a table listing whether or not the DIR pin operates normally or negated (ie with a “!”) before it:
X | Y | Result
--+---+--------------------------------------------
| | Movement with X & Y both Normal
--+---+--------------------------------------------
! | | Movement with just X negated
--+---+--------------------------------------------
! | ! | Movement with both negated
--+---+--------------------------------------------
| ! | Movement with just Y negated
I know it’s only two variables, but unless you put them down explicitly on paper and then test it, you end up missing something and going round and round and getting frustrated.