Mars Introduction
Mars Introduction
Mars Introduction
MARS is a software simulator for the MIPS assembly language intended for educational use. We
will explore the capabilities of MARS release 3.2.1 in this three part tutorial.
MARS may be downloaded from www.cs.missouristate.edu/MARS.
6. Locate the Registers display, which shows the 32 common MIPS registers. Other tabs in the
Registers display show the floating-point registers (Coproc 1) and status codes (Coproc 0).
7. Use the slider bar to change the run speed to about 10 instructions per second.
This allows us to watch the action instead of the assembly
program finishing directly.
The
icon runs the program to completion. Using this icon, you should observe the
yellow highlight showing the programs progress and the values of the Fibonacci
sequence appearing in the Data Segment display.
The
icon resets the program and simulator to initial values. Memory contents are
those specified within the program, and register contents are generally zero.
The
icon is single-step. Its complement is
each operation).
9. Observe the output of the program in the Run I/O display window:
The Fibonacci numbers are:
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181
-- program is finished running --
10. Modify the contents of memory. (Modifying a register value is exactly the same.)
Set a breakpoint at the first instruction of the subroutine which prints results. Use the
checkbox at the left of the instruction whose address is 0x00400060 = 4194400ten.
Reset
and re-run
the program, which stops at the breakpoint.
Double-click in one of the memory locations containing the computed Fibonacci
numbers. The cell will be highlighted and will accept keyboard entry, similar to a
spreadsheet. Enter some noticeably different value, and use the Enter key or click outside
the cell to indicate that the change is complete. Example: Memory address 0x10010020 =
268501024 ten presently contains data 0x00000022 = 34 ten.
Click
to continue from the breakpoint. The program output includes your entered
value instead of the computed Fibonacci number.