Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: rylan AT inbtekom DOT co DOT za, djgpp AT delorie DOT com Date: Wed, 19 Aug 1998 16:24:29 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Accessing C #define in inline assembly In-reply-to: <6r53ca$afu$1@winter.news.erols.com> Precedence: bulk "Rylan" wrote: > In DJGPP inline assembly, how can I access symbols "#defined" in the C file > in which the relevant inline assembly occurs? > > I have the following define: > > #define TIMEOUT 9000 > > How can I access this in inline assembler: > > __asm__ __volatile__ > (" > mov ??????,%cx > "); Easy use the "inmediate" constraint: #define TIMEOUT 9000 int main(int argc, char *argv[]) { asm("movl %0,%%eax" : : "i" (TIMEOUT)); return 0; } Gives: .file "p.c" gcc2_compiled.: ___gnu_compiled_c: .text .p2align 2 .globl _main _main: pushl %ebp movl %esp,%ebp /APP movl $9000,%eax /NO_APP xorl %eax,%eax jmp L1 .align 2,0x90 L1: leave ret SET ------------------------------------ 0 -------------------------------- Visit my home page: http://set-soft.home.ml.org/ or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(541) 759 0013