Message-ID: <0be401c32086$3feaba00$0600000a@broadpark.no> From: "Gisle Vanem" To: References: <200305221512 DOT RAA06143 AT lws256 DOT lu DOT erisoft DOT se> Subject: Re: Add with carry Date: Thu, 22 May 2003 19:19:06 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Reply-To: djgpp-workers AT delorie DOT com > > I was just hit by this elsewhere in some 16-bit nasm code. > > To increment a 32-bit variable I used > > inc word [di] > > adc word [di+2], 0 > > > > Seems resonable, but got wrong result cause the carry > > was already set. Adding a 'clc' before the 'inc' fixed it. > > inc and dec don't affect the carry flag. add, adc, sub etc. do. Obs, must have been thinking of the AUX flag. --gv