Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- String:
- .asciiz "Hello WOrLD. THiS Is A MEsS!"
- .text
- .globl main
- main:
- ## start here ##
- la $s0, String #loading base adress of String
- ori $t0, $0, 0 #counter
- ori $t1, $0, 28 #ceiling of counter for String length
- ori $v0, $0, 11 #setting syscall to print characters
- ori $t2, $s0, 0 #temp reg for walking through string
- for1:
- beq $t0, $t1, exit1 #jumps to exit when counter ($t0) reaches 28
- lb $t3, 0($t2) #loads current char
- addi $t2, $t2, 1 #increments to next char in
- #Next two lines test if current char is a capital (it isn't if >90 or <65
- bgt $t3, 90, notCapital
- blt $t3, 65, notCapital
- addi $t3, $t3, 32 #making capital char lowercase by adding 32
- notCapital:
- ori $a0, $t3, 0 #load char into syscall reg
- syscall #syscall to print current char
- addi $t0, $t0, 1 #t0++
- j for1 #jumps back to beginning of loop (for1)
- exit1:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement