gambo666@hotmail.com
Feb 22nd, 2006, 06:40 PM
Hi i need to order by ascii value
s1STR: .asciiz "blar blar\n"
s2STR: .asciiz "blar blar blar\n"
s3STR: .asciiz "blar blar blar blar blar blar\n"
stringsARRAY: .word s1STR, s2STR, s3STR, 0
.text
.globl main
main
Code ommited
do_sort_strings:
li $a0, 10 #parameter n
sll $a0, $a0, 2
outer:
sub $t0, $a0,8
li $t1, 0
inner:
lw $t2, stringsARRAY+4($t0)
lw $t3, stringsARRAY($t0)
bgt $t2, $t3, no_swap
sw $t2, stringsARRAY($t0)
sw $t3, stringsARRAY+4($t0)
li $t1, 1
no_swap:
sub $t0, $t0, 4
bgez $t0, inner
bnez $t1, outer
Print ommited
This i what i have so far
i does not add ascii values for strings
and may not order correctly
im new to assembly and need help and pointer
thanks
s1STR: .asciiz "blar blar\n"
s2STR: .asciiz "blar blar blar\n"
s3STR: .asciiz "blar blar blar blar blar blar\n"
stringsARRAY: .word s1STR, s2STR, s3STR, 0
.text
.globl main
main
Code ommited
do_sort_strings:
li $a0, 10 #parameter n
sll $a0, $a0, 2
outer:
sub $t0, $a0,8
li $t1, 0
inner:
lw $t2, stringsARRAY+4($t0)
lw $t3, stringsARRAY($t0)
bgt $t2, $t3, no_swap
sw $t2, stringsARRAY($t0)
sw $t3, stringsARRAY+4($t0)
li $t1, 1
no_swap:
sub $t0, $t0, 4
bgez $t0, inner
bnez $t1, outer
Print ommited
This i what i have so far
i does not add ascii values for strings
and may not order correctly
im new to assembly and need help and pointer
thanks