I'm working on an assignment in MIPS. I want to print the stored string without the decimal point i.e the output should be 11011 for 110.11 .
I think my code is doing what it's supposed to, but it's not showing any output. I debugged it and it turns out that the addi statement just keeps removing the first element of the string so there's nothing left in the end.
.data
string: .asciiz "110.11"
.text
.globl main
.ent main
main:
la $t1,string
li $t5,46 #ascii code of .=46
LOOP:
lb $t0,($t1)
beq $t0,$t5,SKIP #skip point if found
beq $t0, $zero, exit
sb $t0,($t1)
addi $t1, $t1, 1 #i++
j LOOP
SKIP:
addi $t1, $t1, 1
j LOOP
exit:
li $v0,4
move $a0,$t1
syscall
li $v0,10
syscall
jr $ra
.end main
Is there any way to move forward through the string without deleting its elements and getting modified string as output? Any help would be appreciated thankyou!