Main Board > Language

Detecting a CALL


Is there a way to detect (within the program itself) that a program was CALLed - even if there are no arguments passed (i.e. tcb(20)=0)?
I know we can probably try to leverage the STK contents to try and figure it out but was wondering if there was something more straighforward/foolproof that we could use.


I've always used TCB(13) - Current Program Level
If 1 then the program is being RUN
If > 0 then you are in a CALL, PERFORM, or object function

We had been using TCB(13) but in this particular case we have this scenario:
A lead-in program (lpg) PERFORMs program A which RUNs program B so TCB(13) is > 0 even though the program B was RUN.

Mike King:
There is no way to determine the difference between a direct CALL versus a PERFORM/RUN.  Internally the only difference is that the variable table is not passed in on a CALL whereas the variable table is passed in on a PERFORM. 

Thanks, Mike. Pretty much what I had suspected and we will have to manufacture something for this use case.


[0] Message Index

Go to full version