How do I use a MIPS array to store data at specific places? -


i looking set array , store integers in specific elements of array. example, want store number 7 @ 21th element of array , number 9 @ 27th element. have been trying this:

       .data array: .space 100 

and when set elements:

la $t0, array addi $v1, $0, 7 sw $v1, 84($t0) 

i used 4-multiple offset because word being stored not sure if errors (exception 4 , 5) because trying store word in byte array.

your code fine. guess problem array not aligned. memory can thought byte array, mips not allow loading/saving 32-bit word @ unaligned address (where unaligned means address not multiple of 4).

use directive .align 2 before array label.


Comments