Advertisement
quantumech

Untitled

Oct 7th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. .text
  2. .globl main
  3. main:
  4. li $t1, 0
  5. li $t2, 0
  6. li $t3, 0
  7. loop:
  8. add $t4, $t0, $t3 # c = &str[i]
  9. lbu $t4, 0($t4) # c = str[i]
  10. li $t6, 90 # $t6 = 90
  11. bgt $t5, $t6, is_lowercase # if(c <= 90)
  12. addi $t1, $t1, 1 # upperCount++
  13. b end_if
  14. is_lowercase:
  15. addi $t2, $t2, 1 # else upperCount++
  16. end_if:
  17. li $t6, 10
  18. addi $t3, $t3, 1 # i = i + 1
  19. blt $t4, $t6, loop # while(i < 10)
  20. done:
  21. li $v0, 1
  22. move $a0, $t1
  23. syscall
  24. move $a0, $t2
  25. syscall
  26. li $v0, 10
  27. syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement