Click here to return to the schedule
Background
To see how the machine language from the textbook comes to life, we will use an exciting, state-of-the-art interactive simulator! (Okay just kidding, this program is really old and barely runs. But someday we will rebuild it for the web using HTML5.)
The instructions below show how to run the simulator on a Linux lab machine. If you would like to run it from home, you'll need to install Java if you don't have that already. (Java is already installed in the CS 101 VM.)
Instructions
We will walk you through these steps during the lab. But if you'd like to give it a try beforehand:
Step 1: Download the bmachine.jar file.
Step 2: Open a Terminal in your Downloads directory. (The TAs can show you how!)
Step 3: Run the command:
java -jar bmachine.jar
The reason why it's so complicated is because of security reasons. On Windows, you can just double-click the jar file and it runs. But doing so turns out to be an easy way to get viruses (from other jar files you might find on the Internet).
Sample Program
Here is some machine code that calculates the sum of numbers from 1 to 10. The answer (1 + 2 + ... + 10 = 55) is stored in register 1. You should see 37 at the end of the program, because 37 in hexadecimal is 55 in decimal.