Mail Archives: djgpp/1998/06/29/05:57:10
Roberto wrote:
>
> I have two question:
> 1) How can I refer to local variable in inline asm ?
> If I have a global Variable I do it so:
> int i;
> main() {
> asm("mov _i, %ax");
> }
You should use GCC's extended asm features for this. Here's an example
(and the register becomes %eax, because ints are 32 bits):
asm("movl %0, %%eax"
: /* no outputs */
: "g" (i)
: "eax"); /* clobbers eax */
For more info, see this great tutorial:
http://www.rt66.com/~brennan/djgpp/djgpp_asm.html
> 2) How can i write the istruction mov ss:[bp] in Djgpp ?
Well, you'd say
mov[bwl] something, %ss:(%bp)
Actually, the %ss is redundant; references relative to %(e)bp are always
%ss-relative.
But be warned that this is almost certainly *not* what you want! DJGPP
programs run in protected mode, and 16-bit addresses are not useful. In
fact, I'm not even sure if GNU AS supports them properly. What you
probably want is something more along the lines of:
movl something, (%ebp)
--
Nate Eldredge
nate AT cartsys DOT com
- Raw text -