Does it need to be split in some logical manner? Or can it be split pretty much anywhere as long as you don't split it in the middle of an action?500 lines is quite a bit of code, a way around it is to split the program up into 2 or 3 separate ones etc.!
Max.
Have you done CNC on PCBs?