Hi guys, can you help me with a MIPS Asm exercise.
It's the first time that i coding in this language...
I solved the exercise in Java, you can get some help to convert it to MIPS?
thanks a lot to everyone
Java code:
public class Exrcise1 {
public static void main(String[]args){
mips("text1","text2");
}
public static void mips(String a,String b){
assert a.length() <=100;
assert b.length() <=100;
int []x;
x = new int[256];
int []y;
y = new int[256];
int z;
//increment array counter
for(int i = 0; i<a.length();i++){
z = a.charAt(i);
x[z] += 1;
}
for(int i = 0; i<b.length();i++){
z = b.charAt(i);
y[z] += 1;
}
//verify the number of different letters
int differenza = 0;
for(int i = 0;i<255;i++){
if(x[i]!=y[i])
differenza += abs(x[i]-y[i]);
}
if (differenza ==0){
System.out.println("ANAGRAMMA");
}
if (differenza == 1 || differenza == 2){
System.out.println("SIMILI");
}
if (differenza > 2){
System.out.println("DIVERSI");
}
}
public static int abs(int x){
if(x<0)
x = -x;
return x;
}
}