Advertisement
LegoDrifter

MIPS - Primer 2 po moe

Apr 18th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. .data
  2. message: .asciiz "Vnesi broj."
  3. .text
  4. main:
  5.  
  6. li $v0, 4
  7. la $a0, message
  8.  
  9. li $v0, 5 #scanf od tipot integer
  10. syscall
  11. move $t0, $v0 #vrednosta sto ja stadovme vo v0 ja prefrlame vo t0
  12.  
  13. slt $t1, $t0, $zero # sporeduvame t0 < 0
  14. beq $t1, $zero proces_1 # ako t1 e pogolemo od 0 skokame vo proces_1
  15. #ako ne e se izvrsuva ova dolu
  16.  
  17. addi $t2, $zero, -3
  18. mult $t0, $t2
  19. mflo $t3
  20. li $v0, 1
  21. move $a0, $t3
  22. syscall
  23. j end
  24.  
  25. proces_1:
  26.  
  27. addi $t4, $zero, 3
  28. mult $t0, $t4
  29. mflo $t5
  30. li $v0, 1
  31. move $a0, $t5
  32. syscall
  33. j end
  34.  
  35. end:
  36. li $v0, 10
  37. syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement