Details
Level I: Program Flow
These tests use if-goto
but no functions. All variable setup is done
by the script.
-
BasicLoop.
-
FibonacciSeries.
Notes: arg[0] (RAM[400]) is the length of the Fibonacci series to create. Turn it up to 8 and you should see 3000-3007 filled.
Level II: Functions
The first tests are “manual setup” tests.
-
SimpleFunction: this test sets up a fake stack frame in the test script, so it does not require you to have a working call. It accesses arguments and locals.
The fake stack frame has a return address of 1000, so when the function “returns” control flow jumps to 1000. The test’s assumption is that this is beyond the end of your generated code, so ROM is full of 0’s (
@SP
). This test requires a limit on the number of steps for it not to (eventually) cause an error. -
NestedCall: This test contains only one file, and the first function in the file is Sys.init. The expectation is that Sys.init will run with no setup. The setup script sets SP=261 and makes a fake stack frame in RAM 256-260. Do not use a setup “prelude”.
The interesting parts of this script: (1) A bunch of memory is set to -1 and then uninitialized locals are used to verify that locals are being initialized to zero. (2) Sys.main calls Sys.add12, so there are two levels of function calls.
Level III: Functions and Call
-
StaticsTest: This test verifies that static variables in one file are distinct from static variables in another file.
This test assumes the standard prelude is used. (SP=256, jump to Sys.init.)
I suggest using the rewritten statics test provided on our course web site.
-
FibonacciElement:
This test is a multi-file source that assumes the standard prelude is used. (SP=256, jump to Sys.init.)
I sugest using the rewritten FibonacciElement test.