Question: MIPS prob3.s .data str1: .asciiz Please enter a number: .align 2 vals: .word 25 1 4 10 381 42 100 60 0 12 .text

MIPS prob3.s .data str1: .asciiz "Please enter a number: " .align 2 vals: .word 25 1 4 10 381 42 100 60 0 12 .text .globl main

main: # Start program addi $s1, $zero, 0 # s1 is ouput value inputs: # Request some user input: li $v0, 4 la $a0, str1 syscall # Read some user input: li $v0, 5 syscall

sll $s0, $v0, 5

# Request some user input: li $v0, 4 la $a0, str1 syscall # Read some user input: li $v0, 5 syscall

sll $v0, $v0, 2 # Usually you would let the assembler to the heavy lifting by using: la $s1, vals lui $s1, 0x1001 addiu $s1, $s1, 24 addu $s1, $s1, $v0 lw $s1, 0($s1) addu $s1, $s0, $s1

# Print output li $v0, 1 addi $a0, $s1, 0 syscall # Exit program li $v0, 10 syscall A. What does this program do? B. Modify prob3.s to average two array values and write the value back to a third array location. All three indices should be entered by the user. For this assignment, you may assume that the user inputs correct values. Provide three test cases (inputs and observed output) showing your code works and describe how you verified correctness.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!