To: "Ian Chapman" , "Nate Eldredge" Date: Fri, 12 Jun 1998 06:50:57 -0700 From: "Ian Chapman" Message-ID: Mime-Version: 1.0 Cc: djgpp AT delorie DOT com, "Xavi Cardona" Subject: Re: Re: z80 to 386 Organization: MailCity (http://www.mailcity.com:80) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Nate, Nor I. Seems asm is a handoff reserved word/token. char asm_1[30] = was okay. Regards Ian. --- Ian Chapman, Home 819-243-3384 Bur 613-762-9185 >Ian Chapman wrote: >> >> Hi Xavi, >> I use >> >> *** char asm[30] ={"movb whatever"}; *** >> >> and it assembles Regards Ian. > >Huh??? The documentation says nothing like this, and I can't make it >work either. I think the original poster wanted some instructions >assembled and placed in an array, and that doesn't do it. If you really >have managed to do this, please post your exact code and GCC version. > >> Xavi Cardona wrote: >> > >> > Hi! >> > I'm working on a Z80 to 80386 machine code translator. >> > I make the following routine for putting the "movb $0x1,i" in the >> > string variable, but it doesn't work. Gcc says "parse error before >> > asm". >> > As you see, I don't want to execute the movb instruccion. I just want to >> > store the machine code of this instruccion on an array. >> > main() >> > {int i=5; >> > char string[30]; /*more space than we really need*/ >> > string=asm ("movb $0x1,%0" >> > :"=g" (i) >> > :"g" (i) ); >> > } >> > There is any easy :) way for doing this? >> > Thanks in advanced. > >Well.... you could do something like this: > >asm(".data \n\t" > "_string: \n\t" > "movb $0x1, %0 \n\t" > ".text" : "=g" (i) : "0" (i)); /* note change here; read docs for >why it's needed */ > >But that would require that: > >* It be outside all functions, or in a function that cannot be inlined. >* `i' be a global or static variable > >This would also not be useful for an assembler (which is basically what >you are writing), because for any case other than a move of that exact >value to the exact location at which `i' happens to reside, the code >wouldn't work. >-- > >Nate Eldredge >nate AT cartsys DOT com > > > Get your FREE, private e-mail account at http://www.mailcity.com