user11473537
user11473537

Reputation:

How do you make an array in MIPS assembly language

I am trying to make create an array in assembly language that uses an array of 10 elements to store 0-10, with each array location will hold a single integer. Its' base address should be 0x47212000. How would I do this? From what I've learned, I should put the following code:

lui s0, 0x47212000        #This declares the array with the base address

After this, however, I'm stuck. Do I need to make a loop to store the integers? How do I declare how many elements are in the array? Any help would be appreciated.

Upvotes: 1

Views: 1564

Answers (1)

Eraklon
Eraklon

Reputation: 4288

You actually have to use assembler directives if your assembler has this.

.data 0x47212000
array: .word 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

If you want to wirte their values "manually" by a code then initialize them to 0.

Upvotes: 1

Related Questions