CODE
GOSBVL =SAVPTR
C=DAT1 A
RSTK=C
CD1EX
RSTK=C
A=DAT1 A
LC(5) =DOCSTR
?C=A A
GOYES +
GOSBVL =GETPTRLOOP
+
(more code here)
ENDCODE
My first question is: why there is a GOSBVL call instead of a GOVLNG?
Does it have to do something with things saved onto the return stack?
Right before GOSBVL =GETPTRLOOP there will be two addresses on the
return stack. When GETPTRLOOP is called, there will be an additional
address. However, GETPTRLOOP jumps with PC=(A). So what happens to
everything on the return stack? I guess what I am getting at is: what
happens with the address left on the return stack?
> GOSBVL =GETPTRLOOP
I am writing this from memory so that might not be 100% correct.
The RSTK level is used for the return. This does not matter here as
you will be exiting to RPL.
Instead you can always use
GOVLNG =GETPTRLOOP
in this case as this is slightly as faster as it does not use a RSTK
level.
I have never encountered any problems exiting with GOVLNG
=GETPTRLOOP.
HTH,
Andreas
http://www.software49g.gmxhome.de
http://www.youtube.com/watch?v=Pj72miclisM
I saw this (a GSB at an END stmt)
in some other code snippets,
and it had no effect on the general program run,
or in other words, the return address was never reached.
"rs1n" <> schrieb im Newsbeitrag
news:6f68a1df-b580-4436...@37g2000yqm.googlegroups.com...
So one question could be : why is it not so ?
Reason is that LZD is written using MASD syntax,
while the disassembled code is using SASM syntax.
MASD exit from an ML code is written : LOADRPL
Therefore, it is the compiler which decides to replace this codeword
with the sequence GOSBVL =GETPTRLOOP
It is the compiler which is making a small "mistake" here.
But as said by Andreas, this has very little importance,
because both conditions will anyway exit to RPL.
You can exit from anywhere within your ML code,
leaving the RSTK full of return addresses,
this will have no impact at all ! They simply are ignored.
Using GOSBVL therefore has no real disadvantage,
both cost 7 nibs (3.5 bytes),
speed difference is almost negligible
(GOSBVL is 15 cycles, while GOVLNG is 14 cycles)
so this is completely unnoticeable.
Regards
On Nov 9, 5:23 pm, Andreas Möller <andreas_moellerNOS...@gmx.de>
wrote: