Re: A89: 92guide.zip


[Prev][Next][Index][Thread]

Re: A89: 92guide.zip




The way that the 68k represents negative numbers is 2s compliment.  Here's
a 16-bit exmple:

-100 -- decimal
-0000 0000 0110 0100 -- binary
1111 1111 1001 1011 -- invert every bit
1111 1111 1001 1100 -- add 1 to get the 2sc representation of -100

The advantage of 2sc is that addition is performed the same way as with
unsigned numbers.  Since A-B = A+(-B):

 200
-100
-----
  0000 1100 1000
+1111 1001 1100
------------------
 1 0000 0110 0100

Throw away the leading 1 and you get 0110 0100 binary or 100 decimal.

	--Nate


References: