error in SimpleFunction test scripts?

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

error in SimpleFunction test scripts?

RobertC
Hi all, trying to polish up chapter 8.  I have run into a small prob in testing the SimpleFunction.  

SimpleFunction.tst has:

 set RAM[312]  1000

SimpleFunctionVME.tst has:

 set argument[2] 9


If I'm understanding correctly RAM[312] contains the return address for the caller.  If that is true, how can either of these values be permissible?  (Lazy question) Can I use the .cmp to figure out my answer?
Thank you for reading.

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

Re: error in SimpleFunction test scripts?

Simon
I don't think either of the values matter seeing as SimpleFunction isn't actually getting called and so isn't going to return. I don't understand why the values differ between the VM and CPU emulator versions, however.
Reply | Threaded
Open this post in threaded view
|

Re: error in SimpleFunction test scripts?

cadet1620
Administrator
SimpleFunction does get executed and does return.

The test script loads SimpleFunction.asm or SimpleFunction.vm, depending on which script/emulator you are using.  This results in the IP pointing to the first instruction in the loaded .asm/.vm file.  The script then sets up a stack frame as if SimpleFunction had been called.  The script then begins running the emulator.

In the case of the CPU Emulator test, SimpleFunction returns to 1000, which is assumed to be beyond the end of the .asm code generated for SimpleFunction.vm, and the Emulator executes NOPs until the end of the test.  The stack frame after SimpleFunction returns is compared to the expected values.

In the case of the VM Emulator, SimpleFunction returns to 9 which is the return statement. but the return does not get executed a second time because the test script only executes 9 instructions.

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

Re: error in SimpleFunction test scripts?

Simon
Ahh, I was only looking at the .vm files. Sorry!