-
Notifications
You must be signed in to change notification settings - Fork 1
Home
The dashmips
module is tested and developed with python 3.8+
.
We recommend using a python version manager on these OSes to easily manage your python environment.
Pyenv works particularly well, follow the instructions at the link.
Once pyenv is installed find your os in this list and run the commands provided.
Then install the latest version of python by running pyenv install VERSION
where 'VERSION' is 3.8.0
or later.
Go to the official python site for macos releases. Grab the latest version of the "macOS 64-bit installer" and run it.
Go to the official python site for windows releases. Grab the latest version of the "Windows x86-64 executable installer" and run it.
Once you have python installed correctly you should be able to run it from a terminal.
- Macos users can find the terminal in the Utilities folder in their system's Applications folder. (Search 'terminal' with spotlight Cmd+Space).
- Windows users can use cmd or powershell found in Windows System or Windows Powershell in the Start Menu. (Search 'cmd' or 'powershell' Win+Q)
Test the following commands to confirm:
python --version
pip --version
If the python version is correct and pip
also prints a version we can install / upgrade dashmips:
pip install --upgrade dashmips
Here's your obligatory hello world, give it a whirl! Save the following code to a plain text file named "hello.mips".
(The extension is not required to be .mips
but you will notice the documentation uses the .mips
extension in later examples.)
.data
hello_str: .asciiz "Hello, World!\n"
.text
main:
li $v0, 4 # 4 is the syscall to print_str
la $a0, hello_str # Load string address into $a0
syscall
li $a0, 0 # set exit code
li $v0, 10 # 10 is the syscall to exit
syscall
Now in your terminal you can run the command:
dashmips run hello.mips
And of course you can expect:
Hello, World!
The dashmips cli is broken up into subcommands that give you easy access to the interpreter features. Each sub command has a quick one letter alias that may be useful to the future pro dashmips programmer reading this page!
Subcommand | Alias | Help |
---|---|---|
run |
r |
Executes the specified mips file, the file must contain the main function label. You can optionally specify command line arguments to be passed to the mips program. |
docs |
h |
Displays a list of all syscalls and instructions along with some helpful documentation. |
debug |
d |
Launch the debugger on the specified mips file, the file must contain the main function label. Opens a websocket that exposes the debugger functions to a viewer process. Such as the vscode dashmips-debugger extension. |
compile |
c |
Relates to functionality that produces intermediary steps in parsing and processing a mips file. For example a JSON file representing internal data structures relating to a "MipsProgram" useful if encountering bugs in the interpreter. |
utils |
u |
Utilities for generating useful helper files. For example texmate syntax highlighting spec or a mips snippets file. |
For information relating to mips and the functionality supported by this interpreter checkout the dashmips docs
command.
In fact, if you have less
installed, it might be convenient open a separate terminal from the one you are working in and run dashmips docs | less
You'll be able to scroll / search the docs using the less
commands features.
- Press
/
and start typing a keyword to search-
n
will jump to next result -
p
will jump to previous result -
q
to quit.
-
Or simply send the docs to a file and open it in your favorite editor: dashmips docs > dashmips_docs.txt
.
Happy Coding!