In my digital systems class we are learning about Assembly for the MSP430. The j
ID: 3534798 • Letter: I
Question
In my digital systems class we are learning about Assembly for the MSP430. The jump instruction adds an offset to the PC to find the new instruction location. jmp offset, or jmp label, where W= 2*offset and W = Label - PC.
Given PC = 0x1002 and jmp label, (label is 0xFFFC). W = 0xFFFC - 0x1002 = -6.
I dont understand how to get -6 from that. I know how to subtract by adding A to (not)B, but im not sure if they are both negative because they are 2s complement or not. If someone could show the binary math of how to get to negative 6 I would appreciate it.
Another example is PC= 0x187E, label = 0x1800, making offset = 0x3C1
Picture of notes for refrence.
Explanation / Answer
Please rate with 5 stars :)
FFFC in binary is 1111111111111100
1002 in binary is 0001000000000010
2's complement of FFFC is 0000000000000100
2's complement of 1002 is 11101111111111100
Subtract them to get the value -6 in 2's complement.
Cheers!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.