COSC 201: Computer Organization

Lab 1: Using the MARS Simulator

Learn about the computers in the lab and how to use the MARS (MIPS Assembly and Runtime Simulator) simulator. You can download the MARS simulator to your own computer here. It runs in Java so if you have Java installed on your computer, yous should be able to click on this file and have MARS up and running.
Run and modify a simple MIPS assembly program in MARS. Load and run a more complex program.
Read the MARS instructions under the help/help menu in MARS. Look at the main tab MARS, subtabs Intro, IDE, Debugging
Files to use
expression.s, factorial.s
What to Hand In
Modified copy of expression??.s and lab1??.txt

  1. Create a directory for this course.
  2. Create a working directory for this lab: lab01
  3. Save the files expression.s and factorial.s into your lab01 directory.
  4. Start MARS (double click on the jar file).
  5. Load the expression.s program into the simulator. Try running the program with both the run command and the step command.
  6. Change in the program uisng the editor in MARS or any text editor, so that it evaluates the following expression:

    (10 + 9) - (8 + 7)

    Document your change with appropriate comments. Run the program again using the simulator to verify that it prints the correct result.
  7. Save a copy of your modified expression.s file with your initials or first name-last initial, for example expressionCN.s or expressionChrisN.s
  8. Load and run the program factorial.s from your lab01 folder. Single step through this program for part of the execution. Read the code and comments to familiarize yourself with a more complex sample of MIPS code. Observe the contents of the different registers as you step through the program. Can you figure out what the two commands jal and jr do? Write you answer in a text file with lab 1 and your initials or name as part of the filename.
  9. Email to the instructor ( your modified expression.s file and your text file for step 8 (remember your initials or name as part of the filenames).
  10. Do not forget to log out before you leave the lab!