0
我試圖把這種C代碼:MIPS:解決超出範圍錯誤
if (op == '+') {
acc += val;
}
到MIPS,我想不出是什麼原因造成的地址超出範圍的錯誤
#reads user input for the op
li $v0, 12 # system call number for operator
syscall # reads the integer
sw $v0, op # stores the user input in op
lw $t0, op # stores op in $t0
lbu $t1, '+' # stores '+' in $t1
# "if" statement
bne $t0, $t1, Else # branches if op is not equal to +
lw $t2, acc # stores acc in $t2
lw $t3, val # stores val in $t3
add $t2, $t2, $t3 # adds $t2 and $t3 and stores the sum in $t2
任何幫助,將不勝感激。
謝謝,我知道它必須是那樣的小東西。這是針對我正在開發的一個項目,所以使用mips_gcc編譯器會失敗目的 – 2012-02-02 16:56:48