Introduction to MARS


MARS, the Mips Assembly and Runtime Simulator, is an IDE for editing, assembling and simulating the execution of MIPS assembly language programs. MARS is written in Java and requires the J2SE Java Runtime Environment (JRE) Release 1.4 or later. It is distributed as an executable JAR file. You can find more information and download a copy of MARS from the MARS home page at http://www.cs.missouristate.edu/MARS/.

There are two main windows in MARS. The Edit window is used to create and modify your program. The Execute window is used to run and debug your program. The tabs at the top of the windows are used to switch between the two.

Editing and Assembling

To create and modify your program, use the edit window. The menus and toolbars provide standard editing tools (cut, copy, paste, undo, redo, save as). Notice the line and column number counts in the status bar at the bottom of the window.

To assemble your program, click on the Run menu and choose Assemble, or click on the assemble button . If there are syntax errors in your program, they will appear in the Mars messages window at the bottom of the Mars screen. Each error message contains the line and position on the line where the error occurred.

In this example you can see that there are errors on lines 24 and 28.

Executing Your Program

If there are no syntax errors when you assemble, the display will switch to the execute window.

The execute window contains panes for the text segment (which holds the code) and the data segment (which holds the variables). Below those panes is the pane with tabs for MARS Messages and Run I/O. Screen output from your program will appear in the Run I/O pane. On the right side is the pane which has tabs to show either the common MIPS registers, the floating point registers (Coproc 1) or status codes (Coproc 0).

Program Execution Options

Once you have removed any syntax errors you can run your program. The Run menu and the toolbar contain the follow execution options:

You can also set a breakpoint at any statement by clicking the checkbox in front of the statement in the text segment pane.

During execution you can see which statement is being executed (highlighted in yellow), which register was last modified (highlighted in green) and which variable was last changed (highlighted in blue). It's usually only possible to see the highlighting when you are stepping or running at less than full speed.



Email Me | Office Hours | My Home Page | Department Home | MCC Home Page

© Copyright Emmi Schatz 2009