Post Reply 
HP 41-XEQ/GTO and RTN
07-03-2017, 10:50 AM (This post was last modified: 07-03-2017 10:54 AM by Dieter.)
Post: #2
RE: HP 41-XEQ/GTO and RTN
(07-03-2017 08:17 AM)Jotne Wrote:  But In the Caves there are several calls to same subroutine using GTO like this:
Code:
176 GTO 33

When I test this, it seem that the program stops at the RTN when GTO is used.

Right. But this is not a call of subroutine 33, it's a jump to that label.

(07-03-2017 08:17 AM)Jotne Wrote:  Does the program continue with 322 LBL 13 when this happens?
Is this wrong within the program? Or do I miss something?

It's quite simple. If a RTN is encountered and there is a pending subroutine call the program returns to the line following that (XEQ-)call. If there is no pending subroutine, RTN simply stops., just like a R/S.

Code:
"ONE"
XEQ 33
"TWO"
XEQ 33
"THREE"
GTO 33
...
more code
....
LBL 33
AVIEW
PSE
RTN
...
even more code
...

If you run this, "ONE", "TWO" and "THREE" will be displayed, then the program stops at the RTN. The following "even more code" will not be executed until you press R/S to continue.

Of course it is possible that a GTO 33 occurs within a pending subroutine that has been called by an XEQ before. In this case the RTN makes the program return to the line after that subroutine call. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HP 41-XEQ/GTO and RTN - Jotne - 07-03-2017, 08:17 AM
RE: HP 41-XEQ/GTO and RTN - Dieter - 07-03-2017 10:50 AM
RE: HP 41-XEQ/GTO and RTN - Jotne - 07-03-2017, 02:30 PM
RE: HP 41-XEQ/GTO and RTN - SlideRule - 07-22-2017, 12:26 PM
RE: HP 41-XEQ/GTO and RTN - Jotne - 07-22-2017, 07:45 PM
RE: HP 41-XEQ/GTO and RTN - Jotne - 07-22-2017, 06:58 AM
RE: HP 41-XEQ/GTO and RTN - Dieter - 07-22-2017, 04:07 PM
RE: HP 41-XEQ/GTO and RTN - Paul Dale - 07-22-2017, 07:34 AM



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