Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- x: .word 1,2,3,4,5,6,7,8,90,10
- i: .word 0
- size: .word 9
- prompt: .asciiz "The total sum of the array is equal to: "
- .text
- main:
- la $s0, prompt
- la $t0, x
- lw $t1, i
- lw $t2, size
- begin_loop:
- bgt $t1,$t2 exit_loop
- sll $t3,$t1 2
- addu $t3,$t3,$t0 #ja dodavame baznata adresa 1000 + 4
- lw $t6,0($t3)
- addu $s7,$s7,$t6
- addi $t1,$t1,1
- j begin_loop
- exit_loop:
- li $v0, 4
- la $a0, prompt
- syscall
- li $v0, 1
- la $a0, ($s7)
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement