I have successfully done with my SimpleFunction VM code but I am getting an error in the 'NestedCall" test and I don't know where exactly I am going wrong! I am tired at this point(it's been three days) about how exactly should I debug the error which is "Comparision failure at line 2". I tried various methods suggested in the forum but it's not working, my Output is as below:
Please suggest to me what I need to do!
Firstly I thought my Call and return code must be having an error but it has been successfully executed in the SimpleFunction VM code! which means I am not wrong here, then I tried to run parallelly my generated assembly code line by line(with some markers) and VM code in VM Emulator, but since it is very long I am unable to do so.
Does my existing VM code need any modifications after SimpleFunction test?
Just because SimpleFunction worked does not mean that your VM code for calling functions and returning from this is correct, just that the issue didn't manifest itself in such a limited test. The NestedCall is a much more thorough test. You are probably corrupting the call stack of the prior function call when the second call is made (or returned from).
Notice that your Stack Pointer ends up at 362, which is WAY out of line with anything that would be reasonable. So you might step through the code and see where R0 just changed so significantly.