Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. # esercizio VII - 3
  2.  
  3. .data
  4.  
  5. matrice: .word 3,6,7,8,1,5,2,0,6,8,10,5,4,1,-9,2
  6. dimensioni: .word 4
  7. .text
  8.  
  9. lw $s0, dimensioni #lato matrice
  10. mul $s1, $s0, $s0 #dimensioni matrice
  11. li $t0, 0 #conteggio righe
  12. li $t1, 0 #conteggio colonne
  13. la $s5, matrice
  14. li $t8, 0 #somma
  15.  
  16. ciclo:
  17.  
  18. mul $s7, $s0 ,$t1
  19. add $s7, $s7, $t0
  20. sll $s7, $s7, 2
  21. add $s7, $s7, $s5
  22. lw $t7, ($s7)
  23. add $t8, $t8, $t7
  24. addi $t1, $t1, 1
  25. bne $t1, $s0, ciclo
  26.  
  27. move $a0, $t8
  28. li $v0, 1
  29. syscall
  30. addi $t0, $t0, 1
  31. li $t1, 0
  32. li $t8, 0
  33. beq $t0, $s0, fine
  34. j ciclo
  35.  
  36. fine:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement