; homez.g
M906 X800.00 Y800.00 Z1600.00:1600.00:1600.00:1600.00 U1600.00 V1600.00 W1600.00 E500.00 I50
G91
M584 Z6 U7 V8 W9 P6 ; split Z,U,V,W
M906 X800.00 Y800.00 Z1800.00:1800.00:1800.00:1800.00 U1800.00 V1800.00 W1800.00 E500.00 I50
G4 P500
G1 Z380 U380 V380 W380 F4000 S1 ; move up to 380mm in the +Z direction, stopping if the homing switch is triggered
G1 Z-4 U-4 V-4 W-4 F1600 S2
G1 Z10 F700 S1
G4 P500
G1 U10 F700 S1
G4 P500
G1 V10 F700 S1
G4 P500
G1 W10 F700 S1
G4 P500
G1 Z-4 U-4 V-4 W-4 F1600 S2
G1 U0.1 F700
G4 P500
G1 V0.5 F700
G4 P500
G1 W2.4 F700
G4 P500
M584 Z6:7:8:9 P3 ; join U,v,w to Z again
G1 Z-200 F3000 ; move back again 10mm in the -Z direction
G90 ; back to absolute mode
M906 X800.00 Y800.00 Z1600.00:1600.00:1600.00:1600.00 U1600.00 V1600.00 W1600.00 E500.00 I50
Forget the g4, it's not useful.