Advertisement
juaniisuar

Untitled

May 26th, 2015
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 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. li $t1, 0
  31. li $t2, 0
  32. la $t5, array
  33.  
  34. FOR: bge $t0, $s1, finpr
  35.  
  36. addi $t1, $t0, 0
  37. addi $t2, $t0, 1
  38.  
  39. addi $t6, $t5, 0
  40. FOR2: bge $t2, $s1, fin2
  41.  
  42. lw $t3, 0($t6)
  43. lw $t4, 4($t6)
  44. bge $t3, $t4, noswap # si es menor hace ...
  45.  
  46. sw $t4, 0($t6)
  47. sw $t3, 4($t6)
  48.  
  49. noswap: addi $t6, $t6, 4
  50. addi, $t1, $t1, 1
  51. addi, $t2, $t2, 1
  52. j FOR2
  53.  
  54. fin2: addi $t5, $t5, 4
  55. addi $t0, $t0, 1
  56. j FOR
  57.  
  58. finpr: li $s0, 0
  59. la $t0, array
  60.  
  61. for2:
  62. bge $s0, $s1, ceguir
  63. li $v0, 1
  64.  
  65. lw $a0, 0($t0)
  66. syscall
  67.  
  68. li $v0, 4
  69. la $a0, espacio
  70. syscall
  71.  
  72. addi $t0, $t0, 4
  73. addi $s0, $s0, 1
  74. j for2
  75.  
  76. ceguir: li $v0, 10
  77. syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement