create an array and sort it in ascending and descending way [MIPS]
<p>I have to ask the user a number, store that number and then create a vector of that size and ask the user for numbers to store in the array, so far I have this, but I don't know how to continue:</p>

<pre><code>.data
 string1: .asciiz "\nIntroduce size of array\n"
 string2: .asciiz "\nIntroduce next number\n"
 string3: .asciiz "\nBye\n"

 array: .word

.text
main:   
 la $t4, array       #store the direction of the array

 li $v0, 4
 la $a0, string1
 syscall
 li $v0, 5
 syscall
 move $t0, $v0      #t0 = vector size

 asknum:
 li $v0, 4
 la $a0, string2
 syscall
 li $v0, 5
 syscall
 move $t5, $v0      #t5 = num introduced
 sw $t5, 4($t4)     #save number in the array, the program crashes here
 add $t2, $t2, 1
 bne $t2, $t0, asknum

 la $a0, cadena3
 li $v0,4
 syscall
 li $v0,10
 syscall
</code></pre>

<p>I don't know why the program crashes when I try to store the number (I guess I'm storing it wrong) and I honestly have no idea how to sort an array in MIPS lenguage, any help would be appreciated.</p>