Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- vector: .word 100,-20,40,-365,400,65536,1,0,3,-10
- .text
- li x9 10
- PushMax:
- la x5 vector
- addi x6 x0 10
- slli x6 x6 2
- add x6 x5 x6 #x6 tope
- addi a0 x5 0
- addi a1 x5 4
- loop:
- beq a1 x6 PrintVector
- beq x0 x0 MaxDir
- MaxDir:
- lw x7 0(a0)
- lw x8 0(a1)
- bgt x7 x8 Swap
- addi a0 a0 4
- addi a1 a1 4
- beq x0 x0 loop
- Swap:
- lw a2 0(a0)
- lw a3 0(a1)
- sw a2 0(a1)
- sw a3 0(a0)
- addi a0 a0 4
- addi a1 a1 4
- beq x0 x0 loop
- PrintVector:
- lw a0 0(x5)
- li a7 1
- ecall
- li a0 44
- li a7 11
- ecall
- addi x5 x5 4
- blt x5 x6 PrintVector
- li a0 10
- ecall
- addi x9 x9 -1
- bgt x9 x0 PushMax
- nop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement