int
is equivalent to word
, char is equivalent to byte
, etc.Example Q: Write the following pseudocode in assembly:
int total, n = 100 = 1 t0 = 1 t1 while (t1 <= n) { += t1 t0 ++ t1} = t0 total
A:
# Wrong add $t3, $t5, $t6 mul $t3, $t3, 4 sub $t3, $t4. $t3 # Correct add $t3, $t5, $t6 sll $t3, $t3, 2 sub $t3, $t4. $t3