Skip to content

Instantly share code, notes, and snippets.

@vaskaloidis
Created December 18, 2013 05:47
Show Gist options
  • Select an option

  • Save vaskaloidis/8017814 to your computer and use it in GitHub Desktop.

Select an option

Save vaskaloidis/8017814 to your computer and use it in GitHub Desktop.
.data
input: .space 100
buffer: .byte 100
break: .asciiz "\n"
ask: .asciiz "Please enter Sentence: "
.text
la $a0, ask #Load string requesting input
li $v0, 4 #Load SYS Code
syscall #Print input request
la $a0, input #Store user input into input variable
li $a1, 100 #Set up Max string input
li $v0, 8 #Get User Input in $v0
syscall
li $t0, 0
beginning:
la $t5, input($t0)
lbu $t2, ($t5) #Get the first byte pointed to the address
beq $t0, 0xa, end # EXIT if #t0 strign length
changeCase:
li $t1, 0x5a
ble $t2, $t1, makeUpper
#Else Continue
subi $t2, $t2, 32
sb $t2, input($t0) #Make it lowercase
add $t0, $t0, 1 #Add 1 to $t0
j beginning
makeUpper:
addi $t2, $t2, 32
sb $t2, input($t0) #Make it uppercase
add $t0, $t0, 1 #Add 1 to $t0
j beginning
end:
la $a0, input
li $v0, 4
syscall #Print the letter
li $v0, 10
syscall #Exit the program
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment