Created
March 24, 2013 18:08
-
-
Save MartinThoma/5232882 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.data | |
.text | |
.globl main | |
main: la $t0, a # $t0 = &a[0] | |
li $a0, 1 # mul=1 | |
li $a1, 0 # i=1 | |
li $a3, 100 # $a3=100 | |
loop: li $t0, 4 # $t0 = 4 | |
mult $a1, $t0 # $lo = i*4 | |
mflo $a2 # $a2 = $lo | |
addu $t1,$t0,$a2 # $t1=&a[i] | |
lw $t2,0($t1) # $t2=a[i] | |
mult $a0, $t2 # mul=mul*a[i] | |
mflo $a0 # mul=mul*a[i] | |
addi $a1, $a1, 1 # i++ | |
blt $a1, $a3, loop # if i<100 goto loop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment