I was trying to write a MIPS program that runs similar to the C code below
int main{
unsigned int x = 1;
unsigned int y = 11;
while (x < 6) {
int temp = myArray[x];
myArray[x] = myArray[y];
myArray[y] = temp;
x+=2;
y-=2;
}
And I have my array defined as below (I can only use .word in this case)
myArray:
.word 29 17 27 20 25 22 23 24 21 26 19 28
I've done the initialization and the ending part but don't know how to do within the loop
li $v0 1
li $v1 11
li $v2 6
loop:
bge $v0 $v2 loopexit
addi $v0 $v0 1
sub $v1 $v1 1
I'm wondering how can I perform the myArray[x] using MIPS? I'm thinking of bit masking but I'm not sure how to do it with a changing number