Question: 4. Write a function which will take a distance measurement, given in inches, and produce the same distance in yards, feet, and inches. For example,

4. Write a function which will take a distance measurement, given in inches, and produce the same distance in yards, feet, and inches. For example, if the given distance is 86 inches, the result should be 2 yards, 1 foot, and 2 inches. The API is shown below: ### Author: ### Convert given number of inches to inches, feet, and yards ### Example: 122 inches => 3 yards, 1 foot, 2 inches ### Register $a0 contains the given number of inches ### Register $a1 points to memory area for results: 120 CHAPTER 3. ASSEMBLY LANGUAGE FOR MIPS .text ######################## Begin hms function ### Convert a whole number of seconds to ### hours, minutes, and seconds. ### 3701 seconds => 1 hour 1 minute, 41 seconds ### Total seconds is provided in $a0 ### Register $a1 points to a memory area for ### three results: hours, minutes, seconds ### Pre: All values are non-negative. ### Author: sdb hms: addi $sp, $sp, -12 sw $ra, 0($sp) sw $s0, 4($sp) sw $s1, 8($sp) li $s0, 60 div $a0, $s0 mfhi $s1 sw $s1, 8($a1) # seconds mflo $a0 # total minutes div $a0, $s0 mfhi $s1 sw $s1, 4($a1) # minutes mflo $s1 sw $s1, 0($a1) # hours lw $s1, 8($sp) # return to calling function lw $s0, 4($sp) # return to calling function lw $ra, 0($sp) # return to calling function addi $sp, $sp, 12 jr $ra ########################## End function hms4. Write a function which will take a distance measurement, given in

4. Write a function which will take a distanoe messurement, given in inches, and produce the same distance in yards, feet, and inches. For example, if the given distance is 86 inches, the result should be 2 yards, 1 foot, and 2 inches. The API is shown below: AH4 Author: AH: Convert given nunber of inches to inches, feet, and yards AH* Example: 122 inchee m3 yarde, 1 foot, 2 inches AH: Register $00 contains the given number of inches AH: Register \$a1 points to nenory area for results: 120 CHAPTER 3. ASSEMBLY LANGUAGE FOR MIPS Figure 3.77: Function to coavert tatal mumber of seconds to bours, minutes, and seconds 3.14. FLOATING POINT INSTRUCTIONS 121

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!