Guest User

Untitled

a guest
Jul 17th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. .data
  2. fn_2: .word 0
  3. fn_1: .word 1
  4. fn: .word 0
  5. n: .word 0
  6. spaceInsert: .asciiz " "
  7. prompt: .asciiz "Please enter a positive integer: "
  8.  
  9.  
  10. .text
  11. .globl main
  12. main:
  13. li $v0, 4
  14. la $a0, prompt
  15. syscall
  16.  
  17. li $v0, 5
  18. la $a0, n
  19. syscall
  20.  
  21. lw $t0, n
  22. lw $s0, fn_2
  23. lw $s1, fn_1
  24. lw $s2, fn
  25. li $t1, 1
  26.  
  27. loop: add $s2, $s1, $s0
  28.  
  29. li $v0, 4
  30. la $a0, spaceInsert
  31. syscall
  32.  
  33. li $v0, 1
  34. move $a0, $s2
  35. syscall
  36.  
  37. move $s0, $s1
  38. move $s1, $s2
  39.  
  40. add $t0, $t0, 1
  41. blt $t1, $t0, loop
  42.  
  43. Exit:
  44. li $v0, 10
  45. syscall
Add Comment
Please, Sign In to add comment