See here for some setup and to do some motor direction tests to get those moving correctly first.
https://duet3d.dozuki.com/Wiki/ConfiguringRepRapFirmwareCoreXYPrinter
The assumption is that 0,0 is the front left corner of the bed. -x moves left, +x moves right, -y moves forward, +y moves back.
The endstop position is defined in M574 at either the - side of travel (low end) or the positive side of travel (high end).
Then the homing direction is controlled by the homing files and should move towards the endstop.