Function command implementation

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Function command implementation

asev98


What does "Push 0" means? Does it mean push local 0 or pop local 0 for the new function's local segment? Or am I completly wrong and it means something else?
Reply | Threaded
Open this post in threaded view
|

Re: Function command implementation

cadet1620
Administrator
asev98 wrote
 g:
  repeat nVars times:
  push 0


What does "Push 0" means? Does it mean push local 0 or pop local 0 for the new function's local segment? Or am I completly wrong and it means something else?
This means do the equivalent of calling your "push constant 0" code writer nVars times.

Another way to state this would be:
  fill RAM[SP] through RAM[SP+nVars-1] with zeros,
  set SP = SP+nVars.

What this operation does is reserve space on the stack for the function's local segment and initializes all the local variables to 0.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Function command implementation

asev98
Thank you very much, you solved my problem so easily