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): 1. A + B on its own line 2. A B on its own line 3. A & B (bitwise AND) on its own line 4. A B (bitwise OR) on its own line 5. A 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

icon
Related questions
Question

Write the following MIPS assembly code

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):
1. A + B on its own line
2. A
B on its own line
3. A & B (bitwise AND) on its own line
4. A | B (bitwise OR) on its own line
5. A 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
+50
4
5
1
-
Transcribed Image Text: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): 1. A + B on its own line 2. A B on its own line 3. A & B (bitwise AND) on its own line 4. A | B (bitwise OR) on its own line 5. A 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 +50 4 5 1 -
.text
main:
# TODO: write your code below this comment
# Your code should do the following, in this order:
#
Read the first integer from the user, putting it in
some known register
#
binops.asm
# Read the second integer from the user, putting it in
some known register
#
Add the two integers, print the result, print a newline
Subtract the second integer from the first integer,
#
#
# print the result, print a newline
# - Bitwise AND the two integers together, print the result,
# print a newline
#Bitwise
the two integers together, print the result,
#
# - Bitwise XOR the two integers together, print the result,
# print a newline
print a newline
#exit program
li $v0, 10
sys call
Transcribed Image Text:.text main: # TODO: write your code below this comment # Your code should do the following, in this order: # Read the first integer from the user, putting it in some known register # binops.asm # Read the second integer from the user, putting it in some known register # Add the two integers, print the result, print a newline Subtract the second integer from the first integer, # # # print the result, print a newline # - Bitwise AND the two integers together, print the result, # print a newline #Bitwise the two integers together, print the result, # # - Bitwise XOR the two integers together, print the result, # print a newline print a newline #exit program li $v0, 10 sys call
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer