我遇到一些mips程序的问题,它采用一串字母并将小写字母a转换为大写字母a。我写了大部分内容,但我似乎无法弄清楚如何让我的输出打印新字符串。
.data
str: .asciiz "abaaabaaabbbbccccdddaaddbaabbbabab \n\n"
prompt: .asciiz "Given String is = "
ans: .asciiz "Replaced String is = "
.text
.globl main
main:
la $a0, prompt
li $v0, 4
syscall
la $a0, str
li $v0, 4
syscall
la $a0, ans
li $v0, 4
syscall
la $t1, str
li $t5, 97
Loop:
lb $t0, 0($t1)
beqz $t0, StrEnd
bne $t0, $t5, nextletter
addi $t0, $t0, -32
sb $t0, 0($t1)
nextletter:
addi $t0, $t0, 1
j Loop
StrEnd:
move $a0, $t1
li $v0, 1
syscall
li $v0, 10
syscall