I need some help with MAL. My professor seems to think we can magically figure out assembler errors even though this is our very first MAL program. I've got the program itself down. It calculates the sum of 1, 3, and 7 using only subtraction.
</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">#
# *** Equivalences ***
#
print_int = 1
#
# *** Data ***
#
.data
x: .word 1
y: .word 3
z: .word 7
###
### *** Instructions ***
###
.text
main: sub $s0, $0, x # subtract x from 0
sub $s0, $s0, y # subtract y from that
sub $s0, $s0, z # subtract z from that
sub $s1, $0, $s0 # subtract answer from 0
li $v0, print_int
lw $a0, $s1
syscall
jr $ra</pre>[/QUOTE]I'm getting the following parse error when I try to load the file into the assembler
</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">spim: (parser) parse error on line 28 of file onlysub.s
sub $s0, $0, x # subtract x from 0
^</pre>[/QUOTE]I have no idea what its complaining about.
</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">#
# *** Equivalences ***
#
print_int = 1
#
# *** Data ***
#
.data
x: .word 1
y: .word 3
z: .word 7
###
### *** Instructions ***
###
.text
main: sub $s0, $0, x # subtract x from 0
sub $s0, $s0, y # subtract y from that
sub $s0, $s0, z # subtract z from that
sub $s1, $0, $s0 # subtract answer from 0
li $v0, print_int
lw $a0, $s1
syscall
jr $ra</pre>[/QUOTE]I'm getting the following parse error when I try to load the file into the assembler
</font><blockquote>code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">spim: (parser) parse error on line 28 of file onlysub.s
sub $s0, $0, x # subtract x from 0
^</pre>[/QUOTE]I have no idea what its complaining about.
Comment