################################################################################## #CS2710 Homework 5 Solution. ################################################################################## .data # Tells the assembler that the following directives affect the .data section of memory PI: .float 3.1415927 # constant value for PI prompt: .asciiz "Enter the diameter: " # input prompt string answer: .asciiz "The area is: " # output message string input_error_msg: .asciiz "The input value is invalid. Exiting... " # error message string .text # text tells the assembler that following this are program instructions start: jal promptUser # prompt user to input diameter of the circle; return value in $v0 mtc1 $v0, $f0 # move return value bits from $v0 to $f0; f0 now holds diameter in single-precision # next, check to see if the entered value is <0.0. It will also be 0.0 if the input entered is invalid (e.g. "abc") addi $t1, $zero, 0 # t1=0 mtc1 $t1, $f1 # move bits from t1 to f1 (bit pattern of all 0's represents 0.0 in f1) c.le.s $f0, $f1 # check to see if f0