Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- arr: .word 0:20
- .text
- .globl main
- main:
- li $s0, 0 # sum
- li $s1, 1 # array[0]
- li $s2, 2 # omega
- la $s3, array # initialise array
- add $t0, $t0, 1 # init. i = 0
- add $t1, $t1, 19 # init. j = 19
- sw $s1, 0($s3) # a[0] = s1 = 1
- beq $zero, $zero, TEST1
- TEST1:
- slt $t2, $t0, 20
- bne $t2, $zero, LOOP1
- LOOP1:
- add $t3, $t0, -1 # temp = i - 1
- add $t3, $t3, $s3 # a[i-1]
- add $t4, $t0, %s3 # a[i]
- add $t5, $t3, $s2
- sw $t4, 0($t5) # a[i] = omega + a[i-1]
- addi $t0, $t1, 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement