Question: Write a program in MIPS assembly language to compute the average of an ASCII odd number string containing only integer decimal string. You can use

Write a program in MIPS assembly language to compute the average of an ASCII
odd number string containing only integer decimal string. You can use pseudo
instructions. Your program should expect register $a0 to hold the address of a
null-terminated string containing some combination of the digits 0 through 9. Your
program should compute the sum of the even integer value equivalent to each digit
in the string, then place this number in register $v0. If a non-digit character
appears anywhere in the string, your program should stop with the value -1 in
register $v0. For example, if register $a0 points to a sequence of three bytes 50ten,
53ten, 52ten, 52ten (the null terminated string 255), then when the program stops,
register $v0 should contain the value of 5, which is computed as (5+5)/2.

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 Programming Questions!