# loop sample ####################################### # sample 01 .data STR_MESSAGE: .asciiz "I am here!" NEW_LINE: .asciiz "\n" .text .globl main main: # set the parameters ######################### li $t0, 0 # set "zero" to $t0 register li $t1, 1 # set "one" to $t1 register li $t2, 10 # loop counter loop_01: # print the text message ##################### li $v0, 4 # system call no. 4 la $a0, STR_MESSAGE # point to the message syscall # do it! # provie a new-line ########################## li $v0, 4 # system call no. 4 la $a0, NEW_LINE # point to the new-line syscall # do it! # decrease the loop counter ################## sub $t2, $t2, $t1 # $t2 = $t2 - $t1 # did I repeat enough? ####################### bne $t1, $t2, loop_01 # if $t2 not equal $t1, loop_01 # stop this program ########################## jr $31 # ENE OF LINES ######################################