从字符串和打印MIPS中删除空格

从字符串和打印MIPS中删除空格,mips,cpu-registers,Mips,Cpu Registers,所以我想弄清楚,如何在Mips中删除字符串中的空格,然后再次打印出来。我的问题是打印。我获取的错误消息地址超出范围00000 我觉得我对mips的理解是有限的,所以我完全不知道接下来要采取什么步骤- Message: .asciiz "Ridwaan Toure" .text main: li $a1, 20 # I tried this to see if it would make any difference la $t0, Message # load the m

所以我想弄清楚,如何在Mips中删除字符串中的空格,然后再次打印出来。我的问题是打印。我获取的错误消息地址超出范围00000

我觉得我对mips的理解是有限的,所以我完全不知道接下来要采取什么步骤-

Message: .asciiz "Ridwaan Toure"

.text

main:

li $a1, 20        # I tried this to see if it would make any difference
la $t0, Message   # load the message into t0 register
li $t1, 0         # set the Counter to 0
la $t3, 32        # this is the ASCII for space 


 remove:
    lb $t2,0($t0)         # Load the byte that $t0 points to (first character)
    beqz  $t2, end       # if we reach the end of the String we're done $a3==0
    bne $t2,$t3, continue      # Since it's not a space we continue
    j skip

continue:

    add $t0, $t0, 1         # we ++ the pointer to point to next char
    add $t1, $t1, 1          #we increase our counter 
    j remove #loopAgain

skip:
   add $t0, $t0, 1   # we ++ the pointer to point to next char
   j remove          #loopAgain we didn't increase the counter

end:
li $v0, 4            # thought this would help print String but no dice
move $a0, $t2        # t2 should be loaded with the String
syscall

#End
li $v0, 10
syscall


如果我使用
la$a0
,则消息只加载原始消息,因此地址也不会发生任何变化。

此代码中的任何字符都不会移动。首先尝试用更高级的语言实现它,一旦完成了这项工作,就可以开始将其转换为MIPS汇编。
#t2应加载字符串