I'm having a strange problem with an assembly file. Every time I load this file into PCSpim, it gives me a syntax error on line 23. I've looked at several references and asked several classmates for help, and nobody seems to understand what's wrong.
.globl main
.data
test1: .word 92
test2: .word 81
finalExam: .word 90
a: .ascii "Enter value A:\n"
b: .ascii "Enter value B:\n"
grade: .word 0
result: .word 0
#More data...
.text
#Program calculates a final grade based off of two midterms and a final. Midterms are
#weighted 30% and the final is weighted 40%. Grade is out of 1000.
final:
li $t4, 3 #PCSpim complains here.
li $t5, 4
la $t0, test1
lw $t1, ($t0)
mult $t1, $t4
mflo $t1
la $t0, test2
lw $t2, ($t0)
mult $t2, $t4
mflo $t2
la $t0, finalExam
lw $t3, ($t0)
mult $t3, $t5
mflo $t3
add $t4, $t1, $t2
add $t4, $t4, $t3
la $t0, grade
sw $t4, ($t0)
#Print result to console
li $v0, 1
move $a0, $t4
syscall
jr $ra
#Program continues...
Okay, figured it out, there were two problems in this situation. First, Bare Machine should have been disabled, and another problem came up when I used "b" as a label, because b is also used as an opcode.
Thanks for checking this out!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With