Hi sunny_x1
I had a simillar problem on my Mach3 (hope it works om Mach4)
Have a OX cnc also with 2 motors Y & A (where A is the slave)
I use the following code for the "Ref All"
****************************
DoButton( 22 ) ' (This is the X axis)
RefCombination( 10 ) ' (Where the Ref combination means Y+A axis togheter)
DoOEMButton(133)
DoOEMButton(134)
***************************
I do not calibrate my Z axis.
Hope it helps!

Kent from Sweden