From: Vic Newsgroups: comp.os.msdos.djgpp Subject: Re: ok with negative values in inline asm? Date: Sun, 24 May 1998 12:25:13 -0400 Organization: Communications Accessibles Montreal, Quebec Canada Lines: 21 Message-ID: <356849E9.65CD@cam.org> References: <35684706 DOT 3915845 AT nntpserver DOT swip DOT net> NNTP-Posting-Host: dialup-541.hip.cam.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Viktor Lundstrom wrote: > > I want to either subtract or add 1 to 32-bit register. > Would this decrease whatever is in %%edi with 1? : > asm ("movb $-1, %%ah > addl %%ah, %%edi" > : > : > :"%eax", "%edi"); > > Or do I have to use a 32bit register (ie. replacing ah with for > example ebx)? why not just use increment/decrement instructions? (Or do you want to add a bigger negative number? ) anyways, the code y-=2; outputs addl $-2,%eax so I guess, yes, you can use negative numbers. BTW, group: is there an instruction in ASM for substraction, or just addition?