Help with Mips assembly language
I am trying to do a simple for loop that computes sum of a certain number of integers and then outputs the sum.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
.text
.globl main
main:
li $9, 0
li $10, 0
li $11, 10
li $12, 0
li $13, 0
loop:
bge $12 $11 exit
li $v0, 4
la $a0, msg
syscall
li $v0, 5
syscall
move $9, $v0
add $10 $10 $9
addi $12 $12 1
li $v0, 4 # output msg2
la $a0, msg2
syscall
li $v0,1 # output sum
move $a0, $10
syscall
.data
msg: .asciiz "\nEnter an integer: "
msg2: .asciiz "\nSum: "
|
There error I keep getting is on the line with the branch
Instruction references undefined symbol at 0x0040003c [0x0040003c] 0x10200000 beq $1, $0, 0 [exit-0x00400038]
thought it might be because I didnt add j loop to the end of the loop but that didnt fix the problem
Topic archived. No new replies allowed.