MACINV is not a function, it is an internal label. Using it returns the current macro invokation number.The current macro invokation number is incremented every time a new macro is invoked. It is constant for any one particular invokation i.e. if macro A calls macro B and macro A has a macro invokation number of N, macro B will have a macro invokation number of N+1 and when macro B returns to macro A , macro A will continue to have a macro invokation number ok N
e.g. wait .macro arg ; here lab is allocated a label that is local to ; the current macro invokation lab .set LABEL("wait_"+MACINV) lab btfsc PORTA,0 goto lab .endm