1
Good morning guys, I’m new to Assembly and I’m in need of a little help if possible. I need to translate the following code to Assembly:
// Sendo i,total e n os registradors $s1, $s2, $s3
i=0;
total=0;
while( i < n ) {
total=total+X[i];
i=i+1;
}
I’ve managed to make the following commands:
add $s1 , zero , zero
add $s2 , zero , zero
Loop: slt $t0, $s1, $s3
beq $t0, $zero, Exit
add $t1, $s1, $s1
...
addi $s1, $s1, 1
j Loop
I can’t determine the part that comes in... Can someone please help me? Thank you very much!