# Program to print 0 if integer input is even; 1 if input is odd prompt1: prompt 2: prompt 3: label: num: new ln: main: .data .asciiz "This program prints a zero if the input is even" asciiz "and a 1 if the input is odd.n" asciiz "Enter an integer: " .asciiz "Your result is " .word .asciiz "n" .text li la syscall $v0,4 $a0, promptl li la syscall li $v0,4 $a0, prompt2 li la syscall $v0,4 $a0, prompt 3 $v0,5 syscall move $50, $v0 $10,2 $t0,$s0,$t0 li div mfhi $t1 $v0,4 $a0, label li la syscall li $v0,1 move $a0,$t1 syscall $v0,4 $a0, new_ln li la syscall li $v0,10 syscall #output prompt1 for user #output prompt2 for user #output prompt 3 for user #input the integer and save it to $80 #check if input is odd or even by #division by 2; saving rem in $t1 #print the output label #print result-remainder #print newline #exit program Example Modify the MIPS program in Example as following: 1. Take two integer values from user input instead of using given numbers. The

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
100%

Please help me to solve this problem. Thank you in advance =)

### MIPS Assembly Language Program Example and Modification Instructions

#### Example Program
The following MIPS assembly program prints `0` if an integer input is even, and `1` if the input is odd.

```assembly
# Program to print 0 if integer input is even; 1 if input is odd

.data
prompt1:    .asciiz "This program prints a zero if the input is even"
prompt2:    .asciiz "and a 1 if the input is odd.\n"
prompt3:    .asciiz "Enter an integer: "
label:      .asciiz "Your result is "
num:        .word 0
new_ln:     .asciiz "\n"

.text
main:

    li      $v0,4         # output prompt1 for user
    la      $a0,prompt1
    syscall

    li      $v0,4         # output prompt2 for user
    la      $a0,prompt2
    syscall

    li      $v0,4         # output prompt3 for user
    la      $a0,prompt3
    syscall

    li      $v0,5         # input the integer and save it to $s0
    syscall
    move    $s0,$v0

    li      $t0,2         # check if input is odd or even by division by 2; saving remainder in $t1
    div     $t0,$s0,$t0
    mfhi    $t1

    li      $v0,4         # print the output label
    la      $a0,label
    syscall

    li      $v0,1         # print result = remainder
    move    $a0,$t1
    syscall

    li      $v0,4         # print newline
    la      $a0,new_ln
    syscall

    li      $v0,10        # exit program
    syscall
```

#### Modification Instructions
Modify the MIPS program in the example as follows:

1. **Input Handling**:
   - Take two integer values from user input instead of using predefined numbers.
   - Prompt users with "Enter the dividend:" and "Enter the divisor:" to get the user inputs.

2. **Division Operations**:
   - Perform two different division operations: `
Transcribed Image Text:### MIPS Assembly Language Program Example and Modification Instructions #### Example Program The following MIPS assembly program prints `0` if an integer input is even, and `1` if the input is odd. ```assembly # Program to print 0 if integer input is even; 1 if input is odd .data prompt1: .asciiz "This program prints a zero if the input is even" prompt2: .asciiz "and a 1 if the input is odd.\n" prompt3: .asciiz "Enter an integer: " label: .asciiz "Your result is " num: .word 0 new_ln: .asciiz "\n" .text main: li $v0,4 # output prompt1 for user la $a0,prompt1 syscall li $v0,4 # output prompt2 for user la $a0,prompt2 syscall li $v0,4 # output prompt3 for user la $a0,prompt3 syscall li $v0,5 # input the integer and save it to $s0 syscall move $s0,$v0 li $t0,2 # check if input is odd or even by division by 2; saving remainder in $t1 div $t0,$s0,$t0 mfhi $t1 li $v0,4 # print the output label la $a0,label syscall li $v0,1 # print result = remainder move $a0,$t1 syscall li $v0,4 # print newline la $a0,new_ln syscall li $v0,10 # exit program syscall ``` #### Modification Instructions Modify the MIPS program in the example as follows: 1. **Input Handling**: - Take two integer values from user input instead of using predefined numbers. - Prompt users with "Enter the dividend:" and "Enter the divisor:" to get the user inputs. 2. **Division Operations**: - Perform two different division operations: `
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Concept of memory addresses in pointers
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