Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data #in: n, n intregi; out: poz maxim
- v: .space 400
- n: .space 4
- .text
- main:
- li $v0 5
- syscall
- move $t0 $v0
- sw $t0 n
- li $t1 0 #iterator
- li $t2 0 #pointer
- li $t3 0 #max pos
- readloop: bge $t1 $t0 finish
- li $v0 5
- syscall
- sw $v0 v($t2)
- lw $t4 v($t3)
- bge $t4 $v0 cond
- move $t3 $t2
- cond:
- addi $t1 1
- addi $t2 4
- j readloop
- finish:
- li $v0 1
- move $a0 $t3
- syscall
- li $v0 10
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement