M89 P12 L1 (output tool release signal)
G04 P300 (delay 300 ms)
G01 Z[#403+2.5] F1000 (Z axis rises 2.5 ms, prevent pressing the
cutter during tool release)
M88 P9 L0 (wait for tool release in-place)
G01 Z[#403+#404] F#405 (Z axis rises to a safe altitude)
}
#1=0 (cutter forward/reverse rotation sign)
IF[#201 > [#400/2]] GOTO 1
IF[[#201 >= #200] || [#200 > [#201+[#400/2]]]] GOTO 2
M89 P9 L1 (cutter forward rotation)
#1=0 (the sign is 0)
GOTO 3
N2
M89 P10 L1 (cutter reverse rotation)
#1=1 (the sign is 1)
GOTO 3
N1
IF[[#201 >= #200 && #200 <= #400] && [#200 > [#201+#400/2]MOD#400]]
GOTO 4
M89 P9 L1
#1=0
GOTO 3
N4
M89 P10 L1
#1=1
N3
#2=#201 (save current tool number in temporary variable)
WHILE[#2!=#200] DO1 (check whether equals to the tool number to
be changed)
M88 P7 L0 (wait for cutter count signal becoming low)
M88 P7 L1 (wait for cutter count signal becoming high)
IF[#1==1] GOTO 7 (check forward/reverse rotation through the sign)