Sender: nate AT cartsys DOT com Message-ID: <35971747.FD57150F@cartsys.com> Date: Sun, 28 Jun 1998 21:25:43 -0700 From: Nate Eldredge MIME-Version: 1.0 To: dante AT ctonline DOT it CC: djgpp AT delorie DOT com Subject: Re: ASM with DJGPP References: <35960c15 DOT 2096193 AT news DOT interbusiness DOT it> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk 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