### MARS - Mips Assembly and Runtime Simulator

#### Release 4.5

#### August 2014

#### Using MARS through its Integrated Development Environment (IDE)

The IDE is invoked when MARS is run with no command arguments, e.g. `java -jar mars.jar`. It may also be launched from a graphical interface by double-clicking the `mars.jar` icon that represents this executable JAR file. The IDE provides basic editing, assembling and execution capabilities. Hopefully it is intuitive to use. Here are comments on some features.

- Menus and Toolbar: Most menu items have equivalent toolbar icons. If the function of a toolbar icon is not obvious, just hover the mouse over it and a tool tip will soon appear. Nearly all menu items also have keyboard shortcuts. Any menu item not appropriate in a given situation is disabled.
- Editor: MARS includes two integrated text editors. The default editor, new in Release 4.0, features syntax-aware color highlighting of most MIPS language elements and popup instruction guides. The original, generic, text editor without these features is still available and can be selected in the Editor Settings dialog. It supports a single font which can be modified in the Editor Settings dialog. The bottom border of either editor includes the cursor line and column position and there is a checkbox to display line numbers. They are displayed outside the editing area. If you use an external editor, MARS provides a convenience setting that will automatically assemble a file as soon as it is opened. See the Settings menu.
- Message Areas: There are two tabbed message areas at the bottom of the screen. The Run I/O tab is used at runtime for displaying console output and entering console input as program execution progresses. You have the option of entering console input into a pop-up dialog then echoes to the message area. The MARS Messages tab is used for other messages such as assembly or runtime errors and informational messages. You can click on assembly error messages to select the corresponding line of code in the editor.
- MIPS Registers: MIPS registers are displayed at all times, even when you are editing and not running a program. While writing your program, this serves as a useful reference for register names and their conventional uses (hover mouse over the register name to see tool tips). There are three register tabs: the Register File (integer registers $0 through $31 plus LO, HI and the Program Counter), selected Coprocesor 0 registers (exceptions and interrupts), and Coprocessor 1 floating point registers.
- Assembly: Select Assemble from the Run menu or the corresponding toolbar icon to assemble the file currently in the Edit tab. Prior to Release 3.1, only one file could be assembled and run at a time. Releases 3.1 and later provide a primitive Project capability. To use it, go to the Settings menu and check Assemble operation applies to all files in current directory. Subsequently, the assembler will assemble the current file as the "main" program and also assemble all other assembly files (*.asm; *.s) in the same directory. The results are linked and if all these operations were successful the program can be executed. Labels that are declared global with the ".globl" directive may be referenced in any of the other files in the project. There is also a setting that permits automatic loading and assembly of a selected exception handler file. MARS uses the MIPS32 starting address for exception handlers: 0x80000180.
- Execution: Once a MIPS program successfully assembles, the registers are initialized and three windows in the Execute tab are filled: Text Segment, Data Segment, and Program Labels. The major execution-time features are described below.
- Labels Window: Display of the Labels window (symbol table) is controlled through the Settings menu. When displayed, you can click on any label or its associated address to center and highlight the contents of that address in the Text Segment window or Data Segment window as appropriate.

The assembler and simulator are invoked from the IDE when you select the Assemble, Go, or Step operations from the Run menu or their corresponding toolbar icons or keyboard shortcuts. MARS messages are displayed on the MARS Messages tab of the message area at the bottom of the screen. Runtime console input and output is handled in the Run I/O tab.

This document is available for printing on the MARS home page `http://www.cs.missouristate.edu/MARS/`.