Mail Archives: djgpp/1998/05/14/04:25:34
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).
- Raw text -