I cant figure out how to translate this code into MIPS. Any help or tips would be helpful.

int findMax (int numbers [ ], int count)
{
int currentMax = -1;

if (count > 0)
{
currentMax= 0;
int i = 1;
while (i < count)
{
if (numbers > numbers [currentMax])
currentMax = i;
i = i + 1;
}
}
return currentMax;
}

use $s1 for "currentMax" and $s2 for "i"

Use a register to increment.
Use a register as memory reference that you increment.
Use a register for value loaded from memory.
Use a register for current max index.

You need to try to do this yourself. Post your code then we'll make comments!

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.