Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
loop.s<br />
.text<br />
.globl main<br />
main: add $t0, $zero, $zero # loop-counter i<br />
addi $s0 ,$zero, 5 # loop limit N<br />
If you start with<br />
the comments<br />
<strong>and</strong> the labels<br />
you can use<br />
them as your<br />
loop: beq $t0, $s0, done # for i = 0...(N-1)<br />
add $a0, $zero, $t0 # print i<br />
# system ”recipe” call code for for the print_int<br />
li $v0,<br />
program,<br />
1<br />
syscall<br />
translating the<br />
comments <strong>and</strong><br />
labels into<br />
<strong>MIPS</strong> assembly<br />
addi $t0, $t0, 1 # i ++<br />
j loop # loop again<br />
done: jr $ra # return to caller