From: Fabrice ILPONSE Newsgroups: comp.os.msdos.djgpp Subject: Re: Inline assembly in djgpp Date: Thu, 14 May 1998 14:26:26 +0200 Organization: Universites Paris VI/Paris VII - France Lines: 43 Message-ID: <355AE2F2.1F1D9073@asim.lip6.fr> References: <6je51h$h46$1 AT grissom DOT powerup DOT com DOT au> NNTP-Posting-Host: asim.lip6.fr 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 Herman Schoenfeld wrote: > > How do i do a "byte ptr" in djgpp inline asm? > > ie. > > mov ax, byte ptr a > asm ("movw ??, %%ax": : "g" (a): "ax"); movzwb ??,%%ax // unsigned or movswb ??,%%ax // signed if i remember... > > Is there any possible way to use variable names in inline assembly? > > int i=10, j=20; > asm ("movw %_i, %%eax": : "eax"); > asm ("movw %_j, %%ebx": : "ebx"); 2 ways: local variables: asm ("movw %0, %%ebx": : "m" j); // i'm not sure about 'm' globals: (and perhaps locals) int j asm ("myvar_j"); asm ("movw myvar_j, %%ebx"); > > I know that works, however if the above assembly is in a function and > the variables i,j are declared publically, then it decides to load those > not the ones declared inside the function. Why doesn't the scope rules > seem to affect djgpp inline asm? Or, is there a way around this? -- ^ ^ ^ | | | +-+-+ Fabrice ILPONSE | email: fabrice AT asim DOT lip6 DOT fr | | -