I think the original post was looking for a method of limiting the output of the subtraction to the limits of 16 bit signed numbers (-32768 to +32767). If the result was outside this range, it was "clamped" to the limits. I'm thinking you can check the OV bit to determine if there was a two's complement overflow. Since you can only get an overflow by adding two numbers of the same sign, the result of a sum would be clamped to the appropriate limit of the sign either argument to the sum. Since this is a subtraction (a-b), you can only get an overflow if a has the opposite sign of b. And, the sign of the result will be the same as the sign of a. So, here, check for overflow. If you got it and a is positive, set the result to 32767. If a was negative, set the result to -32768. As long as we're discussing two's complement numbers, here are some comments. As mentioned previously, the method to negate a two's complement number is to get the one's complement (invert the bits) and add one to the result. On the PDP-8, the instruction was CIA for Complement and Increment Accumulator. People fairly often use this approach to get the decimal equivalent of a negative number (multiply the binary by -1, convert the binary to decimal, multiply the decimal by -1 to get the original value). Another approach is to use the standard bit weighting (1, 2, 4, 8, 16, etc.), but, if the number is two's complement, negate the weight of the most significant bit. For example, here's an 8 bit negative number: 1 0 1 0 0 1 0 1 Starting with the msb, this is: -128 * 1 =3D -128 64 * 0 =3D 0 32 * 1 =3D 32 16 * 0 =3D 0 8 * 0 =3D 0 4 * 1 =3D 4 2 * 0 =3D 0 1 * 1 =3D 1 TOTAL =3D -91 Using the CIA method: 1 0 1 0 0 1 0 1 invert bits 0 1 0 1 1 0 1 0 Add 1 0 1 0 1 1 0 1 1 Read negated binary 64+16+8+2+1 =3D 91 negate the decimal to get the original number -91 I always thought this trick of negating the weight of the msb to get the value of a two's complement number was a neat trick. I think I read it in Byte magazine a LONG TIME AGO. Harold --=20 FCC Rules Updated Daily at http://www.hallikainen.com - Advertising opportunities available! --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .