Date: Thu, 14 May 1998 11:25:00 +0300 (IDT) From: Eli Zaretskii To: Herman Schoenfeld cc: djgpp AT delorie DOT com Subject: Re: Inline assembly in djgpp In-Reply-To: <6je51h$h46$1@grissom.powerup.com.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On 14 May 1998, Herman Schoenfeld wrote: > Is there any possible way to use variable names in inline assembly? But of course! That's one of the main features of GCC's inline assembly. > int i=10, j=20; > asm ("movw %_i, %%eax": : "eax"); > asm ("movw %_j, %%ebx": : "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? The ``way around this'' is to read the documentation and use inline assembly like GCC Gods intended ;-). You are using inline assembly incorrectly: you shouldn't say %_j to mean the variable j. Please read the extended asm docs by typing "info gcc 'C Extensions' 'Extended asm'" from the DOS prompt (the issue is too complex to explain in a short message).