Hello I have been practicing writing assembly language and I have been working on this seemingly simple code. I want to prompt the user for input then i want to take that input and put it into an array. Then i want to print out the array. I know I can just print them out without putting them in an array but this is just for my practice. Something is just not right though it wont print them back out.
.data
array: .space 400
prompt: .asciiz "Enter an integer (0 to quit) :"
text: .asciiz "After sorting, the list of integers is:"
.text
.globl main
main:
la $a1, array
li $v0, 4
la $a0, prompt
syscall
li $v0, 5
syscall
sw $v0, 0($a1)
addiu $a1, $a1, 4
beqz $v0, sort
j main
sort:
la $a1, $array
li $v0, 4
la $a0, text
syscall
loop:
lw $t0, 0($a1)
addiu $a1, $a1, 4
beqz $t0, done
li $v0, 1
move $a0, $t0
syscall
j loop
done:
please help me with what i am doing wrong. Oh and the zero is kind of the sentinal value when i hit a zero that means its the end of the input