QuestionQuestion

Question: Write a program using MIPS instruction set that will read a series of even non-negative integers (greater than or equal to zero) one by one until either the total count of valid numbers read becomes 10 or user has entered a cardinal value ( -9). At the end, the program will print the sum of the valid numbers read, total count of valid numbers read and the integer average of the valid numbers read. It will store these three integers in named static variables before the program ends. If an invalid number is entered the program will ignore it and print an error message.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

###########################################################
# Register Usage
# $t0
# $t1
# $t2
# $t3
# $t4
# $t5
# $t6
# $t7
# $t8
# $t9
###########################################################
.data
sumMsg: .asciiz "Sum of the valid numbers read: "
totalMsg: .asciiz "Total count of valid numbers read : "
avgMsg: .asciiz "The integer average of the valid numbers read: "
errorMsg: .asciiz "An invalid number is entered"
newline: .asciiz "\n"
sum: .word 0
total: .word 0
avg: .word 0

###########################################################
.text
main:
# counter = 0
add $t0, $zero, 0
# sum = 0
add $t1, $zero, 0

while:
# if counter > 10 break
bge $t0, 10, end_while

# get a number to $v0
li $v0, 5
syscall

# user has entered a cardinal value ( -9).
beq $v0, -9, end_while
# if $v0 < 0 move to negaive label
blt $v0, 0, negative...

By purchasing this solution you'll be able to access the following files:
Solution.s.

$50.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats