You are on page 1of 1

.

text
.globl main
main:
addi
$s1, $0,0
#g=0
addi
$s2, $0,7
#h=7
addi
$s3, $0,1
#i=1 which would correspond to 1 in list
addi
$s4, $0,2
#j=2
sll
$t1, $s3, 2 #$t1= i*4
lw
$t0, list($t1) #t0=A[i] i.e 1
Lab3.3: add
$s1, $s1, $t0 #g=g+A[i]
add
$s3, $s3,$s4
beq
$s3, $s2, Exit
j
Lab3.3
Exit: nop
list: .word 10,1,2,3,4,5,6,7,8,9

You might also like