bigloop:
li $s0, 0
stripNonAlpha:
lb $t5, ($a0)
beqz $t5, contt
add $t4, $s0, $a0 #address of input[i] in $t4
lb $t5, 0($t4) #load value of input[i]
addi $s0, $s0, 1 #i = i + 1
slti $t1, $t5, 48 #if ascii code is less than 48
bne $t1, $zero, strip #remove ascii character
slti $t1, $t5, 58 #if ascii code is greater than 57
slti $t2, $t5, 65 #if ascii code is less than 65
slt $t3, $t1, $t2
bne $t3, $zero, strip #remove ascii character
slti $t1, $t5, 91 #if ascii code is greater than 90
slti $t2, $t5, 97 #if ascii code is less than 97
slt $t3, $t1, $t2
bne $t3, $zero, strip #remove ascii character
slti $t1, $t5, 123 #if ascii char is greater than 122
beq $t1, $zero, strip #remove ascii character
j stripNonAlpha #go to stripNonAlpha
strip:
add $t5, $s0, $a0 #address of Buffer[i] in $t5
add $t5, $t5, 32
sb $zero, 0($a0) #Buffer[i] = 0
addi $s0, $s0, 1 #i = i + 1
j stripNonAlpha #go to stripNonAlpha
j bigloop
contt:
我有这样一个MIPS代码片段的情况,它会检查任何非字母数字字符,当我在下面打印任何我写入控制台的内容时,它会增加32个ASCII值。例如,它代替空格字符(32)打印@(64),而不是! (33),它打印资本A(65)。我看不出,可能是什么原因?提前谢谢。