I'm making some exercises on assembly MIPS(32 bit) and I don't really understand how the left shift by 2 works.
I'll add a couple of examples just to explain it better.
- Instruction is 0x91050014
I have to take the last 16 bits and then extend them to 32 bits.
So I take 0014 and since the MSB is a zero it means that it's a positive number so I extend it to 32 bits like follows: 0x00000014
After that I have to apply a shift to the left by 2, so ( I use [] for deleting and {} for adding):
[00]00 0000 0000 0000 0000 0000 0001 0100{00}
Which I can conclude is 0x00000050
I've got problems once the last 16 bytes aren't positive, like in this example:
- Instruction is 0x10A6FFEC
I take FFEC and since the MSB is an F it means that it's a negative number so I extend it to 32 bits like follows: 0xFFFFFFEC
Now I find myself with this: 1111 1111 1111 1111 1111 1111 1110 1100
And I don't understand how to apply the shift.
Thanks in advance.