#Application 10 .text 0x00400000 #Code section #Display the message "X^2, X e [x1,x2]" li $v0,4 #Load the function number la $a0,msg #Load the message starting address syscall #Function call #Display the message "\nx1=" li $v0,4 #Load the function number la $a0,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 $t1,$v0 #Load the number in $t1 #Display the message "x2=" li $v0,4 #Load the function number la $a0,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 $t2,$v0 #Load the number in $t2 again: #Main loop (outer loop) mul $t0,$t1,$t1 #Calculate Square N=X^2 add $t0,$t0,-1 #Calculate Ν-1 (for displaying Ν-1 spaces) again2: #Inner loop #Display spaces li $v0,4 #Load the function number la $a0,keno #Load the message starting address syscall #Function call add $t0,$t0,-1 #Update the spaces counter bgtz $t0,again2 #While all the spaces have not been #displayed, go to again2 #Display an asterisk li $v0,4 #Load the function number la $a0,asteri #Load the message starting address syscall #Function call add $t1,$t1,1 #Update the main loop counter ble $t1,$t2,again #While the end of spaces has not been #reached, go to again #Program termination li $v0,10 #Load the function number syscall #Function call .data #Data section asteri: .asciiz "*\n" keno: .asciiz " " x1: .asciiz "\nx1=" x2: .asciiz "x2=" msg: .asciiz "X^2, X e [x1,x2]"