-
Convert ASM to C Code
Basically I want to convert this into C.
addi $s3, $0, 1
add $t0, $s2, $s3
lw $t1, 0($t0)
add $t2, $s1, $t1
lw $s4, 0($t2)
($s0 = A, $s1 = B, $s2 = C and so on..)
This could be trivial but what I did was
int C = 1;
but for the second line since t0 are temp variables I decided to use an array.
so I do
int A[i] = C + D;
is this correct?
next would be
int B[0] = 0;
am I on the right track?
Thanks! :)
-
Did you try posting here ?
Assembly Forum
-
My ppc assembler knowledge isn't all that good but I think the result is
D = 1;
E = (*(B + *(C+1)) & 0xFFFF0000) & 0xFFFF0000;
Pseudo-code to verify I didn't mess up somewhere:
Code:
D = 1
temp0 = C+D
temp1 = *(temp0) & 0xFFFF0000
temp2 = B + temp1
E = *(temp2) & 0xFFFF0000
although I guess the bit mask could also be 0x0000FFFF depending on endianness, I'm not sure what the ppc uses.