UMBC | CMSC 313 -- Assembly Language Segment | Previous | Next |
To do that, we reserved the left-most bit to represent the sign of the number. Zero is a positive number and one is a negative number. That's the simple part. How to do the math operations was solved when they noticed that you can use the complement of the number. You simply change the sense of each bit. However, there is still a small problem with that (which is known as the 1's complement of the number.) It all works if we use the 2's complement of the number. To get the two's complement, simply add 1 to the 1's complement.
Example:
1011 decimal value is 11 0100 1's complement 0101 1's complement with 1 added = 2's complement = -11
1011 +0101 ------ 1 0000 (We throw away the overflow.)