Hi,
Just looking for a bit of help with MIPS. I've written the following program but can't get it to run on PCSpim. Think I've done something wrong with the nextCh command as it keeps iterating again & again but can't figure it out. It's to convert uppercase to lowercase characters .If anyone has any suggestions, please let me know.
Thanks,
Niall

.text
.globl __start
__start: ##execution starts here
#--------------------Start Cut---------------------

la $t1, str

nextCh: lb $t2, ($t1)
beqz $t1, strEnd
add $t2, $t2, 32
sb $t1, ($t2)
add $t1, $t1, 1
j nextCh

strEnd: la $a0, ans
li $v0, 4
syscall

move $a0, $t1
li $v0,4
syscall

la $a0, endl
li $v0, 4
syscall

li $v0, 10
syscall

#--------------------End Cut-----------------------
###################################################
# data segment #
###################################################
.data
str: .asciiz "ABCdEfgH"
ans: .asciiz "lowercase string ="
endl: .asciiz "\n"

Compare it with yours and you will see the differences:

###################################################
# author: Andor Pásztor
###################################################
.text
.globl __start
main: ##execution starts here
#--------------------Start Cut---------------------

la $t1, str

nextCh: lb $t2, ($t1)
beqz $t2, strEnd
addi $t4, $zero, 0x61
sub $t3, $t2, $t4
bgez $t3, l1
add $t2, $t2, 32
sb $t2, ($t1)
l1: add $t1, $t1, 1
j nextCh

strEnd: la $a0, ans
li $v0, 4
syscall

la $a0, str
li $v0,4
syscall

la $a0, endl
li $v0, 4
syscall

li $v0, 10
syscall

#--------------------End Cut-----------------------
###################################################
# data segment #
###################################################
.data
str: .asciiz "ABCdEfgH"
ans: .asciiz "lowercase string ="
endl: .asciiz "\n"
This article has been dead for over six months. Start a new discussion instead.