So, my MIPS program has the user enter 3 integers and order them from least to greatest and print them out. My code is as follows:
.data
prompt: .asciiz "Please enter an integer: "
.text
main:
li $v0, 4
la $a0, prompt
syscall
li $v0, 5
syscall
move $s0, $v0
li $v0, 5
syscall
move $s1, $v0
li $v0, 5
syscall
move $s2, $v0
jal order3
li $v0, 1
move $a0, $s0
syscall
li $v0, 1
move $a1, $s1
syscall
li $v0, 1
move $a2, $s2
syscall
li $v0, 10
syscall
swap:
move $t0, $s0
move $s0, $s1
move $s1, $t0
jr $ra
swap1:
move $t0, $s1
move $s1, $s2
move $s2, $t0
jr $ra
order3:
bgt $s0, $s1, swap
bgt $s1, $s2, swap1
bgt $s0, $s1, swap
jr $ra
The problem is the program is only printing out the first number I enter. For example, if I enter 60,50,70 as my 3 inputs, it is outputting 60 three times. I do not know why this is doing this. Im guessing it has something to do with my order3 function or with the way i am outputting these values. Any help would be appreciated.
Thanks.