#------------------------------------------------
main:       lui      $s2,0x1000        # load base addr
   
            lw       $s3,0($s2)        # load data count
            add      $s2,$s2,4         # data start address 

            add      $s1,$zero,$zero   # init accumulator
            add      $s0,$zero,$zero   # init loop variable

Loop:       slt      $t0,$s1,$s3
            beq      $t0,$zero,Exit

            add      $t0,$s1,$s1       # begin compute effective address
            add      $t0,$t0,$t0
            add      $t1,$s2,$t0       # end compute effective address
            lw       $t0,0($t1)
	         
            sub      $t0,$zero,$t0
            add      $s0,$s0,$t0
            addi     $s1,$s1,1
            j        Loop

#------------------------------------------------
Exit:       ori      $2,$0,10          # system call: exit program
            syscall
