Advertisement
juaniisuar

Untitled

May 26th, 2015
542
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. .data
  2. str1: .asciiz "Cant de numeros: "
  3. espacio: .asciiz " "
  4. array: .space 512 # 128 ints
  5.  
  6. .text
  7. main: li $v0, 4
  8. la $a0, str1
  9. syscall
  10. li $v0, 5
  11. syscall
  12.  
  13. li $s0, 0
  14. la $t0, array
  15. or $s1, $v0, $0
  16.  
  17. for1: bge $s0, $s1, seguir
  18.  
  19. li $v0, 5
  20. syscall
  21.  
  22. sw $v0, 0($t0)
  23.  
  24. addi $s0, $s0, 1
  25. addi $t0, $t0, 4
  26. j for1
  27.  
  28. seguir:
  29. li $t0, 0
  30. la $t5, array
  31.  
  32. FOR: bge $t0, $s1, finpr
  33.  
  34. li $t1, 0
  35. li $t2, 1
  36. addi $t6, $t5, 0
  37.  
  38. FOR2: bge $t2, $s1, fin2
  39.  
  40. lw $t3, 0($t6)
  41. lw $t4, 4($t6)
  42. bge $t4, $t3, noswap # si es menor hace ...
  43.  
  44. sw $t3, 4($t6)
  45. sw $t4, 0($t6)
  46.  
  47. noswap: addi $t6, $t6, 4
  48. addi, $t1, $t1, 1
  49. addi, $t2, $t2, 1
  50. j FOR2
  51.  
  52. fin2: addi $t5, $t5, 4
  53. addi $t0, $t0, 1
  54. j FOR
  55.  
  56. finpr: li $s0, 0
  57. la $t0, array
  58.  
  59. for2:
  60. bge $s0, $s1, ceguir
  61. li $v0, 1
  62.  
  63. lw $a0, 0($t0)
  64. syscall
  65.  
  66. li $v0, 4
  67. la $a0, espacio
  68. syscall
  69.  
  70. addi $t0, $t0, 4
  71. addi $s0, $s0, 1
  72. j for2
  73.  
  74. ceguir: li $v0, 10
  75. syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement