CSC 242 Quiz Project 7 Name:________________________
Note: Consider downloading the latest version of the software if any
difficulties are experienced:
http://www1.idc.ac.il/tecs/
Project 8
- Trace through SimpleFunction.vm in project 8.
// Performs a simple calculation and returns the result.
function SimpleFunction.test 2
push local 0
push local 1
add
not
push argument 0
add
push argument 1
sub
return
- How many arguments are passed to the function?
- Write an arithmetic/Boolean expression that evaluates to the same return value given
variable inputs.
- What is the return value using the arguments given in the script "SimpleFunctionVME.tst?"
- Write the assembly code that implements the VM command "push argument
1" using the same arguments (int command, String segment, int index) as
specified in the API where approriate.
- Write the assembly code that implements the VM command "lt."
- Write the assembly code that implements the VM command "goto loop."