Doug Handy got it right when he wrote that RPG saves one return address
per subroutine, and when the ENDSR is reached, it branches to the saved
address.  Each EXSR causes the return address associated with the target
subroutine to be set to the address of the instruction immediately
following the EXSR.

Of course, this does not explain the behavior observed by Pete Hall. 
The call to Sub A from Sub C should have overlaid A's return address
with an address in C.  But, as Doug pointed out, the language forbids
recursion and does not predict what will happen.

> Excerpts from midrange: 9-May-99 RE: *PSSR subroutine and th..
> Pete Hall@execpc.com (1190*)

> mainline calls Sub A
> Sub A calls Sub B
> Sub B calls Sub C
> Sub C calls Sub A
> Sub A returns to mainline (not Sub C) - this was not the desired
> behavior



+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.