# CSE 410 Sp09 Homework 2, part II # Calculate and print the first 15 Fibonacci numbers # name: # Data declarations .data str1: .asciiz "Here are the first 15 Fibonacci numbers:\n" newline: .asciiz "\n" .globl main .text main: la $a0, str1 li $v0, 4 syscall li $s0, 0 #s0 = F_(n-2) li $s1, 1 #s1 = F_(n-1) li $s3, 2 #s3 = n #print the first two numbers of the sequence manually move $a0, $s0 li $v0, 1 syscall la $a0, newline li $v0, 4 syscall move $a0, $s1 li $v0, 1 syscall la $a0, newline li $v0, 4 syscall loop: li $t0, 15 beq $t0, $s3, end add $t1, $s0, $s1 move $s0, $s1 move $s1, $t1 move $a0, $s1 li $v0, 1 syscall la $a0, newline li $v0, 4 syscall addi $s3, $s3, 1 b loop end: li $v0, 10 syscall