Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- str1: .asciiz "Cant de numeros: "
- espacio: .asciiz " "
- array: .space 512 # 128 ints
- .text
- main: li $v0, 4
- la $a0, str1
- syscall
- li $v0, 5
- syscall
- li $s0, 0
- la $t0, array
- or $s1, $v0, $0
- for1: bge $s0, $s1, seguir
- li $v0, 5
- syscall
- sw $v0, 0($t0)
- addi $s0, $s0, 1
- addi $t0, $t0, 4
- j for1
- seguir:
- li $t0, 0
- la $t5, array
- FOR: bge $t0, $s1, finpr
- li $t1, 0
- li $t2, 1
- or $t6, $t5, $0
- FOR2: bge $t2, $s1, fin2
- lw $t3, 0($t6)
- lw $t4, 4($t6)
- bge $t4, $t3, noswap # si es menor hace ...
- sw $t3, 4($t6)
- sw $t4, 0($t6)
- noswap:
- addi $t6, $t6, 4
- addi $t1, $t1, 1
- addi $t2, $t2, 1
- j FOR2
- fin2:
- addi $t0, $t0, 1
- j FOR
- finpr: li $s0, 0
- la $t0, array
- for2:
- bge $s0, $s1, ceguir
- li $v0, 1
- lw $a0, 0($t0)
- syscall
- li $v0, 4
- la $a0, espacio
- syscall
- addi $s0, $s0, 1
- addi $t0, $t0, 4
- j for2
- ceguir: li $v0, 10
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement