I have the following MIPS assembly code: .data     prompt1: .asciiz "Enter integer A: "     prompt2: .asciiz "Enter integer B: "     result_add: .asciiz "A + B = "     result_sub: .asciiz "A - B = "     result_and: .asciiz "A & B = "     result_or:  .asciiz "A | B = "     result_xor: .asciiz "A ^ B = " .text     # Print prompt and read integer A     li $v0, 4          # syscall code for printing string     la $a0, prompt1    # load address of prompt1 into $a0     syscall     li $v0, 5          # syscall code for reading integer     syscall     move $t0, $v0      # save integer A in $t0     # Print prompt and read integer B     li $v0, 4          # syscall code for printing string     la $a0, prompt2    # load address of prompt2 into $a0     syscall     li $v0, 5          # syscall code for reading integer     syscall     move $t1, $v0      # save integer B in $t1     # Calculate and print A + B     add $t2, $t0, $t1     li $v0, 1          # syscall code for printing integer     move $a0, $t2      # load $t2 into $a0     syscall     li $v0, 4          # print newline     la $a0, "\n"     syscall     # Calculate and print A - B     sub $t2, $t0, $t1     li $v0, 1          # syscall code for printing integer     move $a0, $t2      # load $t2 into $a0     syscall     li $v0, 4          # print newline     la $a0, "\n"     syscall     # Calculate and print A & B     and $t2, $t0, $t1     li $v0, 1          # syscall code for printing integer     move $a0, $t2      # load $t2 into $a0     syscall     li $v0, 4          # print newline     la $a0, "\n"     syscall     # Calculate and print A | B     or $t2, $t0, $t1     li $v0, 1          # syscall code for printing integer     move $a0, $t2      # load $t2 into $a0     syscall     li $v0, 4          # print newline     la $a0, "\n"     syscall     # Calculate and print A ^ B     xor $t2, $t0, $t1     li $v0, 1          # syscall code for printing integer     move $a0, $t2      # load $t2 into $a0     syscall     li $v0, 4          # print newline     la $a0, "\n"     syscall     # Exit program     li $v0, 10         # syscall code for program exit     syscall     but it is giving me the following errors:   (attached is also the initial instructions)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I have the following MIPS assembly code:

.data
    prompt1: .asciiz "Enter integer A: "
    prompt2: .asciiz "Enter integer B: "
    result_add: .asciiz "A + B = "
    result_sub: .asciiz "A - B = "
    result_and: .asciiz "A & B = "
    result_or:  .asciiz "A | B = "
    result_xor: .asciiz "A ^ B = "

.text
    # Print prompt and read integer A
    li $v0, 4          # syscall code for printing string
    la $a0, prompt1    # load address of prompt1 into $a0
    syscall

    li $v0, 5          # syscall code for reading integer
    syscall
    move $t0, $v0      # save integer A in $t0

    # Print prompt and read integer B
    li $v0, 4          # syscall code for printing string
    la $a0, prompt2    # load address of prompt2 into $a0
    syscall

    li $v0, 5          # syscall code for reading integer
    syscall
    move $t1, $v0      # save integer B in $t1
    # Calculate and print A + B
    add $t2, $t0, $t1
    li $v0, 1          # syscall code for printing integer
    move $a0, $t2      # load $t2 into $a0
    syscall
    li $v0, 4          # print newline
    la $a0, "\n"
    syscall

    # Calculate and print A - B
    sub $t2, $t0, $t1
    li $v0, 1          # syscall code for printing integer
    move $a0, $t2      # load $t2 into $a0
    syscall
    li $v0, 4          # print newline
    la $a0, "\n"
    syscall

    # Calculate and print A & B
    and $t2, $t0, $t1
    li $v0, 1          # syscall code for printing integer
    move $a0, $t2      # load $t2 into $a0
    syscall
    li $v0, 4          # print newline
    la $a0, "\n"
    syscall

    # Calculate and print A | B
    or $t2, $t0, $t1
    li $v0, 1          # syscall code for printing integer
    move $a0, $t2      # load $t2 into $a0
    syscall
    li $v0, 4          # print newline
    la $a0, "\n"
    syscall

    # Calculate and print A ^ B
    xor $t2, $t0, $t1
    li $v0, 1          # syscall code for printing integer
    move $a0, $t2      # load $t2 into $a0
    syscall
    li $v0, 4          # print newline
    la $a0, "\n"
    syscall

    # Exit program
    li $v0, 10         # syscall code for program exit
    syscall

 

 

but it is giving me the following errors:

 

(attached is also the initial instructions)

 

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 -
spim: (parser) syntax error on line 30 of file /Users/ralucaostoia/Desktop/1/binops.asm
la $a0, "\n"
Instruction references undefined symbol at 0x00400014
[0x00400014] 0x0c000000 jal 0x00000000 [main]
; 188: jal main
Transcribed Image Text:spim: (parser) syntax error on line 30 of file /Users/ralucaostoia/Desktop/1/binops.asm la $a0, "\n" Instruction references undefined symbol at 0x00400014 [0x00400014] 0x0c000000 jal 0x00000000 [main] ; 188: jal main
Expert Solution
steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Knowledge Booster
Fundamentals of Computer System
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education