Ok, hopefully someone else will come along and correct me as I'm a little hazy on O-words and subroutines.
I think what you want to do is put the subroutines at the end of the file, or rename them and save them as separate files.
Like so:
Code:
o<toolchange> sub
...
o200 IF [#<_selected_tool> GT 0]
o<arm_in> call ;Arm In
o<unclamp> call ; Unclamp
G53 G0 Z #2 'TODO Move Z to tool change clearance height
...
o<toolchange> endsub
and in your subroutines folder you have files named:
arm_in
arm_out
unclamp
etc.
In my ATC sequence the functions you've got as subroutines have been remapped as M-codes. My version of your "O500" is "M25", and m25.ngc has been saved in my sub folder. My version of the sequence above would look like this:
Code:
o<toolchange> sub
...
o200 IF [#<_selected_tool> GT 0]
M25 ;Arm In
M24 ; Unclamp
G53 G0 Z #2 'TODO Move Z to tool change clearance height
...
o<toolchange> endsub
Try sticking the subs at the end of the file first. If that doesn't help, try saving each sub function as a separate file.