Administrator
|
set sp 256
is not VM code. There is no 'set' command in the VM language.
Similarly, there is no 'end' command.
Your bootstrap code that the VM Translator generates needs to put in assembler code that makes this happen.
I don't know what RET_3 is, just like I didn't know what RET_4 was in your original post. Assuming that 53 is the INSTRUCTION address in ROM that contains the first instruction after main() finishes, then that gets pushed onto the stack as part of the function call process.
When your function returns, it needs to REPLACE the value at the beginning of the callee's stack frame (which is *ARG, or the first argument -- however if there were no arguments, then it will happen to be the return value). Since it might be the return value, we need to first place that value someplace safe so that we can come back to it to make the actual jump back to it happen.
We then restore the caller's segment pointers, adjust the stack pointer to reflect that there is one more thing on the stack (the return value), and do an unconditional jump back.
If the RA is 53, then that has NO relation to what is in RAM[53], because instruction are in ROM, not RAM.
|