tags:

views:

66

answers:

1

How do you allocate an array so it starts at certain place in memory? For example

    .data
array: 
    .space 400

would make an array with 100 words, but I wish to let array start at, for example, 5000 in the memory. How can I do this? ( I remember in intel asm it being really easy)

edit: I am using spim in linux. btw does this really matter?

A: 

What assembler you are using matters because the syntax you are asking for is not part of the MIPS instruction set, it is assembler directives, and thus assembler specific.

From the SPIM documentation:

.data <addr>: Subsequent items are stored in the data segment. If the optional argument addr is present, subsequent items are stored starting at address addr.

.space n Allocate n bytes of space in the current segment (which must be the data segment in SPIM).

Thus,

    .data 5000
array: 
    .space 400

should do what you want.

moonshadow
oh okay. thanks~