views:

44

answers:

2
+1  A: 

Think of the carry flag as a borrow bit when subtraction is performed. It is initialized to 1 so the operation is a−b−C, i.e., a + not(b) + C instead of a + not(b) + 1 as you described. In other words, the carry is inverted for subtract so it can be used to do multiple-precision subtract.

Doug Currie
+1  A: 

Found a link here: http://oopweb.com/Assembly/Documents/ArtOfAssembly/Volume/Chapter_6/CH06-2.html

It is as I expected. The carry flag is set only if "borrow" was required. When doing subtraction, you set the carry flag prior to doing the "subtract" and the new carry flag tells if you had to borrow. Your example omitted the addition of 1 for the pre-set carry flag in bit 17 which will cause no carry in the result.

phkahler