Advertisement
SamuelNichols

123qwe

Feb 17th, 2018
447
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. .data
  2. String:
  3. .asciiz "Hello WOrLD. THiS Is A MEsS!"
  4. .text
  5. .globl main
  6. main:
  7. ## start here ##
  8.  
  9. la $s0, String #loading base adress of String
  10. ori $t0, $0, 0 #counter
  11. ori $t1, $0, 28 #ceiling of counter for String length
  12.  
  13. ori $v0, $0, 11 #setting syscall to print characters
  14.  
  15. ori $t2, $s0, 0 #temp reg for walking through string
  16.  
  17.  
  18. for1:
  19. beq $t0, $t1, exit1 #jumps to exit when counter ($t0) reaches 28
  20.  
  21. lb $t3, 0($t2) #loads current char
  22. addi $t2, $t2, 1 #increments to next char in
  23.  
  24. #Next two lines test if current char is a capital (it isn't if >90 or <65
  25. bgt $t3, 90, notCapital
  26. blt $t3, 65, notCapital
  27.  
  28. addi $t3, $t3, 32 #making capital char lowercase by adding 32
  29.  
  30. notCapital:
  31. ori $a0, $t3, 0 #load char into syscall reg
  32. syscall #syscall to print current char
  33. addi $t0, $t0, 1 #t0++
  34.  
  35. j for1 #jumps back to beginning of loop (for1)
  36. exit1:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement