Hello. I'm just scratching the surface of Assembly for the first time and am trying to figure out how to manipulate arrays.

It's my understanding that arrays live in RAM, and RAM ONLY. So you must load the piece of the array you want to mess with into a register, then store it back into RAM when your done messing with it. So here's my question:

What if I want to access say x[5] when all I know is x[0] is stored in memory address 1,000,000. When I'm done, I want to put it into x[6]. Would something like this work? If not, please help me find my miss-understanding. Thanks for any help

lw $t0, 5(1000000)
addi $t0, $t0, 1
sw $t0, 6(1000000)

Something like this will work. Check your assembler docs for the syntactical specifics. What is important, you got the idea right.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.