Question
This is what I have so far: .text .globl main main: li $t0, 0 li $t1, 0 li $t2, 0 li $t3, 0 li $t4,
This is what I have so far:
.text .globl main
main: li $t0, 0 li $t1, 0 li $t2, 0 li $t3, 0 li $t4, -1 la, $a0, scores
evaluate: lw $t2, 0($a0) beq $t2, $t4, compute slti $t3, $t2, 0 bne $t3, $t2, badnum slti $t3, $t2, 101 beq $t3, $zero, badnum
beq $t2, $t4, compute add $t1, $t1, $t2 addi $t0, $t0, 1 addi $a0, $a0, 4 j evaluate
badnum: addi $a0, $a0, 4 j evaluate
compute: li $a1, 4 la $a0, avgStr syscall
div $t1, $t0 mflo $a1 move $a0, $a1 li $a1, 1 syscall
.data scores: .word 145, 101, 97, 92, 84, 100, 89, 90, 66, 78, 94, -124, 82, 79, -4, 55, -1 avgStr: .asciiz "The average is: " remstr: .asciiz "The remainder is: "
MIPS 1(b): # write and compile a program that will compute average of list of test scores and return in $a1, with the #remainder in Sa 2. The program should also print the average and remainder in the 1/0 window: e.g. 'The #average is' and 'with the remainder of # The list consists of numbers from 0 through 100 and is terminated with -1. However, values > 100 and = 0 && *score 100 This is the data (scores) section .data scores: .word 145, 101, 97, 92, 84, 100, 89, 90, 66, 78, 94, -124, 82, 79,-4, 55, -1 avgstr: .asciiz "The average is" remstr: .asciiz" with a remainder of" # Add meaningful comments (documentation) to your code and submit it as MIPS 1(b): # write and compile a program that will compute average of list of test scores and return in $a1, with the #remainder in Sa 2. The program should also print the average and remainder in the 1/0 window: e.g. 'The #average is' and 'with the remainder of # The list consists of numbers from 0 through 100 and is terminated with -1. However, values > 100 and = 0 && *score 100 This is the data (scores) section .data scores: .word 145, 101, 97, 92, 84, 100, 89, 90, 66, 78, 94, -124, 82, 79,-4, 55, -1 avgstr: .asciiz "The average is" remstr: .asciiz" with a remainder of" # Add meaningful comments (documentation) to your code and submit it as
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started