I'm trying to compute (a * c) - (b / d), and so far my assembly code is:
.data
A: .word 5
B: .word 6
C: .word 3
D: .word 2
.text
lw $t0, A
lw $t1, C
mul $t0, $t0, $t1
lw $t1, B
lw $t2, D
div $t1, $t1, $t2
sub $t0, $t0, $t1
li $v0, 1
move $a0, $t0
syscall
li $v0, 10
syscall
But when I run it, I get the error. I am new to QTSpim and assembly so I would appreciate some help if possible. Thank you!
edit:
the exact error is:
"Instruction references undefined symbol at 0x00400014 [0x00400014] 0x0c000000 jal 0x0000000 [main] ;188: jal main"
The default startup code expects your program to have a global label main
as its entry point. So you need to add one, e.g.:
# (as before)
.text
.globl main
main:
# (as before)
来源:https://stackoverflow.com/questions/47099284/getting-the-error-instruction-references-undefined-symbol-main-in-qtspim