Files
EMARS/help/MarsHelpTools.html
T
adolphenom 0da1c5dcca Source code of MARS Assembler
First commit of the 4.5 version (latest version available)
2014-12-21 12:49:28 +01:00

108 lines
5.5 KiB
HTML

<html>
<title>MARS 4.5 help contents
</title>
<body>
<center>
<h3>MARS - Mips Assembly and Runtime Simulator</h3>
<h4>Release 4.5</h4>
<h4>August 2014</h4>
<h4>Cool Capability: Plug-in Tools</h4>
</center>
Beginning with Release 2.0, MARS is capable of running externally-developed
software that interacts with an executing MIPS program and MIPS system
resources.
The requirements for such a program are:
<ol>
<li>It implements the <tt>mars.tools.MarsTool</tt> interface.
<li>It is part of the <tt>mars.tools</tt> package.
<li>It compiles cleanly into a ".class" file, stored in the <tt>mars/tools</tt> directory.
</ol>
MARS will detect all qualifying tools upon startup and include them in
its Tools menu.
When a tool's menu item is selected, an instance of it will be created using its no-argument
constructor and its <tt>action()</tt> method will be invoked.
If no qualifying tools are found at MARS startup, the Tools menu will not
appear.
<p>To use such a tool, load and assemble a MIPS program of interest then select the desired tool
from the Tools menu. The tool's window will open and depending on how it is written it will either
need to be "connected" to the MIPS program by clicking a button or will already be connected. Run
the MIPS program as you normally would, to initiate tool interaction with the executing program.
<p>Beginning with Release 3.2, the abstract class <tt>mars.tools.AbstractMarsToolAndApplication</tt>
is included in the MARS distribution to provide
a substantial framework for implementing your own MARS Tool. A subclass that extends it by
implementing at least its two abstract methods can be run not only from the Tools menu but also
as a free-standing application that uses the MARS assembler and simulator in the background.
<p>Several Tools developed by subclassing <tt>AbstractMarsToolAndApplication</tt> are included
with MARS: an Introduction to Tools, a Data Cache Simulator, a Memory Reference Visualizer, and
a Floating Point tool. The last one is quite useful even when not connected to a MIPS program
because it displays binary, hexadecimal and decimal representations for a 32 bit floating point
value; when any of them is modified the other two are updated as well.
<p>Release 3.5 includes new tools, most notably a keyboard and display simulator that allows you
to perform memory-mapped I/O (MMIO) using polled and interrupt-driven techniques as described
in various references. Click its Help button for more details.
<p>If you wish to develop your own MARS Tool, you will first need to extract the MARS distribution
from its JAR file if you have not already done so. All MARS tools must
be stored in the <tt>mars/tools</tt> directory.
<p>Follow the Tutorial Materials link on the MARS homepage to find a tutorial
that covers development of MARS Tools.
<h4>Cool Capability: Extending the syscall set or reassigning syscall numbers</h4>
Beginning with Release 3.1, system calls (<tt>syscall</tt> instruction) are implemented using
a technique similar to that for tools. This permits anyone to add a new syscall by defining
a new class that meets these requirements:
<ol>
<li>It implements the <tt>mars.mips.instructions.syscalls.Syscall</tt> interface, or
extends the <tt>mars.mips.instructions.syscalls.AbstractSyscall</tt> class (which
provides default implementations of everything except the <tt>simulate()</tt> method).
<li>It is part of the <tt>mars.mips.instructions.syscalls</tt> package.
<li>It compiles cleanly into a ".class" file, stored in the
<tt>mars/mips/instructions/syscalls</tt> directory.
</ol>
MARS will detect all qualifying syscall classes upon startup and the runtime simulator
will invoke them when the <tt>syscall</tt> instruction is simulated and register <tt>$v0</tt>
contains the corresponding integer service number.
<p>Syscalls and syscall number assignments in MARs match those of SPIM for syscalls 1 through 17.
However if you wish to change syscall number assignments, you may do so by editing the
<tt>Syscall.properties</tt> file included in the release (this requires extraction from the JAR
file).
<p>Follow the Tutorial Materials link on the MARS homepage to find a tutorial
that covers development of system calls.
<h4>Cool Capability: Extending the instruction set</h4>
You can add customized pseudo-instructions to the MIPS instruction set by editing
the <tt>PseudoOps.txt</tt> file included in the MARS distribution. Instruction
specification formats are explained in the file itself.
The specification of a pseudo-instruction is one line long. It consists of
an example of the instruction, constructed using
available instruction specification symbols, followed by a tab-separated
list of the basic MIPS instructions it will expand to. Each is an instruction template
constructed using
instruction specification symbols combined with special template
specification symbols. The latter permit substitution at program
assembly time of operands from the user's program into the expanded
pseudo-instruction.
<p><tt>PseudoOps.txt</tt> is read and processed at MARS startup, and error messages will
be produced if a specification is not correctly formatted. Note that if you wish to
edit it you first have to extract it from the JAR file.
<p>Follow the Tutorial Materials link on the MARS homepage to find a tutorial
that covers modification of the pseudo-instruction set.
<p>
<hr>
<p>
This document is available for printing on the MARS home page
<tt><b>http://www.cs.missouristate.edu/MARS/</b></tt>.
</body>
</html>