#Application 11 .text 0x00400000 #Code section li $t2,1 #Loop (number) counter li $t1,0 #Deviation counter #Fill array start: #Display the message "Pos[" li $v0,4 #Load the function number la $a0,m1 #Load the message starting address syscall #Function call #Display number (array location) li $v0,1 #Load the function number move $a0,$t2 #Load the number to be displayed syscall #Function call #Display the message "]=" li $v0,4 #Load the function number la $a0,m2 #Load the message starting address syscall #Function call #Read number 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,start #While all the numbers #have not been read, go to start #Read array li $t2,1 #Loop (number) counter li $t1,0 #Deviation counter start2: lw $t0,arrayA($t1) #Load the number starting #from the address #arrayA+$t1 (4 bytes) #Display the number #(from the array) li $v0,1 #Load the function number move $a0,$t0 #Load the number to be displayed syscall #Function call #Display a space li $v0,4 #Load the function number la $a0,spacechar #Load the message starting address syscall #Function call add $t1,$t1,4 #Update deviation counter add $t2,$t2,1 #Update loop counter ble $t2,10,start2 #While all the numbers have not #been read, go to start2 #Program termination li $v0,10 #Load the function number syscall #Function call .data #Data section spacechar: .asciiz " " .align 2 #Array organization arrayA: .space 40 #Array declaration m1: .asciiz "Pos[" m2: .asciiz "]="