Ch12 tests always halt.

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

Ch12 tests always halt.

Josh Cheek
This post was updated on .

problem

We're on chapter 12, and the tests always end in "Program Halted: Main.main finished execution". When we manually look at the memory addresses, they appear to be correct. When we edit the Main.jack to give incorrect results, it still ends with program halted.

code

Our Array.jack:

(code was confirmed correct, and removed at request of replier)

directory structure


We moved Array.jack into the ArrayTest dir, then compiled it to ArrayTest/Array.vm and compiled ArrayTest/Main.jack into ArrayTest/Main.vm

depending on builtins

When we run VMEmulator.sh, against "ArrayTest/ArrayTest.tst" it prompts us:

"Confirmation Message:

No implementation was found for some functions which are called in the VM code.
The VM Emulator provides built-in implementations for the OS functions.
If available, should this built-in implementation be used for functions which were not implemented in the VM code?"

Which we say "yes" to. Then it runs for a bit and gives the above error.

environment


We're on Mac OSX 10.7.3, with the following java:

$ java -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11-402-11D50b)
Java HotSpot(TM) 64-Bit Server VM (build 20.4-b02-402, mixed mode)
Reply | Threaded
Open this post in threaded view
|

Re: Ch12 tests always halt.

cadet1620
Administrator
Your implementation of Array.jack is correct. Please edit your post to remove the functional code.

The messages you are getting are correct functionality.

When you run ArrayTest.tst you get the "No functions were found..." warning message because the ArrayTest directory does not contain .vm files for any of the other parts of the OS. Select YES so the simulator uses built-in versions of them. This is OK, in fact it's what you want; any problems that show up are a result of your Array.jack, not one of your other OS files.

The last thing Main.main() does is return to the built-in Sys.init() which puts up the "Program halted..." message. Press OK and you should see the normal End of Script - passed/failed message in the status line at the bottom of the window.

--Mark

Reply | Threaded
Open this post in threaded view
|

Re: Ch12 tests always halt.

Josh Cheek
Hi, thanks for replying.

After pressing OK on the halt message, there is nothing listed in the status line. The ArrayTest.out similarly has the column headers, but not the RAM values:

|RAM[8000]|RAM[8001]|RAM[8002]|RAM[8003]|

Reply | Threaded
Open this post in threaded view
|

Re: Ch12 tests always halt.

cadet1620
Administrator
I just copied the supplied Sys.vm file into my projects/12/ArrayTest directory. I still get the warning message because Array.vm uses functions from Memory, but I no longer get the Program Halted message since the Sys.vm code executes a loop after Main.main() returns. The test takes a bit longer to run since it has to complete 1 000 000 steps to get to the end of the test script.

You could try this to see if it allows the message to show on your status line.

Just to double check, are you using a platform with a screen that's tall enough to see the entire simulator window?  I've seen reports that some of the smaller tablets clip the bottom of the window.

--Mark