Mars Basic Operation

Programming in assembly language involves the following activities.

Usually, the last five activities are repeated several times.

In addition programmers may want to

Each of the above activities is supported in the Mars user interface.

Create a New File

You can create a new MIPS assembly language file clicking on the "New" new toolbar button.

After Creating a New File

After creating a new file a new tab appears in the editor pane. It is automatically given a new name by the Mars program. This name can be changed when you save the MAL program using the "Save As ..." menu item in the "File" menu or using the "Save As" save as toolbar button.

Open a File

You can open a MIPS assembly language file clicking on the "Open" open toolbar button. Then you can use the file browser dialog to navigate to and select the file you want.

After Opening a File

After opening a new file a new tab appears in the editor pane. It displays the selected file.

Edit a File

The editor supports operations supported by most editors: cut, copy, paste, undo, redo, find, and replace. To support writing code, it has an auto-indent feature.

Assembling a File

A MAL program is assembled by clicking on the "Assemble" assemble button.

After Assembling a File

After assembling the program, the Messages/Run I/O pane displays errors if there are any.

If assembly is successful the Messages/Run I/O pane displays a message indicating that assembly was successful. Also the "Execute" tab of the Edit/Execute pane is automatically selected. This tab has three sub-panes shown below.

Running a Program

A MAL program is run by clicking on the "Go" go button.

Input

Most programs prompt the user for input. When this happens the Run I/O tab of the Messages/Run I/O pane is automatically selected and the prompt appears there. The program gets input from the user when the user hits the "Enter" key.

After the user types in a response to the prompt, the program continues execution. After all input has been gathered the program completes its execution.

Rerunning a Program

If you want to run the program again without reassembling it:

  1. click on the "Reset" button to reset it,
  2. then click on the "Run" button.

Saving a File

  1. If you like the name your program has you can save your program by clicking on the "Save" button.
  2. If you want to change the name click on the "Save As" button.