Do you have a list of the Local G65 Parameters "A=#1 B=#2 C=#3 etc??
What Graham posted is what we use. Standard Fanuc. We won't get into mixing or shuffling them up for our own purposes. We just reserve the E address because the interpreter will look at it as scientific notation. When I get time, I may try and remove this restriction. But for now, it is reserved.
Most of the reserved addresses have a special meaning on the G65 line but they can be accessed in the sub.
E (Mach reserved) would be #8. it will be loaded with NIL (undefined).
G (RESERVED SYSTEM WORD) would be #10. It will be loaded with "650" as G65 is what called the sub! This is how you can know if G65 called the sub or not.
L (RESERVED SYSTEM WORD) would be #12. It is loaded the the loop count from the G65 L address.
N (RESERVED SYSTEM WORD) would be #14. It is loaded with the sequence number of the G65 line (if provided).
O (RESERVED SYSTEM WORD) would be #15. It is not loaded with anything at the moment.
P (RESERVED SYSTEM WORD) would be #16. It is loaded with the program number from the G65 P address. (your called sub program number)
Steve