Fixes #2451 with addition to boilerplate loader #2476
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #2451
The solution is explained in the comment in the code.
When RUN ONCE skipped the actual program call, it wasn't
cleaning out the args and KOSArgMarker the program call was
supposed to be popping. When you use RUN ONCE with a program
that takes no args, that's not horrible, as it just
left one extra KOSArgMarker on the stack which was fine
but slightly wasted stack space if you do RUN ONCE a lot.
But when you use RUN ONCE interleaved with calls to other
programs that DO expect arguments, and start putting the
PARAMETER statement AFTER the RUN ONCE's, then the fact
that this extra KOSArgMarker was there caused misalignment
of the stack.
My solution was that in the clause where RUN ONCE choses to
skip the program call, have the @lr boilerplate program do
the same thing to the stack that a call would have done, that
is have it pop everything down to an including the topmost
KOSArgMarker. I did that by coding a small kRISC loop there:
like so: