assembly – Creating (and accessing) an array in MIPS

assembly – Creating (and accessing) an array in MIPS

You have to put this line:

list: .word 3, 2, 1, 0, 1, 2

Into the .data section. Check this quick tutorial.

The error is telling you you cant put data (.word 3, 2) in the code segment. Text segment is an old style term meaning code segment http://en.wikipedia.org/wiki/Code_segment

The assembler wants you to declare a data segment and put the array there. Ive never done Mips assembler, but I would expect it to be something like this

.data
list: .word 3, 2, 1, 0, 1, 2

.text
start:
li $t0, 0x00000000  #initialize a loop counter to $t0
li $t4, 0x00000005  #last index of array
li $t3, 0x00000000  #this will hold our final sum
la $t1, list  #the address o

assembly – Creating (and accessing) an array in MIPS

Leave a Reply

Your email address will not be published.