Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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: `
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education