|
When I'm using the following commands:
@Sys.init
0;JMP
to directly jump to the Sys.init function, I'm not getting the correct values in RAM. But when I use a helper function write_call (to generate assembly for "call Sys.init 0") I'm passing the tests. My question is, why do we need to push return address, THIS, THAT, LCL etc. to the stack? Initially, I think that those addresses should contain garbage values anyway. Also, once the sys.init function is called, isn't it supposed to be in an infinite loop? So why do we need to push those values if we are never using it?
Edit: i'm using both (direct jump and calling sys.init) after setting sp = 256
|