1 year ago

#323925

test-img

L Mac

Twos complement in MASM

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?

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?

assembly

masm

twos-complement

0 Answers

Your Answer

Accepted video resources