MIPS跳转循环 - 高阶错误

时间:2016-04-19 21:19:03

标签: mips

由于某些原因我似乎无法做到这一点,我也搜索了一堆,但无法找到解决方案。我收到错误:“跳转目标与指令pc 0x400054的高位4位不同”。我试图跳过2次跳跃的增量来达到目标​​,但它仍然不起作用。难道我做错了什么?我想跳到loop:部分..有什么方法可以做到这一点吗?

.text
.globl main
main: 
loop:           la          $a0, celsius        #String celsius
                li          $v0,   4
                syscall

                li          $v0,   5            #Read int celsius 
                syscall
                j           one
backone:        j           loop    
one:            blt         $v0, -50, end       #tests if in bounds, else out
                bgt         $v0,  50, end
                jal         celsius
                nop
                j           backone             #I was getting "Target of jump differs in high-order 4 bits from instruction pc 0x40004c"
end:            li          $v0,  10            #so I just inserted 2 jumps.

.data
celsius: .asciiz "/nEnter in celsius: "

.text
.globl compute
compute:
                move        $a0, $v0 
                mul         $a0, $a0,  9
                div         $a0, $a0,  5 
                addu        $a0, $a0, 32
                move        $t0, $a0

                la          $a0, degrees        #print degrees:
                li          $v0, 4
                syscall

                move        $a0, $t0            #Print int
                li          $v0, 1
                syscall

                jr          $ra                 #returns
                nop

.data
degrees: .asciiz "\nDegrees Fahrenheit: "

0 个答案:

没有答案