Due Tuesday, June 27 at 11:59 PM
By the time you have completed this work, you should be able to:
Read and familiarize yourslf with a short QtSpim tutorial. This tutorial discusses how to open and run MIPS assembly code from within QtSpim, which you will be doing frequently over the next few weeks. Additionally, the following resources will be useful:
syscall
instruction is executed.
Download all the files listed under Provided files above.
print_hardcoded_strings.asm
Open the print_hardcoded_strings.asm
file, and open it up in a text editor of your choice.
Note that word processors (e.g., Microsoft Word, Pages, Google Docs) will probably not work for this purpose, as you must save your file as plain text.
You must write MIPS assembly code which, when run under QtSpim, will print the following:
first second
print_hardcoded_strings.asm
contains comments which further describe exactly how you can go about this.
As a hint, your code will look similar to hello_world.asm
.
print_not.asm
Open the print_not.asm
file, and open it up in a text editor of your choice.
Note that word processors (e.g., Microsoft Word, Pages, Google Docs) will probably not work for this purpose, as you must save your file as plain text.
You must write MIPS assembly code which will read an integer from the user, and will then print (in order):
nor
instruction)63
was the input integer:
63 -64
print_not.asm
contains comments which further describe exactly how you can go about this.
As a hint, your code will look similar to read_and_print_int.asm
.
binops.asm
Open the binops.asm
file, and open it up in a text editor of your choice.
Note that word processors (e.g., Microsoft Word, Pages, Google Docs) will probably not work for this purpose, as you must save your file as plain text.
You must write MIPS assembly code which will read two integers from the user (hereafter referred to as A
and B
, respectively), and will then print (in order):
A + B
on its own lineA - B
on its own lineA & B
(bitwise AND) on its own lineA | B
(bitwise OR) on its own lineA ^ B
(bitwise XOR) on its own line
Example output of this code is shown below, which results from reading in 4
and 5
as the provided integers:
9 -1 4 5 1
binops.asm
contains comments which further describe exactly how you can go about this.
As a hint, your code will look similar to the basic examples under the week 3 materials..
Log into Canvas, and go to the COMP 122 class.
Click “Assignments” on the left pane, then click “Lab 4”.
From here, you can upload your .asm
files.
Specifically, you must turn in the following three files:
print_hardcoded_strings.asm
print_not.asm
binops.asm
In addition, if you collaborated with anyone else, be sure to download collaborators.txt
and write the names of the people you collaborated with in the file, one per line.
Please submit this file along with the other three files.
You can turn in the assignment multiple times, but only the last version you submitted will be graded.
The code you submit must run under QtSpim without modification.
Code with syntax errors gets an automatic 0.
If you can't get your code to do the right thing, it's better to submit code that runs but does the wrong thing.