Assembly MIPS:地址超出范围错误
我正在尝试转换此C代码:Assembly MIPS:地址超出范围错误,assembly,mips,Assembly,Mips,我正在尝试转换此C代码: 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
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
任何帮助都将不胜感激
lbu $t1, '+'
“+”不是有效的地址。你可能是说
li $t1, '+'
无论如何,请记住,任何像样的C编译器都会为您将C转换为MIPS
“+”不是有效的地址。你可能是说
li $t1, '+'
无论如何,请记住,任何像样的C编译器都会为您将C转换为MIPS。谢谢,我知道它必须是这样的小东西。这是我正在做的一个项目,所以使用mips_gcc编译器将无法达到预期目的。谢谢,我知道它必须是这样的小东西。这是一个我正在进行的项目,因此使用mips_gcc编译器将无法达到目的