我在这个程序中遇到错误,底部有更多细节。你注意到我做错了什么,请告诉我。
# switch to the Text segment
.text
# the program is defined here
.globl main
main:
li $v0, 4 #introduction
la $a0, HW
syscall
li $v0, 4
la $a0, Name
syscall
li $v0, 4
la $a0, intro
syscall
li $v0, 4
la $a0, question
syscall #end introduction
li $v0, 8 #input 10 characters
li $a1, 10
move $t3, $a0
syscall
li $v0, 4
la $a0, newline
syscall
GetLength:
lb $t0,($t3)
add $t3, $t3, 1
bne $t0, $zero, GetLength
sub $t3, $t3, 1
li $v0, 11
Loop:
sub $t3, $t3, 1 # something around here isnt working
la $t0, ($t3)
lb $a0, ($t0) #getting an error here
syscall
ble $t3, $t0 Loop
li $v0, 10 # ends program
syscall
##########
.data
# global data is defined here
HW:
.asciiz "CMPEN 331 Homework 3\n"
Name:
.asciiz "Cullen Wilcox\n \n\n"
intro: .asciiz "Lets see if your word is a Palidrome!\n"
question: .asciiz "Please enter a word that is ten letters or less: "
newline: "\n\n "
所以我放在哪里(错误在这里)是我的问题,(那就是火星告诉我我有错误。)它正在输出我想要的东西,但它也反向输出每个字符串。像第一行输出是CMPEN 331作业3,最后一行输出最终是3 krowemoh 133 NEPMC .....我不知道为什么会发生这种情况,但我相信它是在我的程序的Loop部分内
该程序接收用户的输入并输出他们反向输入的内容。 (程序永远不会结束。(从未说过这个程序已经完成运行。)MARS需要大约2-3分钟才能解锁,因为我相信它是无限循环的。重新问,没有得到回复