无效的程序计数器的值:0 [英] invalid program counter value: 0
问题描述
我目前的MIPS处理器下的汇编语言工作。我现在在
使用MARS模拟器和原因不明,我得到每次运行后出现如下错误信息:
I'm currently working with assembly language under the MIPS processor. I'm currently using MARS simulator and for reasons unknown I get the following error message after every run:
转到:运行try.s
Go: running try.s
错误:无效的程序计数器值:0
Error in : invalid program counter value: 0
转到:执行有错误终止
我得到独立我使用code的此错误信息,只是想知道如果这是一个错误
在MARS模拟器或者如果它是我丢失的东西。
I get this error message independent of the code I'm using, just wondering if this is a bug in the MARS simulator or if it's something I'm missing.
推荐答案
我是新来的MIPS,我只是有这个问题。
这是我有什么:
I am new to MIPS and I just had this problem. This is what I had:
.data
.text
swap:
# do stuff
jr $ra
main:
# do stuff
jal swap
li $v0,10
syscall
我固定它,改成这样:
I fixed it by changing it to this:
.data
.text
main:
# do stuff
jal swap
li $v0,10
syscall
swap:
# do stuff
jr $ra
请注意,我搬到主要是交换之前。我错误地认为主要是保留的标签。而且它会自动直接跳转到主第一。但显然事实并非如此,因为它是打我的JR $ RA指令我打电话给在主日航互换了。
Notice I moved main to be before swap. I mistakenly assumed that main was a reserved label. And that it would automatically jump straight to main first. But apparently that isn't the case because it was hitting my jr $ra instruction before I got to call jal swap in main.
无论如何,我希望这会有所帮助。
Anyway, I hope this helps.
这篇关于无效的程序计数器的值:0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!