The problem states: "What Intel x86 instructions would you use to accomplish subtraction using 2’s complement addition? This instruction set has a SUB instruction, but don’t use that; write your own 2’s complement routine instead".(adsbygoogle = window.adsbygoogle || []).push({});

Then the book states the answer:

MOV 51, EDX // copy what’s in 51 to the register

NEG EDX // take 2s complement of register

ADD EDX, 50 // subtract contents of 51 from 52

MOV EDX, 101 // store the result in 101

However it is hard for me to understand waht does this allgorithm do, in particular line 3: it takes some value to the register, take's 2's complement then it adds. But what does the 50 mean? Can anyone explain line 3?

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Subtraction using 2's complement addition question

**Physics Forums | Science Articles, Homework Help, Discussion**