I searched through an array and find the maximum number to print, I have found the max and stored it in the register r4 but I don't know how to print it as a string with a new line.
la $t0, sequence #t0 is the address of array
lw $t4, 0($t0) #t4 is the updating max variable
li $t1, 1 # initiate counter to 1, load into t1
lw $t2, sequence_length
loop:
beq $t1, $t2, exit
addi $t0, $t0, 4 #increment the address by 4 (the address of the next item in array)
addi $t1, $t1, 1 #increment the counter by 1
lw $t3, 0($t0) #load the the next item into t3
ble $t3, $t4, end_if #if next item is larger than the current max in t4,
move $t4, $t3 #update t4 with t3
end_if:
j loop
exit:
move $a0, $t4
li $v0, 1
syscall
jr $ra