#Application 15 .text 0x00400000 li $t2,1 #Numbers counter li $t1,0 #Deviation counter again: #Display the message "A[" li $v0,4 #Load the function number la $a0,mesA #Load the message starting address syscall #Function call #Display current 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,mesC #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 $v0 sw $t0,pinA($t1) #Store the number in the first array #starting from the address pinA+$t1 #Display the message "B[" li $v0,4 #Load the function number la $a0,mesB #Load the message starting address syscall #Function call #Display current 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,mesC #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 $v0 sw $t0,pinB($t1) #Store the number in the second array #starting from the address pinĪ’+$t1 addi $t1,$t1,4 #Update deviation counter add $t2,$t2,1 #Update loop counter ble $t2,10,again #While all the numbers have not been #read, go to again li $t2,10 #Initialize numbers counter li $t1,0 #Initialize deviation counter again2: lw $t3,pinA($t1) #Load the number from the first array #starting from the address pinA+$t1 move $t5,$t3 #Load the number in $t5 lw $t4,pinB($t1) #Load the number from the #second array starting from #the address pinB+$t1 sw $t4,pinA($t1) #Store the second number sw $t5,pinB($t1) #Store the first number addi $t1,$t1,4 #Update deviation counter sub $t2,$t2,1 #Update numbers counter bnez $t2,again2 #While the counter is not zero, #go to again2 #Display the new arrays content li $t2,10 #Numbers counter li $t1,0 #Deviation counter again3: lw $t3,pinA($t1) #Read from the first array lw $t4,pinB($t1) #Read from the second array #Display the content of the first array li $v0,1 #Load the function number move $a0,$t3 #Load the number to be displayed syscall #Function call #Display a space character li $v0,4 #Load the function number la $a0,spacechar #Load the message starting address syscall #Function call li $v0,1 #Display the content of #the second array move $a0,$t4 #Load the number to be displayed syscall #Function call #Display the message "|" li $v0,4 #Load the function number la $a0,bar #Load the message starting address syscall #Function call addi $t1,$t1,4 #Update deviation counter sub $t2,$t2,1 #Update numbers counter bnez $t2,again3 #While the counter is not zero, #go to again3 li $v0,10 #Program termination syscall #Function call #Data section .data mesA: .asciiz "A[" mesB: .asciiz "B[" mesC: .asciiz "]=" spacechar: .asciiz " " bar: .asciiz "|" .align 2 #Array organization pinA: .space 40 #First array declaration pinB: .space 40 #Second array declaration