|
I was unable to pass the FibonacciElement test for quite a while despite cross-checking each individual function multiple times. Originally, the way I was implementing the Bootstrap code was by
- setting SP to 256
- making a traditional call to Sys.init
This however was not working, and after browsing through some of the discussions, I tried
- setting SP to 261
- jumping to Sys.init
This somehow works and passes the test. But I really don't understand why or how.
In the former case, here is what should happen:
- SP = 256
- push RET, LCL, ARG, THIS, THAT (SP becomes 261)
- ARG = 261 - 5 = 256
- LCL = 261
- jump to Sys.init and never returns
In the latter case, here is what should happen
- SP = 261
- Unsure about ARG and LCL
- jumps to Sys.init and never returns
What am I missing? Why does a traditional call to Sys.init not work?
|