Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #2451 with addition to boilerplate loader #2476

Merged

Commits on Mar 28, 2019

  1. Fixes KSP-KOS#2451 with addition to boilerplate loader

    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:
    
    // Keep popping till next thing is argbottom, then pop that too:
    pop           <---.
    testargbottom     |
    br.true ---.      |
    jump ------+------'
    pop   <----'
    Dunbaratu committed Mar 28, 2019
    Configuration menu
    Copy the full SHA
    32a762d View commit details
    Browse the repository at this point in the history