Advertisement
Guest User

Untitled

a guest
May 28th, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. .data
  2. ile: .asciiz "Ile liczb? "
  3. jest: .asciiz " Liczba jest potega 2 \n"
  4. niejest: .asciiz " Liczba nie jest potega 2 \n"
  5. podaj: .asciiz "Podaj kolejna liczbe : "
  6. enter: .asciiz " \n"
  7. koniec: .asciiz "czy koniec programu? "
  8. wszystkich: .asciiz "wszystkich liczb bedacych potega bylo: "
  9.  
  10. .text
  11. zapytajIle:
  12. li $v0, 4
  13. la $a0, ile
  14. syscall
  15.  
  16. li $v0, 5
  17. syscall
  18. move $s0, $v0
  19.  
  20. li $v0, 4
  21. la $a0, enter
  22. syscall
  23.  
  24. podawanieLiczb:
  25. la $t7, 0
  26. la $t6, 2
  27.  
  28. loopPodawanie1:
  29.  
  30. beq $t7, $s0, czyKoniec
  31. add $t7, $t7, 1
  32.  
  33. li $v0, 4
  34. la $a0, podaj
  35. syscall
  36.  
  37. li $v0, 5
  38. syscall
  39. move $s1, $v0
  40.  
  41. li $v0, 4
  42. la $a0, enter
  43. syscall
  44.  
  45. rem $t1, $s1, 2
  46. bgt $t1, 0, niePotega
  47. beq $t1, 0, sprawdzDalej
  48.  
  49. niePotega:
  50. li $v0, 4
  51. la $a0, niejest
  52. syscall
  53.  
  54. li $v0, 4
  55. la $a0, enter
  56. syscall
  57.  
  58. j loopPodawanie1
  59.  
  60. jestPotega:
  61. li $v0, 4
  62. la $a0, jest
  63. syscall
  64.  
  65. li $v0, 4
  66. la $a0, enter
  67. syscall
  68.  
  69. add $t4, $t4, 1
  70. j loopPodawanie1
  71.  
  72.  
  73. sprawdzDalej:
  74. bgt $t6, $s1, niePotega
  75. beq $t6, $s1, jestPotega
  76. mul $t6, $t6, 2
  77. j sprawdzDalej
  78.  
  79. czyKoniec:
  80. li $v0, 4
  81. la $a0, koniec
  82. syscall
  83.  
  84. li $v0, 5
  85. syscall
  86. move $s3, $v0
  87.  
  88. li $v0, 4
  89. la $a0, enter
  90. syscall
  91.  
  92. beq $s3, 1, exit
  93. blt $s3, 1, zapytajIle
  94. bgt $s3, 1, zapytajIle
  95.  
  96.  
  97. exit:
  98. li $v0, 4
  99. la $a0, wszystkich
  100. syscall
  101.  
  102. li $v0, 1
  103. move $a0, $t4
  104. syscall
  105.  
  106. li $v0, 4
  107. la $a0, enter
  108. syscall
  109.  
  110. li $v0, 10
  111. syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement