The code runs fine if the first input integer is the largest, but if the second or third are larger it crashes or stops. I used the error message to determine that the code jr $ra stops the program. If I run another program I made that has that same line it works fine. i have absolutely no idea what the problem is.
.data
in_string: .asciiz "\nInput a integer: "
input_result: .asciiz "\nThe number you put in was: "
out_string: .asciiz "\n\nThe highest integer is: "
error: .asciiz "**error past here!!!**\n\n"
line: .asciiz "\n\n"
prgrm_exit: .asciiz "\nProgram Ended\nSee ya later!!!"
.text
main:
li $v0, 4 # system call code for printing string = 4
la $a0, in_string # load address of string to be printed into $a0
syscall # call operating system to perform print operation
li $v0, 5 # system call code for read integer = 5
syscall # call operating system
move $s0, $v0 # value read from keyboard returned in register $v0; transfer to $s0
li $v0, 4 # system call code for printing string = 4
la $a0, input_result # load address of string to be printed into $a0
syscall # call operating system to perform print operation
li $v0, 1 # system call code for printing integer = 1
move $a0, $s0 # move integer to be printed into $a0: $a0 = $s0
syscall # call operating system to perform print
li $v0, 4 # system call code for printing string = 4
la $a0, in_string # load address of string to be printed into $a0
syscall # call operating system to perform print operation
li $v0, 5 # system call code for read integer = 5
syscall # call operating system
move $s1, $v0 # value read from keyboard returned in register $v0; transfer to $s0
li $v0, 4 # system call code for printing string = 4
la $a0, in_string # load address of string to be printed into $a0
syscall # call operating system to perform print operation
li $v0, 5 # system call code for read integer = 5
syscall # call operating system
move $s2, $v0 # value read from keyboard returned in register $v0; transfer to $s2
move $s3, $s0 # move first input integer into result register ($s3)
blt $s3, $s1, greater # checks to see if $s3 is less than $s1
li $v0, 4 # system call code for printing string = 4
la $a0, error # load address of string to be printed into $a0
syscall # call operating system to perform print operation
slt $t1, $s3, $s1 # checks to see if $s3 is less than $s2
bne $t1, $0, greatest # branches to function "greatest" if $s2 is greater than the integer in $s3
li $v0, 4 # system call code for printing string = 4
la $a0, out_string # load address of string to be printed into $a0
syscall # call operating system to perform print operation
li $v0, 1 # system call code for printing integer = 1
move $a0, $s3 # move integer to be printed into $a0: $a0 = $s0
syscall # call operating system to perform print
j exit
greater:
move $s3, $s1 # moves s1 into s3
li $v0, 4 # system call code for printing string = 4
la $a0, error # load address of string to be printed into $a0
syscall # call operating system to perform print operation
jr $ra # return address
greatest:
move $s3, $s2 # moves s1 into s3
jr $ra # return address
exit:
# print out exit message
li $v0, 4 # system call code for printing string = 4
la $a0, prgrm_exit # load address of string to be printed into $a0
syscall # call operating system to perform print operation
# exit program
li $v0, 10 # system call code for exit = 10
syscall # call operating system