#----------------------------------------------------------------------------# # example7.a # # Joe Schmoe # Purpose: looping, version 2 # Input: none # Output: some counting integers #----------------------------------------------------------------------------# .data outstr: .asciiz "Values are: " hello: .asciiz "hello?\n" endl: .asciiz "\n" #----------------------------------------------------------------------------# .text .globl main main: li $t0, 1 # val li $t1, 5 # num li $t2, 1 # const 1 li $v0, 4 la $a0, hello syscall loop: slt $t3, $t0, $t1 # compare t0 < t1; put 1 (true) or 0 into t3 beq $t3, $zero, done # $zero is register containing 0 add $t0, $t0, $t2 li $v0, 1 move $a0, $t0 syscall li $v0, 4 la $a0, endl syscall j loop # loop back up done: li $v0, 10 syscall #----------------------------------------------------------------------------#