title: Twos complement in MASM
body: <p>why is it that in assembly language that if I subtract a variables value from a register that has a value of zero that I end up getting the two’s complement of that variable’s value?</p>
  <p>If I have an var1 with the value ‘D’ and then subtract it from a bh register that has a value of 0. I get the twos complement  however logic tells me that with hexadecimal i subtract 15 and then add 1 . If i translated it to binary I would flip the bits and add 1. So how does MASM come to conclusion without these formulas?</p>