Post Reply 
[wp34s] Is it possible to call an XROM from another one?
05-13-2015, 07:25 PM
Post: #6
RE: [wp34s] Is it possible to call an XROM from another one?
(05-13-2015 03:03 PM)emece67 Wrote:  I've read that executing xIN creates a "local" 8 levels stack, a "local" return stack & changes to DP. But, does it also create a set of 16 local flags? If so, will a subsequent LocR "hide" such flags? (I think the answers are {YES, NO}, but not sure.)

Not quite 16 because some of them (8 to 15) are reserved for system use. They hide the local flags in the same range. xIN does the equivalent of a call to LocR 0. If you call LocR again from the same subroutine level, that is not within code called by XEQ, the number of registers is adjusted and no new frame on top of the active one is created. If you call LocR from within a subroutine, it will get its own set of flags. But the system flags are still the same. They hide the local flags just created.

(05-13-2015 03:03 PM)emece67 Wrote:  Suppose also that an XROM function executes xIN, then, inside such function, there's a LocR and a GSB, and this second subroutine ends with RTN. Will such RTN "free" the LocR'ed registers? (I think {NO}, they are freed by POPLR or xOUT in the calling XROM function.)

RTN frees local data that has been created at the same subroutine level. Local data is allocated on the subroutine return stack. XROM code with an active xIN uses a special area in volatile memory for this purpose. So LocR inside a subroutine works in the same way as for user code but in a different memory area.

(05-13-2015 03:03 PM)emece67 Wrote:  In an XROM function calling (via GSB) other subroutines, can LocR be nested? (I have no idea.)

You should have got the idea now. Wink

Yes LocR can be nested but the reserved area is limited in size. Cf. XROM_RET_STACK_SIZE in data.h.

Marcus von Cube
Wehrheim, Germany
http://www.mvcsys.de
http://wp34s.sf.net
http://mvcsys.de/doc/basic-compare.html
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [wp34s] Is it possible to call an XROM from another one? - Marcus von Cube - 05-13-2015 07:25 PM



User(s) browsing this thread: 1 Guest(s)