# Loops, Strings, Traversing Arrays
# This program bumps up each letter of a string by one.
# There is no wrap-around after z.
.text
.globl __start
__start:
la $a0, prompt
li $v0, 4
syscall
li $v0, 8 # read string
li $a1, 20 # max length
la $a0, str # address of string
syscall
move $t0 , $a0
loop:
lb $t1, ($t0)
addiu $t1, $t1, 1 # $t1 stores each character
sb $t1, ($t0)
addiu $t0, $t0, 1
lb $t2, ($t0)
bnez $t2, loop # Assumes string is not empty. Note this will crash on empty string
li $v0, 4 # address is already in $a0
syscall
li $v0, 10
syscall
.data
str: .space 20
prompt: .asciiz "Enter String:"