#Application 13 .text 0x00400000 #Code section li $t2,1 #Initialize loop counter again: #Display the message "Pos[" li $v0,4 #Load the function number la $a0,mes1 #Load the message starting address syscall #Function call move $a0,$t2 #Display current array location li $v0,1 #Load the function number syscall #Function call #Display the message "]=" li $v0,4 #Load the function number la $a0,mes2 #Load the message starting address syscall #Function call #Read number (keyboard) li $v0,5 #Load the function number syscall #Function call move $t0,$v0 #Load the number in $t0 sw $t0,arrayA($t1) #Store the number starting from #the address arrayA+$t1 (4 bytes) add $t1,$t1,4 #Update deviation counter add $t2,$t2,1 #Update loop counter ble $t2,10,again #If all the numbers have not been #read, go to again li $t4,0 #Assume that the maximum number exists in #the first array location li $t2,1 #Initialize loop counter li $t1,0 #Initialize deviation counter lw $t4,arrayA($t1) #Read number (starting from the #address arrayA+$t1) again2: lw $t3,arrayA($t1) #Read number (starting from the #address arrayA+$t1) bgt $t4,$t3,syn #If the current number is less or equal #to maximum, then the next array #number is processing move $t4,$t3 #If a new maximum is found, #then update $t4 syn: add $t1,$t1,4 #Update deviation counter add $t2,$t2,1 #Update loop counter ble $t2,10,again2 #If all the numbers have #not been read, go to again2 #Display the message "\nmax=" li $v0,4 #Load the function number la $a0,max_msg #Load the message starting address syscall #Function call #Display the maximum li $v0,1 #Load the function number move $a0,$t4 #Load the number to be displayed syscall #Function call li $v0,10 #Program termination syscall #Function call .data #Data section mes1: .asciiz "Pos[" mes2: .asciiz "]=" max_msg: .asciiz "\nmax=" .align 2 #Array organization arrayA: .space 40 #Array declaration