bizobo wrote

Got it to work (solution is at the end of this post - spoiler alert!), but I'm unsure why what worked worked. Is it because in 2's-radix for signed numbers the binary equivalent of the base 10 number I was entering was 16 bit's of 1's? I assume that must be the reason why.

Regardless, got it working now!

Set M to -1.

This is shown in figure 2.1 in the section about 2's complement numbers, albeit for 4-bit numbers instead of 16-bit. This is one of those facts that should become automatic; when you see -1 think all bits set.

Another thing that might help you see how 2's complement works is to think about counting.

0111 1111 1111 1111 is the largest 16-bit positive number -- in effect positive infinity. When you add 1 you get 1000 0000 0000 0000 which is a negative number since it has the sign bit set. It makes sense that this should be negative infinity -- the negative number with greatest magnitude.

When you add 1 again you get another negative number that should be closer to 0. Keep adding 1 and you eventually get to 1111 1111 1111 1111 which is -1. Add 1 again and you get back to 0.

--Mark