Soon, we will do some demos using the MIPS architecture. You will need to install the MARS simulator.
MARS is a Java jar, so run it however is appropriate for your system. I have a bash script that does this:
java -jar ~/bin/java_programs/mars/Mars4_5.jar
Check your repos for
mips-music. Open the file in MARS. A brief intro to MARS is below and you can check out Lab1 from CSSE232 for more info.
Once running, you will need to change these settings in MARS:
- Set Settings > Assemble all files in directory
- Set Settings > Permit extended (pseudo) instructions and formats
MARS has two main modes: editing and execution. You can switch between them with the tabs in the main window pane. After editing the file, you must assemble the program to create machine code. Use Run > Assemble, F3, or the Tool button to assemble.
After assembling, MARS should switch to the execution view. This shows the code and data segments, CPU registers, as well as I/O output and other messages. You can control the program execution with the actions in the Run menu, the keyboard shortcuts, or the icons in the toolbar. Note that MARS has backwards and forwards debugging.
Test your MARS
- Assemble the music file
- Run the program and verify:
- You can see output in the I/O pane
- You can here the tones as the program runs