Advertisement
LegoDrifter

MIPS dali mozam da pijam gin tonic

Apr 18th, 2020
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. .data
  2. prompt: .asciiz "Enter your age: "
  3. message: .asciiz "\nYour age is "
  4. msg1: .asciiz "\nNemojs da pies gin tonic."
  5. msg2: .asciiz "\nMojs da pies gin tonic"
  6. .text
  7. #Prompt the user to enter age.
  8. li $v0, 4
  9. la $a0, prompt
  10. syscall
  11.  
  12. # Get the user's age
  13. li $v0, 5 # scanf za integer
  14. syscall
  15. # Store the result in $t0
  16.  
  17. move $t0, $v0
  18. bge $t0, 18 label1 # ako t0 e => skokni vo label 1
  19. # ako ne e tocen uslovot izvrsi go ova nadolui
  20. # Display message
  21. li $v0, 4
  22. la $a0, message
  23. syscall
  24. # Print the age
  25. li $v0, 1
  26. move $a0,$t0
  27. syscall
  28.  
  29. li $v0, 4
  30. la $a0, msg1
  31. syscall
  32. j end
  33.  
  34. label1:
  35. # Display message
  36. li $v0, 4
  37. la $a0, message
  38. syscall
  39. # Print the age
  40. li $v0, 1
  41. move $a0,$t0
  42. syscall
  43.  
  44.  
  45. li $v0, 4
  46. la $a0, msg2
  47. syscall
  48. j end
  49.  
  50. end:
  51. li $v0, 10
  52. syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement