1

I am learning about assembly and am doing assembly computations, particularly with MIPS instructions to calculate the changed registers and memory addresses.

The initial address states are here :

$t0 = 0x0000000B, $t1 = 0xFFFFFFFF, $t2 = 0xABABABAC

This is the code we have to use to calculate: addi $t4, $t0, -3. sub $t4, $t4, $t1

I calculated the first one here:
add intermediate $t0 +(-3) into $t4 $t4 = 0x0000000B - 0x00000003 (B = 11 in hexadecimal) (11-3) 0x00000008 is stored in register $t4. (8)

For this one, I calculated it and got subtract $t4 - $t1 into $t4 $t4 = 0x00000008 - 0xFFFFFFFF = -0x00000007

but I'm not sure if that is correct because it is a negative memory address so would it just be positive? Switching it ( 0xFFFFFFFF - 0x00000008 gives 0x00000007 but that is not the right order of operations in the code unless i'm wrong)

Can anyone justify which one is correct?

Thank you.

Janeson00
  • 113
  • 9
  • It seems that these are not memory addresses, but just numbers, so a negative result may not be incorrect. (However, in this case, it is.) – prl Feb 24 '19 at 20:11
  • If you think of 0xFFFFFFFF as -1, you will find it easier to tell when you have the right answer. 8 - -1. I’m not sure how you got -7. – prl Feb 24 '19 at 20:13
  • 0xFFFFFFFF - 8 = 0xFFFFFFF7 = -9. (But as you said, that is the wrong order.) – prl Feb 24 '19 at 20:15

0 Answers0