Advertisement
juaniisuar

ASSEMBLY - Array n

May 14th, 2015
527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 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. for1: bge $s0, $s1, seguir
  17.  
  18. li $v0, 5
  19. syscall
  20.  
  21. sw $v0, 0($t0)
  22.  
  23. addi $s0, $s0, 1
  24. addi $t0, $t0, 4
  25. j for1
  26.  
  27. seguir: li $s0, 0
  28. la $t0, array
  29. for2:
  30. bge $s0, $s1, ceguir
  31. li $v0, 1
  32.  
  33.  
  34. lw $a0, 0($t0)
  35. syscall
  36.  
  37. li $v0, 4
  38. la $a0, espacio
  39. syscall
  40.  
  41. addi $t0, $t0, 4
  42. addi $s0, $s0, 1
  43. j for2
  44.  
  45. ceguir: li $v0, 10
  46. syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement