I am brand new to learning MIPS assembly code, and we got our first coding assignment. I am getting an error when I run my program (which is supposed to be a tester for another function we have to write) saying
"spim: (parser) Label is defined for the second time on line 13 of file /home/jlr247/215_A2_work/jlr247-a2-A.s main: ^"
The code I have is:
.data
.align 4
_arrA: .space 400
_arrB: .space 400
.text
main:
la $t0, _arrA #load base address of array A
la $t1, _arrB #load base address of array B
addi $t2, $zero, 0 #$t2 = i = 0
FILL_LOOP: #initializes all A[] values to 5, all B[] values to 10
slti $t3, $t2, 100 #check i<100
beq $t3, $zero, LOOP_DONE #end loop when i=100
sll $t3, $t3, 2 #multiply shift by 4
add $t4, $t3, $t0 #$t4 = address of A[i]
add $t5, $t3, $t1 #$t5 = address of B[i]
addi $t6, $zero, 5
sw $t6, 0($t4) #A[i] = 5
addi $t6, $zero, 10
sw $t6, 0($t5) #B[i] = 10
j FILL_LOOP
LOOP_DONE:
li $v0, 1 #get ready to print test values for A[0], A[396]
lw $a1, 0($t1)
lw $a2, 396($t1)
syscall #should print 55
li $v0, 1 #get ready to print test values for B[0], B[396]
lw $a1, 0($t2)
lw $a2, 396($t2)
syscall #should print 1010
EXIT:
Any ideas? I'm sure it's something basic and obvious that I just haven't managed to learn yet. Thank you!
"spim: (parser) Label is defined for the second time on line 13 of file /home/jlr247/215_A2_work/jlr247-a2-A.s main: ^"
This can happen if you use the "Load File" command twice without reinitializing the simulator in between.
To avoid this, either use "Simulator" -> "Reinitialize Simulator" followed by "File" -> "Load File", or "File" -> "Reinitialize and Load File".