Guest User

Untitled

a guest
Jul 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. .data
  2. Input: .space 60
  3. Prompt: .asciiz "Please enter a string up to 60 characters: "
  4. endl: .asciiz "\n"
  5.  
  6. .text
  7.  
  8. .globl main
  9.  
  10. main:
  11.  
  12. li $v0, 4
  13. la $a0, Prompt
  14. syscall
  15.  
  16. ##### Take Input
  17. li $v0, 8
  18. la $a0, Input
  19. syscall
  20.  
  21.  
  22. #### Let's load some values
  23. la $s0, Input
  24. add $s1, $s0, 59
  25. li $t0, 0
  26.  
  27. #### And Now for the loop
  28. print_string:
  29. li $v0, 11
  30. lb $a0, ($s1)
  31. syscall
  32.  
  33. sub $s1, $s1, 1
  34. #### Conditions
  35. add $t0, $t0, 1
  36. blt $t0, 59, print_string
  37.  
  38. li $v0, 10
  39. syscall
Add Comment
Please, Sign In to add comment