I am not sure how the Galil does the homing but I will give you an example of how my lathe homes.
 On my Lathe the homing is done externally from Mach, it is the servo drives that do the homing. I send a signal to the drive, it moves the axis until the drive sees the home switch being activated, the drive then searches for the index pulse on the encoder and then moves back a set distance of my choice. Once that is complete the drive sends a signal to Mach and Mach zeros the DRO, it then moves on to the next axis and does exactly the same. 
 I have custom VB code in my Ref All button to achieve this, it is as follows
DoOemButton (240)                     'De-Reference All axis
 Sleep(10)
 If GetOemLED (809) Then               'Check that Ref Z LED is RED
  Do
   Call SetModOutput (20,1)             'Activate ModOutPut 20
    If GetInput(18) Then Exit Do       'Loop until ModInPut 18 is seen
    Sleep (10)
    Loop
    End If
    Call SetModOutPut (20,0)            'DeActivate ModOutPut 20
    DoOemButton (1024)                       'Set Z axis Home
    
    
 If GetOemLED (807) Then
  Do
   Call SetModOutPut (21,1) 
    If GetInput(19) Then Exit Do
    Sleep (10)
    Loop
    End If
    Call SetModOutPut (21,0)
    DoOemButton (1022)   
As none of my home switches are actually connected to Mach I have to make sure the Home switches are not activated in Ports and Pins.
Hood