#Application 8 .text 0x00400000 #Code section start: #Display the message "\n a=" li $v0,4 #Load the function number la $a0,read_a #Load the message starting address syscall #Function call #Read the first number li $v0,5 #Load the function number syscall #Function call move $t1,$v0 #Load the number in $t1 #Display the message "\n b=" li $v0,4 #Load the function number la $a0,read_b #Load the message starting address syscall #Function call #Read the second number li $v0,5 #Load the function number syscall #Function call move $t2,$v0 #Load the number in $t2 #Display the message "\n[x1,x2]" li $v0,4 #Load the function number la $a0,range #Load the message starting address syscall #Function call #Display the message "\nx1=" li $v0,4 #Load the function number la $a0,read_x1 #Load the message starting address syscall #Function call #Read the first limit (Χ1) li $v0,5 #Load the function number syscall #Function call move $t3,$v0 #Load the number in $t3 #Display the message "\nx2=" li $v0,4 #Load the function number la $a0,read_x2 #Load the message starting address syscall #Function call #Read the second limit (Χ2) li $v0,5 #Load the function number syscall #Function call move $t4,$v0 #Load the number in $t4 #The first limit is the initial value of the counter move $t5,$t3 #$t5=counter again: mul $t6,$t5,$t5 #Square calculation ($t6=$t5*$t5), Χ^2 mul $t7,$t2,$t5 #Product calculation ($t7=$t2*$t5), bΧ mul $t6,$t6,$t1 #Calculation $t6=$t6*$t1, AX^2 add $t6,$t6,$t7 #Calculation $t6=$t6+$t7, AX^2+BX beqz $t6,zero #If the result is zero, goto zero cont: add $t5,$t5,1 #Counter update ble $t5,$t4,again #Go to again if the second limit is #not overcome #Display the message #"\nProgram termination" li $v0,4 #Load the function number la $a0,term #Load the message starting address syscall #Function call #Program termination li $v0,10 #Load the function number syscall #Function call zero: #Display message for the value that #causes a zero result #Display the message #"\nValue for f(x)=0, x=" li $v0,4 #Load the function number la $a0,x_zero #Load the message starting address syscall #Function call #Display the value that causes #the zero result li $v0,1 #Load the function number move $a0,$t5 #Load the value to be displayed syscall #Function call j cont #Return to iteration loop for #calculating the new value .data #Data section read_a: .asciiz "\n a=" read_b: .asciiz "\n b=" range: .asciiz "\n[x1,x2]" read_x1: .asciiz "\nx1=" read_x2: .asciiz "\nx2=" x_zero: .asciiz "\nValue for f(x)=0, x=" term: .asciiz "\nProgram termination"