So i want to swap the vowals with vowals+consonants everytime i found them.
a = ab
e = ec
i = id
o = of
u = ug
For example:
The message is: "Hello", the return message must be: "Hecllof".
This is the code that i have until now:
.data
string: .asciiz "halla"
a: .ascii "a"
a1: .asciiz "b"
tam: .word 5
.text
main:
lw $t6, tam #string length
lb $t1, string($t0) #read bit by bit
lb $s0, a #save in register the char that we want to search
lb $s1, a1 #save in register the char that we want to replace
beq $t0, $t6, done
beq $t1, $s0, continua #if the char of (bit by bit) its like the char of chars, swap it
bne $t1, $s0, store #if not, saves
continua:
sb $s1, string($t0) #do the swap
addi $t0, $t0, 1 #+1 in the index
j main
store:
sb $t1, string($t0) #saves
addi $t0, $t0, 1 #+1 in the index
j main
done:
la $a0, string
li $v0, 4
syscall
li $v0, 10
syscall
My code only replaces one byte (if i want to replace a with ab it doesnt replace, only replaces it with "b")
How can i improve my code?
Thank you.