I changed my code up.. The sort was killing me and i couldn't figure it out. So now at least my code takes a string of letters and returns them capitalized. Now have to figure out a new sorting technique.
I changed my code up.. The sort was killing me and i couldn't figure it out. So now at least my code takes a string of letters and returns them capitalized. Now have to figure out a new sorting technique.
heres the new code
#
#
#
#
################################################## #######################
#----------------data---------------------------------------------------#
.data
string_ask: .asciiz "\nPlease enter your letters: "
string_return: .asciiz "\nResult: "
in_name: .space 31 ## space for input string
################################################## ##########################
#---------------------print-input-question---------------------------------#
.text
.globl main
main:
la $a0,string_ask ## print prompt string
li $v0,4
syscall
################################################## ###########################
#-------------------------reads-string-input--------------------------------#
la $a0,in_name ## read the input string
li $a1,31 ## at most 30 chars + 1 null char
li $v0,8
syscall
################################################## #############################
#----------------------------------------------------------------------------#
la $a0,string_return ## write output message
li $v0,4
syscall
la $t0,in_name
################################################## ################################
#-------------------------lower-to-upper-case------------------------------------#
loop1:
lb $t1,0($t0)
beqz $t1,exit_loop1 ## if NULL, we are done
blt $t1,'a',no_change ## $t1 < a
bgt $t1,'z',no_change ## $t1 > z
addiu $t1,$t1,-32 ## convert to uppercase: 'A'-'a'=-32
sb $t1,0($t0)
no_change:
addiu $t0,$t0,1 ## increment pointer
j loop1
################################################## ###################################
#-----------------------------------------------------------------------------------#
exit_loop1:
la $a0,in_name ## output converted string
li $v0,4
syscall
li $v0,10 ## exit
syscall
################################################## ######################################
#--------------------------------------------------------------------------------------#
i want to put a sort function in this code, where should it be placed?