Tallissan
Tallissan

Reputation: 46

MIPS how to allocate array space with a few predefined numbers within?

Is it possible to pre-load numbers into a memory array, without pre-loading all of them?

For example, say I want an array with 5 numbers, but I only know the first number, and not the last 4.

Array: .space 20

The above line would just allocate space for 5 numbers (each 4 bytes long). I want something more along the lines of:

Array: .word 7, 0, 0, 0, 0

I'd like to do a combination of these, where I can pre-define the space for an array, pre-define the first number in the array, but NOT pre-define the last four 0s in the array.

Upvotes: 0

Views: 904

Answers (1)

Michael
Michael

Reputation: 58447

The above line would just allocate space for 5 numbers (each 4 bytes long). I want something more along the lines of: Array: .word 7, 0, 0, 0, 0

You can achieve that with:

Array: .word 7
       .space 16

Upvotes: 2

Related Questions